classification
Title: date format problem in Cookie/http.cookies
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: ezio.melotti, federico.reghenzani, orsenthil, python-dev, r.david.murray, valtron
Priority: normal Keywords: easy

Created on 2012-03-27 17:37 by valtron, last changed 2012-05-20 09:00 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
cookie_3.py federico.reghenzani, 2012-03-27 18:16 review
Messages (7)
msg156946 - (view) Author: valtron (valtron) Date: 2012-03-27 17:37
Cookie.py doesn't format the expiry date correctly. The problematic line is: http://hg.python.org/cpython/file/2.7/Lib/Cookie.py#l393, which should read 'return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \' (spaces instead of dashes). The RFC specifying the date format is http://tools.ietf.org/html/rfc2616#section-3.3.1; you can see that with dashes, only a 2-digit year is allowed (date2).
msg156949 - (view) Author: Federico Reghenzani (federico.reghenzani) * Date: 2012-03-27 18:16
The same problem is present in newest version of Python. I attacched a patch for python 3.
msg157021 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-03-29 10:10
Thanks for the patch.

However, the RFC is one thing, but what happens in the real world?  Cookies are very messy in the real world, and we cannot just assume that the RFC version works.
msg161179 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2012-05-20 03:41
Actually, the claim is correct, there is no dash separated expiry dates even in the real world. Tested with couple of sites like gmail, wikipedia and few more.
msg161181 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-20 04:08
New changeset 1db41c410f63 by Senthil Kumaran in branch '2.7':
Issue #14426: Correct the Date format in Expires attribute of Set-Cookie. Patch by Federico Reghenzani and Müte Invert
http://hg.python.org/cpython/rev/1db41c410f63

New changeset a5fa068143eb by Senthil Kumaran in branch '3.2':
Issue #14426: Correct the Date format in Expires attribute of Set-Cookie. Patch by Federico Reghenzani and Müte Invert
http://hg.python.org/cpython/rev/a5fa068143eb

New changeset 32cf38bfb36f by Senthil Kumaran in branch '3.2':
news for Issue14426
http://hg.python.org/cpython/rev/32cf38bfb36f

New changeset 8e476cca25ff by Senthil Kumaran in branch 'default':
Issue #14426: Correct the Date format in Expires attribute of Set-Cookie. Patch by Federico Reghenzani and Müte Invert
http://hg.python.org/cpython/rev/8e476cca25ff

New changeset 90ffd6c98057 by Senthil Kumaran in branch 'default':
news for Issue14426
http://hg.python.org/cpython/rev/90ffd6c98057
msg161182 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2012-05-20 04:25
This is fixed in all the branches. Note here - the test change is actually not the coverage because Cookie tests cover the scenarios of SimpleCookie class of both loading the formatted date and setting the formatted date. It is only testing the setting of expires header and not the format of the date. 

The Morsel class and "all" it's method needs to be covered by separate tests and  coverage of this change would fall in there. I think, this should be tracked in a different issue.
msg161192 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-20 09:00
New changeset f457419552e3 by Senthil Kumaran in branch '2.7':
Fix for issue14426 - buildbots here I come
http://hg.python.org/cpython/rev/f457419552e3

New changeset f9d31d6977f1 by Senthil Kumaran in branch '3.2':
Fix for issue14426 - buildbots here I come
http://hg.python.org/cpython/rev/f9d31d6977f1

New changeset ca2a793d6c7b by Senthil Kumaran in branch 'default':
merge - Fix for issue14426 - buildbots here I come
http://hg.python.org/cpython/rev/ca2a793d6c7b
History
Date User Action Args
2012-05-20 09:00:22python-devsetmessages: + msg161192
2012-05-20 04:25:19orsenthilsetstatus: open -> closed
messages: + msg161182

assignee: orsenthil
resolution: fixed
stage: test needed -> resolved
2012-05-20 04:08:46python-devsetnosy: + python-dev
messages: + msg161181
2012-05-20 03:41:12orsenthilsetmessages: + msg161179
2012-05-06 22:40:40ezio.melottisetkeywords: + easy
nosy: + ezio.melotti
2012-03-29 10:10:46r.david.murraysetnosy: + r.david.murray
messages: + msg157021
2012-03-28 05:28:09eric.araujosetnosy: + orsenthil
title: Lib/Cookie.py date format problem -> date format problem in Cookie/http.cookies

stage: test needed
versions: - Python 3.1
2012-03-27 18:16:51federico.reghenzanisetfiles: + cookie_3.py
versions: + Python 3.1, Python 3.2, Python 3.3
nosy: + federico.reghenzani

messages: + msg156949
2012-03-27 17:37:58valtroncreate