Opened 9 years ago
Closed 9 years ago
#25644 closed Bug (fixed)
Setting a cookie after deletion should not keep 1970 as expiry date
Reported by: | Rollo Konig-Brock | Owned by: | Raphael Merx |
---|---|---|---|
Component: | HTTP handling | Version: | 1.8 |
Severity: | Normal | Keywords: | cookies http |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
If I delete a cookie, and then set it again, the cookie's expiration date will be Thu, 01-Jan-1970 00:00:00 GMT
meaning that it is still slated for deletion.
A failing test I wrote to verify this.
Change History (8)
comment:1 by , 9 years ago
Type: | Uncategorized → Bug |
---|
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 9 years ago
This seems easy to fix
-
django/http/response.py
--git a/django/http/response.py b/django/http/response.py index ed5c14e..cdc098f 100644
a b class HttpResponseBase(six.Iterator): 216 216 217 217 def delete_cookie(self, key, path='/', domain=None): 218 218 self.set_cookie(key, max_age=0, path=path, domain=domain, 219 expires=' Thu, 01-Jan-1970 00:00:00 GMT')219 expires='') 220 220 221 221 # Common methods used by subclasses
comment:5 by , 9 years ago
Replying to timgraham:
Will that still result in the browser deleting the cookie?
Tested, it doesn't.
comment:6 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
This seems easy to fix
django/http/response.py
Thu, 01-Jan-1970 00:00:00 GMT')