#27686: calls to request.user.is_authenticated returns vary by cookie header for
all users
-------------------------------------+-------------------------------------
Reporter: Jeff Willette | Owner: Jeff
| Willette
Type: Bug | Status: closed
Component: contrib.sessions | Version: 1.10
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carl Meyer):
* status: assigned => closed
* resolution: => invalid
Comment:
I don't think the analysis in this ticket is correct. If we leave out the
`Vary: Cookie` for responses to unauthenticated users, when the view
checked the session (e.g. even just by calling
`request.is_authenticated()`), then a cache could incorrectly serve the
unauthed version of the response to an authenticated user.
Fundamentally, if your view ever checks the session and modifies the
response according to its contents (or lack thereof), then that response
is cookie-dependent and should have `Vary: Cookie` set. Whether the
session was empty or not is irrelevant; if a different session cookie
could have resulted in a different response, we need `Vary: Cookie`.
--
Ticket URL: <https://code.djangoproject.com/ticket/27686#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.5c4b4ec164f295e4cbc2fd046cc3da3d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.