[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace
Changes by Berker Peksag berker.pek...@gmail.com: -- stage: patch review - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3073 ___ ___ 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
Changes by Christian Heimes li...@cheimes.de: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3073 ___ ___ 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
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: fixed - out of date ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3073 ___ ___ 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
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 SimpleCookie: foo='baz' 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 rep...@bugs.python.org http://bugs.python.org/issue3073 ___ ___ 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
Mark Lawrence breamore...@yahoo.co.uk 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 rep...@bugs.python.org http://bugs.python.org/issue3073 ___ ___ 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
Changes by Sergey Kirillov s...@rainboo.com: -- nosy: +rushman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3073 ___ ___ 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
Changes by cburroughs chris.burrou...@gmail.com: -- nosy: +cburroughs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3073 ___ ___ 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
Changes by Daniel Diniz aja...@gmail.com: -- priority: - normal stage: - patch review versions: -Python 2.4, Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3073 ___ ___ 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
Changes by Trent Mick [EMAIL PROTECTED]: -- nosy: +trentm ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3073 ___ ___ 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
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(?Pkey # Start of group 'key' [+ _LegalCharsPatt +]+? # Any word of at least one letter, nongreedy r) # End of group 'key' r\s*=\s*# Equal Sign r(?Pval # 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] http://bugs.python.org/issue3073 ___ ___ 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
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 SimpleCookie: foo='baz' 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] http://bugs.python.org/issue3073 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com