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

2012-08-23 Thread Brian Turek

Brian Turek added the comment:

So I'm not saying the attached patch is the *best* solution but it doesn't 
mangle the existing urllib.request._opener too much.

--
keywords: +patch
Added file: http://bugs.python.org/file26977/request.patch

___
Python tracker 
<http://bugs.python.org/issue15769>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-23 Thread Brian Turek

Brian Turek added the comment:

I was actually going to come up with a patch that does the same thing orsenthil 
mentioned until I too was stymied by the use of bisect.insort

Does anyone know why bisect.insort was used instead of just list.append?  I 
don't see an obvious reason so I think just having add_handler insert new 
handlers at the beginning of all the respective lists would be an easy fix.

--

___
Python tracker 
<http://bugs.python.org/issue15769>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-08-22 Thread Brian Turek

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 
<http://bugs.python.org/issue15769>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com