Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7291] urllib2 cannot handle https with proxy requiring auth

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 8, 2009, 8:38 PM

Post #1 of 6 (433 views)
Permalink
[issue7291] urllib2 cannot handle https with proxy requiring auth

New submission from Tatsuhiro Tsujikawa <tsujikawa [at] gp>:

urllib2 cannot handle https with proxy requiring authorization.

After https_proxy is set correctly,

Python 2.6.4 (r264:75706, Oct 29 2009, 15:38:25)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> c=urllib2.urlopen("https://sourceforge.net")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/urllib2.py", line 124, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.6/urllib2.py", line 389, in open
response = self._open(req, data)
File "/usr/lib/python2.6/urllib2.py", line 407, in _open
'_open', req)
File "/usr/lib/python2.6/urllib2.py", line 367, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 1154, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib/python2.6/urllib2.py", line 1121, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error Tunnel connection failed: 407 Proxy
Authentication Required>

This is because HTTPConnection::_tunnel() in httplib.py doesn't send
Proxy-Authorization header.

----------
components: Library (Lib)
messages: 95058
nosy: tsujikawa
severity: normal
status: open
title: urllib2 cannot handle https with proxy requiring auth
versions: Python 2.6

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 8, 2009, 10:56 PM

Post #2 of 6 (399 views)
Permalink
[issue7291] urllib2 cannot handle https with proxy requiring auth [In reply to]

Tatsuhiro Tsujikawa <tsujikawa [at] gp> added the comment:

I created a patch.
I added additional argument 'headers' to HTTPConnection::set_tunnel()
method,
which is a mapping of HTTP headers to sent with CONNECT method. Since
authorization
credential is already set to Request object, in
AbstractHTTPHandler::do_open(),
if "Proxy-Authorization" header is found, pass it to set_tunnel().

It works fine for me.

----------
keywords: +patch
Added file: http://bugs.python.org/file15296/https_proxy_auth.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 10, 2009, 5:06 PM

Post #3 of 6 (389 views)
Permalink
[issue7291] urllib2 cannot handle https with proxy requiring auth [In reply to]

Changes by Tatsuhiro Tsujikawa <tsujikawa [at] gp>:


----------
versions: +Python 2.7

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 15, 2009, 1:21 AM

Post #4 of 6 (372 views)
Permalink
[issue7291] urllib2 cannot handle https with proxy requiring auth [In reply to]

Changes by Senthil Kumaran <orsenthil [at] gmail>:


----------
assignee: -> orsenthil
nosy: +orsenthil
resolution: -> accepted

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 17, 2009, 2:40 AM

Post #5 of 6 (358 views)
Permalink
[issue7291] urllib2 cannot handle https with proxy requiring auth [In reply to]

Ronald Oussoren <ronaldoussoren [at] mac> added the comment:

The patch looks good to me.

IMHO this should be backported to 2.6 as well.

----------
keywords: +needs review
nosy: +ronaldoussoren

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 17, 2009, 2:52 AM

Post #6 of 6 (355 views)
Permalink
[issue7291] urllib2 cannot handle https with proxy requiring auth [In reply to]

Ronald Oussoren <ronaldoussoren [at] mac> added the comment:

I've tested a backport of the patch to 2.6 (just replace set_proxy by
_set_proxy in the patch) and the resulting version of urllib2 can login to
the proxy (as expected).

Thanks for the patch.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.