[New-bugs-announce] [issue15769] urllib.request.urlopen with cafile or capath set overrides any previous Handlers

Brian Turek report at bugs.python.org
Thu Aug 23 03:35:09 CEST 2012


New submission from Brian Turek:

Using the code snippet below:

cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor())
urllib.request.install_opener(opener)
request = urllib.request.Request(url, data, headers) # url is https://something
sock = urllib.request.urlopen(request, cafile = 'cacert.pem')

One would expect to establish a verified HTTPS connection to the host and the cookies stored in the cookie jar.  Unfortunately urllib.request.urlopen, when called with cafile or capath set, calls urllib.request.build_opener without HTTPCookieProcessor included in the chain.  This results in never being able to support cookies in a "verified" HTTPS connection.

----------
components: Library (Lib)
messages: 168915
nosy: caligatio
priority: normal
severity: normal
status: open
title: urllib.request.urlopen with cafile or capath set overrides any previous Handlers
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15769>
_______________________________________


More information about the New-bugs-announce mailing list