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-YYYY 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.

Here is a patch to the Python 2.7 head to fix Cookie.py and to
test_cookie.py to test parsing a cookie header string with an "Expires"
attribute with spaces. All the existing tests (including mainly the
docstring tests in Cookie.py) still pass.
If someone could review this for sanity, I'd be happy to check it in and
also do any tweaks necessary to patch the Python 3.1 tree as well.