Message73518
PROBLEM:
Some sites (e.g. https://itunesconnect.apple.com) sends cookies where
version is "1" instead of 1. Cookielib chokes on it so none of the
cookies work after that.
PROBLEM CODE:
def _cookie_from_cookie_tuple(self, tup, request):
...
name, value, standard, rest = tup
...
version = standard.get("version", None)
if version is not None: version = int(version) << CRASH HERE!!!
WORKAROUND:
use my own cookie jar, e.g.:
class MyCookieJar(CookieJar):
def _cookie_from_cookie_tuple(self, tup, request):
name, value, standard, rest = tup
standard["version"]= None
CookieJar._cookie_from_cookie_tuple(self, tup, request)
REAL FIX:
do not assume that version is int, keep it as string if it does not
parse as int:
CRASH STACK:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/cookielib.py:1577:
UserWarning: cookielib bug!
Traceback (most recent call last):
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/cookielib.py",
line 1575, in make_cookies
parse_ns_headers(ns_hdrs), request)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/cookielib.py",
line 1532, in _cookies_from_attrs_set
cookie = self._cookie_from_cookie_tuple(tup, request)
File
"/Users/denis/Documents/svn2/tson/main/sales/src/download_sales.py",
line 28, in _cookie_from_cookie_tuple
CookieJar._cookie_from_cookie_tuple(self, tup, request)
File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/cookielib.py",
line 1451, in _cookie_from_cookie_tuple
if version is not None: version = int(version)
ValueError: invalid literal for int() with base 10: '"1"'
_warn_unhandled_exception() |
|
| Date |
User |
Action |
Args |
| 2008-09-21 18:30:25 | DenNukem | set | recipients:
+ DenNukem |
| 2008-09-21 18:30:24 | DenNukem | set | messageid: <1222021824.75.0.209543556591.issue3924@psf.upfronthosting.co.za> |
| 2008-09-21 18:30:24 | DenNukem | link | issue3924 messages |
| 2008-09-21 18:30:23 | DenNukem | create | |
|