[Django] #27226: cache.patch_response_headers() adds ETag and Last-Modified to the response

7 views
Skip to first unread message

Django

unread,
Sep 15, 2016, 4:05:58 AM9/15/16
to django-...@googlegroups.com
#27226: cache.patch_response_headers() adds ETag and Last-Modified to the response
-------------------------------+---------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: new
Component: HTTP handling | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------
'''cache.patch_response_headers()''' adds ETag and Last-Modified headers
to the response while it is not it's responsibility. There are '''etag'''
and '''last_modified''' decorators in '''django.views.decorators.http
module''' to work with such headers.

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

Django

unread,
Sep 15, 2016, 4:06:13 AM9/15/16
to django-...@googlegroups.com
#27226: cache.patch_response_headers() adds ETag and Last-Modified to the response
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Sep 15, 2016, 4:09:12 AM9/15/16
to django-...@googlegroups.com
#27226: cache.patch_response_headers() adds ETag and Last-Modified to the response
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

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

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by renskiy:

Old description:

> '''cache.patch_response_headers()''' adds ETag and Last-Modified headers
> to the response while it is not it's responsibility. There are '''etag'''
> and '''last_modified''' decorators in '''django.views.decorators.http
> module''' to work with such headers.

New description:

'''cache.patch_response_headers()''' adds ETag and Last-Modified headers
to the response while it is not it's responsibility. There are '''etag'''
and '''last_modified''' decorators in '''django.views.decorators.http'''
module to work with such headers.

--

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

Django

unread,
Sep 23, 2016, 10:35:53 AM9/23/16
to django-...@googlegroups.com
#27226: Remove patch_response_headers()'s setting of the "Last-Modified" header
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Rinat
Type: | Khabibiev
Cleanup/optimization | Status: assigned

Component: HTTP handling | Version: 1.10
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 Tim Graham):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

The ETag removal will go through a deprecation in #26447 so this ticket is
limited to removing the Last-Modified header. There's some discussion on
the [https://github.com/django/django/pull/7247 PR] about whether or not
removing it could result in behavior changes.

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

Django

unread,
Sep 28, 2016, 7:05:15 AM9/28/16
to django-...@googlegroups.com
#27226: Remove patch_response_headers()'s setting of the "Last-Modified" header
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Rinat
Type: | Khabibiev
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: 1 => 0


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

Django

unread,
Sep 28, 2016, 9:13:28 AM9/28/16
to django-...@googlegroups.com
#27226: Remove patch_response_headers()'s setting of the "Last-Modified" header
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Rinat
Type: | Khabibiev
Cleanup/optimization | Status: closed

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
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: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"9e07a9b5feb30fe06fb23d0e77edd34f6c3f92b5" 9e07a9b]:
{{{
#!CommitTicketReference repository=""
revision="9e07a9b5feb30fe06fb23d0e77edd34f6c3f92b5"
Fixed #27226 -- Removed patch_response_headers()'s setting of the Last-
Modified header.
}}}

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

Django

unread,
May 1, 2018, 7:13:09 PM5/1/18
to django-...@googlegroups.com
#27226: Remove patch_response_headers()'s setting of the "Last-Modified" header
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Rinat
Type: | Khabibiev
Cleanup/optimization | Status: closed
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Josh Smeaton):

For future visitors, this change breaks the default Akamai caching
configuration which depends on a Last-Modified header. Akamai also allows
opting in to ETag based caching strategies, but it is not the default. To
fix Akamai caching, you'll need to add the Last-Modified header to the
response:

{{{
from django.utils.http import http_date
if not response.has_header('Last-Modified'):
response['Last-Modified'] = http_date()

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27226#comment:6>

Reply all
Reply to author
Forward
0 new messages