diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2009-12-20 06:05:13 +0000 |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2009-12-20 06:05:13 +0000 |
commit | 7713acf201e9638966a9a8f8e38446400410e826 (patch) | |
tree | 27cdca52a87dd6575df9f6c2ab99361f00cea2ea /Lib/urllib2.py | |
parent | 062d2b52f3128f44bfd853459652e075c9bb5f40 (diff) | |
download | cpython-git-7713acf201e9638966a9a8f8e38446400410e826.tar.gz |
Fix for issue 7291 - urllib2 cannot handle https with proxy requiring auth
Refactored HTTPHandler tests and added testcase for proxy authorization.
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r-- | Lib/urllib2.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py index 8dcf8dad58..0f59096898 100644 --- a/Lib/urllib2.py +++ b/Lib/urllib2.py @@ -1120,7 +1120,14 @@ class AbstractHTTPHandler(BaseHandler): (name.title(), val) for name, val in headers.items()) if req._tunnel_host: - h.set_tunnel(req._tunnel_host) + tunnel_headers = {} + proxy_auth_hdr = "Proxy-Authorization" + if proxy_auth_hdr in headers: + tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr] + # Proxy-Authorization should not be sent to origin + # server. + del headers[proxy_auth_hdr] + h.set_tunnel(req._tunnel_host, headers=tunnel_headers) try: h.request(req.get_method(), req.get_selector(), req.data, headers) |