Code

Opened 7 years ago

Closed 7 years ago

#4994 closed (fixed)

Cookies are not sent back for HTTP Not Modified (304) from CommonMiddleware

Reported by: colin@… Owned by: mtredinnick
Component: HTTP handling Version: master
Severity: Keywords: etags
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The CommonMiddleware functionality generates a new HTTP Response object (304) when the E-Tag matches. This new response does not include the Set-Cookie header, which then breaks the login page from django.contrib.auth.views.login.

This also violates the Cookie specification (see http://wp.netscape.com/newsref/std/cookie_spec.html): If a proxy server receives a response which contains a Set-cookie header, it should propagate the Set-cookie header to the client, regardless of whether the response was 304 (Not Modified) or 200 (OK).

The attached patch solves this by moving any set cookies over into the new response object.

Attachments (1)

common-middleware-fix.patch (639 bytes) - added by colin@… 7 years ago.
Patch for 304 and Cookies

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by colin@…

Patch for 304 and Cookies

comment:1 Changed 7 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [5878]) Fixed #4994 -- Send back set-cookie headers in "not modified" responses. Well spotted, colin@….

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.