[issue5537] LWPCookieJar cannot handle cookies with expirations of 2038 or greater on 32-bit platforms
Chris Hollenbeck
report at bugs.python.org
Sun Mar 22 18:50:31 CET 2009
New submission from Chris Hollenbeck <chris.hollenbeck at gmail.com>:
The LWPCookieJar can be saved on 64-bit Ubuntu, but not on 32-bit Ubuntu
when the expiration year is greater than 2038. This has not been tested
on any other Intel-compatible Linux platform, though it appears related
to the Year 2038 bug. The MozillaCookieJar does not have a problem
saving on either architecture.
A sample crash is shown below:
File "/home/user/xblstatus/LiveConnect.py", line 189, in connect
self.cookiejar.save(self.cookieFile)
File "/usr/lib/python2.5/_LWPCookieJar.py", line 89, in save
f.write(self.as_lwp_str(ignore_discard, ignore_expires))
File "/usr/lib/python2.5/_LWPCookieJar.py", line 75, in as_lwp_str
r.append("Set-Cookie3: %s" % lwp_cookie_str(cookie))
File "/usr/lib/python2.5/_LWPCookieJar.py", line 35, in lwp_cookie_str
time2isoz(float(cookie.expires))))
File "/usr/lib/python2.5/cookielib.py", line 98, in time2isoz
year, mon, mday, hour, min, sec = time.gmtime(t)[:6]
ValueError: timestamp out of range for platform time_t
---
The cookie jar and urllib2 integration was done with:
self.cookiejar = cookielib.LWPCookieJar()
self.opener =
urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookiejar))
urllib2.install_opener(self.opener)
---
The code used to save the cookie after accessing the web page was:
self.cookiejar.save(self.cookieFile)
The cookieFile variable is simply the default location of the cookie
file for saving in the program.
----------
components: Library (Lib)
messages: 83979
nosy: hollec
severity: normal
status: open
title: LWPCookieJar cannot handle cookies with expirations of 2038 or greater on 32-bit platforms
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5537>
_______________________________________
More information about the Python-bugs-list
mailing list