[Django] #26765: Etags should not be added when no-store is used

7 views
Skip to first unread message

Django

unread,
Jun 16, 2016, 12:34:38 AM6/16/16
to django-...@googlegroups.com
#26765: Etags should not be added when no-store is used
--------------------------------------+--------------------
Reporter: marfire | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Cache system) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
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 [[https://tools.ietf.org/html/rfc7234|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).

--
Ticket URL: <https://code.djangoproject.com/ticket/26765>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 16, 2016, 2:30:19 PM6/16/16
to django-...@googlegroups.com
#26765: Etags should not be added when no-store is used
--------------------------------------+------------------------------------

Reporter: marfire | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_docs: => 0
* component: Core (Cache system) => HTTP handling
* needs_tests: => 0
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/26765#comment:1>

Django

unread,
Jun 22, 2016, 9:46:38 PM6/22/16
to django-...@googlegroups.com
#26765: Etags should not be added when no-store is used
-------------------------------------+-------------------------------------
Reporter: marfire | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by tobiasmcnulty):

* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


Comment:

Reviewed & notes left on the PR:
https://github.com/django/django/pull/6810

--
Ticket URL: <https://code.djangoproject.com/ticket/26765#comment:2>

Django

unread,
Jun 23, 2016, 5:54:03 AM6/23/16
to django-...@googlegroups.com
#26765: Etags should not be added when no-store is used
--------------------------------------+------------------------------------

Reporter: marfire | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by marfire):

* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

Added comments on the PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/26765#comment:3>

Django

unread,
Jun 24, 2016, 4:51:24 AM6/24/16
to django-...@googlegroups.com
#26765: Etags should not be added when no-store is used
-------------------------------------+-------------------------------------
Reporter: marfire | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by marfire):

* needs_better_patch: 1 => 0


* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26765#comment:4>

Django

unread,
Jul 15, 2016, 3:34:24 PM7/15/16
to django-...@googlegroups.com
#26765: Etags should not be added when no-store is used
-------------------------------------+-------------------------------------
Reporter: marfire | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: HTTP handling | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"20d39325ca1da57a709f3ba38299dc7b0fc4bdfb" 20d3932]:
{{{
#!CommitTicketReference repository=""
revision="20d39325ca1da57a709f3ba38299dc7b0fc4bdfb"
Fixed #26765 -- Made CommonMiddleware no longer set an ETag when response
has Cache-Control: no-store.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26765#comment:5>

Reply all
Reply to author
Forward
0 new messages