[Django] #27211: Include HTTP-caching headers to "304 Not Modified" responses

7 views
Skip to first unread message

Django

unread,
Sep 12, 2016, 10:15:27 AM9/12/16
to django-...@googlegroups.com
#27211: Include HTTP-caching headers to "304 Not Modified" responses
-------------------------------------+---------------------
Reporter: renskiy | Owner: renskiy
Type: New feature | Status: new
Component: Core (Cache system) | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+---------------------
Most browsers can cache responses with 304 HTTP code. So why not to
include such headers to response if necessary.

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

Django

unread,
Sep 12, 2016, 10:52:51 AM9/12/16
to django-...@googlegroups.com
#27211: Include HTTP-caching headers to "304 Not Modified" responses
-------------------------------+--------------------------------------

Reporter: renskiy | Owner: renskiy
Type: New feature | Status: new
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 timgraham):

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


Comment:

I didn't spot a reason for the behavior in the original ticket (#580). Can
you motivate this change with an example? You say "most browsers can cache
responses with 304 HTTP code" -- any idea why all browsers don't?

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

Django

unread,
Sep 12, 2016, 12:16:54 PM9/12/16
to django-...@googlegroups.com
#27211: Include HTTP-caching headers to "304 Not Modified" responses
-------------------------------+--------------------------------------

Reporter: renskiy | Owner: renskiy
Type: New feature | Status: new
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
-------------------------------+--------------------------------------

Comment (by renskiy):

The server generating a 304 response MUST generate any of the
following header fields that would have been sent in a 200 (OK)
response to the same request: Cache-Control, Content-Location, Date,
ETag, Expires, and Vary.
Taken from RFC7232: [https://tools.ietf.org/html/rfc7232#section-4.1].

Usually responses with 200 code will include such headers (e.g. from views
decorated with cache_page), so according to the RFC responses with 304
code must also include them.

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

Django

unread,
Sep 12, 2016, 12:56:27 PM9/12/16
to django-...@googlegroups.com
#27211: Include HTTP-caching headers to "304 Not Modified" responses
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: New feature | 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


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

Django

unread,
Sep 13, 2016, 12:09:50 AM9/13/16
to django-...@googlegroups.com
#27211: Include HTTP-caching headers to "304 Not Modified" responses
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy

Type: New feature | 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:

> Most browsers can cache responses with 304 HTTP code. So why not to
> include such headers to response if necessary.

New description:

Most browsers can cache responses with 304 HTTP code. So why not to
include such headers to response if necessary.

'''UPDATE''':
According to the [https://tools.ietf.org/html/rfc7232 RFC7232] all "304
Not Modified" responses must include "Cache-Control" and "Expires" headers
that would have been sent in a corresponding "200 OK" response.

See [https://tools.ietf.org/html/rfc7232#section-4.1 Section 4.1 of
RFC7232]

--

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

Django

unread,
Sep 13, 2016, 2:39:35 PM9/13/16
to django-...@googlegroups.com
#27211: Include HTTP-caching headers to "304 Not Modified" responses
-------------------------------+------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | 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 timgraham):

* has_patch: 0 => 1
* type: New feature => Bug
* stage: Unreviewed => Accepted


Old description:

> Most browsers can cache responses with 304 HTTP code. So why not to
> include such headers to response if necessary.
>

> '''UPDATE''':
> According to the [https://tools.ietf.org/html/rfc7232 RFC7232] all "304
> Not Modified" responses must include "Cache-Control" and "Expires"
> headers that would have been sent in a corresponding "200 OK" response.
>
> See [https://tools.ietf.org/html/rfc7232#section-4.1 Section 4.1 of
> RFC7232]

New description:

According to [https://tools.ietf.org/html/rfc7232#section-4.1 RFC7232] all


"304 Not Modified" responses must include "Cache-Control" and "Expires"
headers that would have been sent in a corresponding "200 OK" response.

--

Comment:

[https://github.com/django/django/pull/7236 PR]

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

Django

unread,
Sep 14, 2016, 4:20:53 PM9/14/16
to django-...@googlegroups.com
#27211: Include HTTP-caching headers to "304 Not Modified" responses
-------------------------------------+-------------------------------------
Reporter: renskiy | Owner: renskiy

Type: Bug | Status: assigned
Component: HTTP handling | Version: 1.10
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 timgraham):

* stage: Accepted => Ready for checkin


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

Django

unread,
Sep 14, 2016, 7:38:11 PM9/14/16
to django-...@googlegroups.com
#27211: Include HTTP-caching headers to "304 Not Modified" responses
-------------------------------------+-------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: closed

Component: HTTP handling | Version: 1.10
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: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"f9702977b72003c17db87d6e4fdaa36415f13a38" f9702977]:
{{{
#!CommitTicketReference repository=""
revision="f9702977b72003c17db87d6e4fdaa36415f13a38"
Fixed #27211 -- Made UpdateCacheMiddleware include caching headers for
"304 Not Modified" responses.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27211#comment:7>

Reply all
Reply to author
Forward
0 new messages