Opened 2 years ago

Closed 23 months ago

#26765 closed Cleanup/optimization (fixed)

Etags should not be added when no-store is used

Reported by: Kevin Christopher Henry Owned by: nobody
Component: HTTP handling Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Glancing at the source code, it looks like CommonMiddleware (with USE_ETAGS = True) adds an Etag whenever there isn't one already.

However, according to RFC 7234, "the no-store response directive indicates that a cache MUST NOT store any part of either the immediate request or response." Since the response must not be stored, no compliant cache will be able to issue a conditional request, so computing the Etag is wasted effort. (Note that this behavior is different from no-cache.)

The current behavior doesn't do any real harm, but we might as well improve the performance of such requests given that the change should be relatively easy (simply checking the header value).

Change History (5)

comment:1 Changed 2 years ago by Tim Graham

Component: Core (Cache system)HTTP handling
Triage Stage: UnreviewedAccepted

comment:2 Changed 2 years ago by Tobias McNulty

Has patch: set
Triage Stage: AcceptedReady for checkin

Reviewed & notes left on the PR:

comment:3 Changed 2 years ago by Kevin Christopher Henry

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

Added comments on the PR.

comment:4 Changed 2 years ago by Kevin Christopher Henry

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:5 Changed 23 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 20d3932:

Fixed #26765 -- Made CommonMiddleware no longer set an ETag when response has Cache-Control: no-store.

Note: See TracTickets for help on using tickets.
Back to Top