Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie library doesn't parse date properly #59285

Closed
jgillick mannequin opened this issue Jun 15, 2012 · 4 comments
Closed

Cookie library doesn't parse date properly #59285

jgillick mannequin opened this issue Jun 15, 2012 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@jgillick
Copy link
Mannequin

jgillick mannequin commented Jun 15, 2012

BPO 15080
Nosy @terryjreedy, @serwy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2012-06-23.05:01:01.932>
created_at = <Date 2012-06-15.20:20:55.323>
labels = ['type-bug', 'library']
title = "Cookie library doesn't parse date properly"
updated_at = <Date 2012-06-23.05:01:01.851>
user = 'https://bugs.python.org/jgillick'

bugs.python.org fields:

activity = <Date 2012-06-23.05:01:01.851>
actor = 'terry.reedy'
assignee = 'none'
closed = True
closed_date = <Date 2012-06-23.05:01:01.932>
closer = 'terry.reedy'
components = ['Library (Lib)']
creation = <Date 2012-06-15.20:20:55.323>
creator = 'jgillick'
dependencies = []
files = []
hgrepos = []
issue_num = 15080
keywords = []
message_count = 4.0
messages = ['162932', '162935', '162936', '163530']
nosy_count = 3.0
nosy_names = ['terry.reedy', 'roger.serwy', 'jgillick']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue15080'
versions = ['Python 2.6']

@jgillick
Copy link
Mannequin Author

jgillick mannequin commented Jun 15, 2012

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.

@jgillick jgillick mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jun 15, 2012
@serwy
Copy link
Mannequin

serwy mannequin commented Jun 15, 2012

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?

@jgillick
Copy link
Mannequin Author

jgillick mannequin commented Jun 15, 2012

I'm using Python 2.6.1

@terryjreedy
Copy link
Member

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant