This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Cookie library doesn't parse date properly
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: jgillick, roger.serwy, terry.reedy
Priority: normal Keywords:

Created on 2012-06-15 20:20 by jgillick, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg162932 - (view) Author: Jeremy Gillick (jgillick) Date: 2012-06-15 20:20
The cookie library doesn't seem to support the standard date format (RFC 822) for the expire property while parsing a cookie. 

For example, in the Python prompt:

    >>> import Cookie
    >>> cookie = Cookie.SimpleCookie('bcookie="123"; Expires=Sat, 14-Jun-2014 23:03:13 GMT;')
    >>> cookie['bcookie']['expires']
    'Sat,'

That is a standard header, but it only processes the date up to the first space.
msg162935 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-06-15 20:55
2.6.8 is the latest source-only release of the 2.6 series. Here's what I get:

    Python 2.6.8 (unknown, Jun 15 2012, 15:51:46) 
    [GCC 4.5.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import Cookie
    >>> cookie = Cookie.SimpleCookie('bcookie="123"; Expires=Sat, 14-Jun-2014 23:03:13 GMT;')
    >>> cookie['bcookie']['expires']
    'Sat, 14-Jun-2014 23:03:13 GMT'

Jeremy, what is the exact version of 2.6 being used?
msg162936 - (view) Author: Jeremy Gillick (jgillick) Date: 2012-06-15 21:09
I'm using Python 2.6.1
msg163530 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-06-23 05:01
Jeremy, when reporting bugs, please first check the latest release. This works in current 2.7.3 (as well as latest 2.6.8 and 3.3.0).
>>> import Cookie
>>> cookie = Cookie.SimpleCookie('bcookie="123"; Expires=Sat, 14-Jun-2014 23:03:13 GMT;')
>>> cookie['bcookie']['expires']
'Sat, 14-Jun-2014 23:03:13 GMT'

2.6 only gets security patches. There have been as least a thousand patches since 2.6.1 and this is one of them.
History
Date User Action Args
2022-04-11 14:57:31adminsetgithub: 59285
2012-06-23 05:01:01terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg163530

resolution: out of date
2012-06-15 21:09:30jgillicksetmessages: + msg162936
2012-06-15 20:55:18roger.serwysetnosy: + roger.serwy
messages: + msg162935
2012-06-15 20:20:55jgillickcreate