[Django] #30701: Django generates overly verbose and possibly invalid Vary headers

14 views
Skip to first unread message

Django

unread,
Aug 12, 2019, 4:54:33 AM8/12/19
to django-...@googlegroups.com
#30701: Django generates overly verbose and possibly invalid Vary headers
-----------------------------------------+------------------------
Reporter: Alexander-TX | Owner: nobody
Type: Bug | Status: new
Component: HTTP handling | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------
Function "patch_vary_headers", simply appends new headers to list. If view
code sets Vary header to asterisk, the resulting header (after applying
SessionMiddleware and LocaleMiddleware) looks like this:

{{{
Vary: *, Accept-Language, Cookie
}}}

This is unnecessary and possible violates HTTP spec:

{{{
The "Vary" header field in a response describes what parts of a
request message, aside from the method, Host header field, and
request target, might influence the origin server's process for
selecting and representing this response. The value consists of
either a single asterisk ("*") or a list of header field names
(case-insensitive).

Vary = "*" / 1#field-name
}}}

(from https://tools.ietf.org/html/rfc7231#page-70)

I am using Django to implement REST API, so I'd like it to speak robust
HTTP, that works with all present and future caching libraries, — even if
widely used browsers and Nginx can correctly interpret current form of the
header.

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

Django

unread,
Aug 12, 2019, 6:15:55 AM8/12/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+------------------------------------
Reporter: Alexander-TX | Owner: nobody
Type: New feature | Status: new
Component: Core (Cache system) | Version: 2.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Carlton Gibson):

* type: Bug => New feature
* stage: Unreviewed => Accepted
* component: HTTP handling => Core (Cache system)


Comment:

Hi Alexander. Thanks for the report.

Happy to accept this as an enhancement. (It's clear from the existing test
cases that `'*'` was never considered.)

I was going to uncheck "Easy Pickings" but perhaps it is simple enough...

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

Django

unread,
Aug 13, 2019, 4:28:15 PM8/13/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Adnan
| Umer
Type: New feature | Status: assigned

Component: Core (Cache system) | Version: 2.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adnan Umer):

* owner: nobody => Adnan Umer
* status: new => assigned


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

Django

unread,
Aug 13, 2019, 4:42:50 PM8/13/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Adnan
| Umer
Type: New feature | Status: assigned
Component: Core (Cache system) | Version: 2.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adnan Umer):

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

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

Django

unread,
Aug 14, 2019, 9:21:43 AM8/14/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Adnan
| Umer
Type: New feature | Status: assigned
Component: Core (Cache system) | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* needs_docs: 0 => 1
* version: 2.2 => master


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

Django

unread,
Aug 15, 2019, 2:36:30 PM8/15/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Adnan
| Umer
Type: New feature | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adnan Umer):

* needs_docs: 1 => 0


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

Django

unread,
Aug 16, 2019, 8:06:13 AM8/16/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Ngalim
| Siregar

Type: New feature | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ngalim Siregar):

* owner: Adnan Umer => Ngalim Siregar


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

Django

unread,
Aug 16, 2019, 8:06:39 AM8/16/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Adnan
| Umer

Type: New feature | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ngalim Siregar):

* owner: Ngalim Siregar => Adnan Umer


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

Django

unread,
Aug 16, 2019, 9:22:43 AM8/16/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Adnan
Type: | Umer
Cleanup/optimization | Status: assigned

Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* has_patch: 0 => 1
* type: New feature => Cleanup/optimization


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

Django

unread,
Aug 16, 2019, 11:24:19 AM8/16/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Adnan
Type: | Umer
Cleanup/optimization | Status: assigned
Component: Core (Cache system) | 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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


Comment:

PR Looks good.

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

Django

unread,
Aug 16, 2019, 11:30:06 AM8/16/19
to django-...@googlegroups.com
#30701: Allowing patch_vary_headers() caching utility to handle '*' value.
-------------------------------------+-------------------------------------
Reporter: Alexander-TX | Owner: Adnan
Type: | Umer
Cleanup/optimization | Status: closed

Component: Core (Cache system) | 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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"6805c0f99f4790f28a97d597934d0877ba81dba9" 6805c0f9]:
{{{
#!CommitTicketReference repository=""
revision="6805c0f99f4790f28a97d597934d0877ba81dba9"
Fixed #30701 -- Updated patch_vary_headers() to handle an asterisk
according to RFC 7231.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30701#comment:8>

Reply all
Reply to author
Forward
0 new messages