Author ikreymer
Recipients ikreymer
Date 2016-03-16.04:29:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458102578.18.0.474747054638.issue26570@psf.upfronthosting.co.za>
In-reply-to
Content
This is a peculiar regression in 3.5 where a comma-separated cookie following an expires field is considered invalid:

Ex: which results in a silent error/empty cookie in 3.5.1

Python 3.5.1 (default, Dec 26 2015, 18:11:22) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from http.cookies import SimpleCookie
>>> SimpleCookie('A=B; expires=Thu, 01-Jan-1970 00:00:00 GMT, C=D')
<SimpleCookie: >

compared to 3.4.2 and 2.7.9

Python 3.4.2 (default, Jan 29 2015, 06:45:30) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from http.cookies import SimpleCookie
>>> SimpleCookie('A=B; expires=Thu, 01-Jan-1970 00:00:00 GMT, C=D')
<SimpleCookie: A='B' C='D'>

Python 2.7.9 (default, Jan 29 2015, 06:28:46) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from Cookie import SimpleCookie
>>> SimpleCookie('A=B; expires=Thu, 01-Jan-1970 00:00:00 GMT, C=D')
<SimpleCookie: A='B' C='D'>




This seems to specifically happen when the expires field is the last field in the cookie.
eg, this works as expected:

>>> SimpleCookie('A=B; expires=Thu, 01-Jan-1970 00:00:00 GMT; Path=/, C=D')
<SimpleCookie: A='B' C='D'>

I'm not sure if this is related to the other comma-related cookie bugs, such as issue26302 as this does not appear to use the same regex at first glance. I have not had a chance to track it down it further.
History
Date User Action Args
2016-03-16 04:29:38ikreymersetrecipients: + ikreymer
2016-03-16 04:29:38ikreymersetmessageid: <1458102578.18.0.474747054638.issue26570@psf.upfronthosting.co.za>
2016-03-16 04:29:37ikreymerlinkissue26570 messages
2016-03-16 04:29:36ikreymercreate