CookieAgent fails when it encounters "secure" cookies
|Reported by:||exarkun||Owned by:||therve|
|Cc:||jonathanj, therve, jknight, jesstess||Branch:||
(github, patch, buildbot, log)
Cookies can be marked as "secure" which basically means they should only be transmitted over an HTTPS connection. CookieAgent passes a fake for urllib2.Request to the cookielib.CookieJar it uses, and this fails when the jar has a secure cookie and wants to know if the transport is going to be secure:
Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/exarkun/Projects/Twisted/trunk/twisted/web/client.py", line 1046, in request self.cookieJar.add_cookie_header(lastRequest) File "/usr/lib/python2.6/cookielib.py", line 1323, in add_cookie_header cookies = self._cookies_for_request(request) File "/usr/lib/python2.6/cookielib.py", line 1249, in _cookies_for_request cookies.extend(self._cookies_for_domain(domain, request)) File "/usr/lib/python2.6/cookielib.py", line 1238, in _cookies_for_domain if not self._policy.return_ok(cookie, request): File "/usr/lib/python2.6/cookielib.py", line 1070, in return_ok if not fn(cookie, request): File "/usr/lib/python2.6/cookielib.py", line 1096, in return_ok_secure if cookie.secure and request.get_type() != "https": AttributeError: '_FakeUrllib2Request' object has no attribute 'get_type'
Since CookieAgent is new, it would be nice to fix this before it's included in a release.
Change History (10)
comment:9 Changed 4 years ago by jesstess
- Cc jesstess added
- Keywords review removed
- Owner changed from jesstess to therve