[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2014-01-21 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: patch review -> committed/rejected

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2013-01-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution: fixed -> out of date

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2013-01-09 Thread Christian Heimes

Changes by Christian Heimes :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2012-12-10 Thread Berker Peksag

Berker Peksag added the comment:

The bug has been fixed in issue 8826.

Related changeset:

- http://hg.python.org/cpython/rev/cb231b79693e/
- Backport: http://hg.python.org/cpython/rev/84363c747c21

In Python 2.7.3:

>>> from Cookie import SimpleCookie
>>> cookies = SimpleCookie()
>>> cookies.load('foo=baz; expires=Sat, 10-Jun-1978 09:41:04 GMT')
>>> cookies

>>> cookies['foo']['expires']
'Sat, 10-Jun-1978 09:41:04 GMT'
>>> cookies.load('foo=baz; expires=2008-06-10T09:44:45.963024')
>>> cookies['foo']['expires']
'2008-06-10T09:44:45.963024'

--
nosy: +berker.peksag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2010-07-18 Thread Mark Lawrence

Mark Lawrence  added the comment:

Anyone with knowledge of cookies and/or regexes who could review this?  The 
patch isn't that big and includes unit tests.  Note also Trent's offer to check 
it in and patch py3k.

--
nosy: +BreamoreBoy
versions: +Python 3.2 -Python 2.6, Python 3.0

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2010-05-20 Thread Sergey Kirillov

Changes by Sergey Kirillov :


--
nosy: +rushman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2010-04-01 Thread cburroughs

Changes by cburroughs :


--
nosy: +cburroughs

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2009-04-22 Thread Daniel Diniz

Changes by Daniel Diniz :


--
priority:  -> normal
stage:  -> patch review
versions:  -Python 2.4, Python 2.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2008-11-07 Thread mixedpuppy

mixedpuppy <[EMAIL PROTECTED]> added the comment:

The problem is that spaces are not allowed in the attribute values. 
Here is a work around

# hack fix of Cookie.BasicCookie
import Cookie
import re
_LegalCharsPatt  = r"\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\="
_FixedCookiePattern = re.compile(
r"(?x)"   # This is a Verbose pattern
r"(?P"   # Start of group 'key'
"["+ _LegalCharsPatt +"]+?" # Any word of at least one letter,
nongreedy
r")"  # End of group 'key'
r"\s*=\s*"# Equal Sign
r"(?P"   # Start of group 'val'
r'"(?:[^\\"]|\\.)*"'# Any doublequoted string
r"|"# or
"["+ _LegalCharsPatt +"\ ]*"# Any word or empty string
r")"  # End of group 'val'
r"\s*;?"  # Probably ending in a semi-colon
)

class FixedCookie(Cookie.SimpleCookie):
def load(self, rawdata):
"""Load cookies from a string (presumably HTTP_COOKIE) or
from a dictionary.  Loading cookies from a dictionary 'd'
is equivalent to calling:
map(Cookie.__setitem__, d.keys(), d.values())
"""
if type(rawdata) == type(""):
self._BaseCookie__ParseString(rawdata, _FixedCookiePattern)
else:
self.update(rawdata)
return

--
nosy: +mixedpuppy

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2008-11-07 Thread Trent Mick

Changes by Trent Mick <[EMAIL PROTECTED]>:


--
nosy: +trentm

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2008-06-10 Thread Lawrence Oluyede

New submission from Lawrence Oluyede <[EMAIL PROTECTED]>:

It seems the Cookie module has an odd behavior with whitespaces.
According to http://wp.netscape.com/newsref/std/cookie_spec.html and
http://en.wikipedia.org/wiki/HTTP_cookie#Cookie_attributes the 'Expires'
attribute of the cookie should have this format:

"Wdy, DD-Mon- HH:MM:SS GMT"

and this is recognized by all the browsers. The oddity comes when I try
to load or create a cookie with that attribute:

Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Cookie import SimpleCookie
>>> cookies = SimpleCookie()
>>> cookies.load('foo=baz; expires=Sat, 10-Jun-1978 09:41:04 GMT')
>>> cookies

>>> cookies['foo']['expires']
'Sat,'
>>> cookies.load('foo=baz; expires=2008-06-10T09:44:45.963024')
>>> cookies['foo']['expires']
'2008-06-10T09:44:45.963024'

It really seems the parser breaks on whitespaces.

--
components: Library (Lib)
messages: 67901
nosy: rhymes
severity: normal
status: open
title: Cookie.Morsel breaks in parsing cookie values with whitespace
type: behavior
versions: Python 2.5

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com