Mike Beachy <mbea...@gmail.com> added the comment:

I have worked up a monkey patch for urllib2/httplib for the issue of setting 
the authentication using a Proxy(Basic|Digest)AuthHandler.

The basic approach was to create a new httplib exception (ProxyTunnelError) and 
raise that with the http response attached so that the HTTPSHandler can 
determine when 407 Proxy authentication required is present, and then reroute 
the urllib2.OpenerDirector to error handling mode.

Unfortunately, there is a backwards compatibility issue - cases where a 
socket.error was previously being raised now get an ProxyTunnelError. Not that 
you could do much useful with the socket.error in the first place, but I 
suppose you could look for '407' in the text. Ugh.

If you think this might prove useful, let me know and I can rework it into a 
real patch - just let me know what branch/version to base it off of. (My monkey 
patch is for python 2.6.4.)

----------
nosy: +mbeachy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to