Opened 8 years ago
Closed 8 years 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: | dev |
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 |
Description
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 by , 8 years ago
Component: | Core (Cache system) → HTTP handling |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 8 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:3 by , 8 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Added comments on the PR.
comment:4 by , 8 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Reviewed & notes left on the PR: https://github.com/django/django/pull/6810