summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2009-12-20 07:18:22 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2009-12-20 07:18:22 (GMT)
commit4b9fbebaee627393f0bdd501c8882c6b8cbdc1ff (patch)
treec3d1a195be3065b4981cb40f56cb077deb0364ba /Lib/urllib
parent890c19388762c7e93168d23e149cc03febc98269 (diff)
downloadcpython-4b9fbebaee627393f0bdd501c8882c6b8cbdc1ff.zip
cpython-4b9fbebaee627393f0bdd501c8882c6b8cbdc1ff.tar.gz
cpython-4b9fbebaee627393f0bdd501c8882c6b8cbdc1ff.tar.bz2
Merged revisions 76910 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76910 | senthil.kumaran | 2009-12-20 12:40:31 +0530 (Sun, 20 Dec 2009) | 10 lines Merged revisions 76908 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76908 | senthil.kumaran | 2009-12-20 11:35:13 +0530 (Sun, 20 Dec 2009) | 4 lines 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/urllib')
-rw-r--r--Lib/urllib/request.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index b977099..b12da69 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -31,8 +31,8 @@ install_opener -- Installs a new opener as the default opener.
objects of interest:
-OpenerDirector -- Sets up the User-Agent as the Python-urllib and manages the
-Handler classes while dealing with both requests and responses.
+OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
+the Handler classes, while dealing with requests and responses.
Request -- An object that encapsulates the state of a request. The
state can be as simple as the URL. It can also include extra HTTP
@@ -1059,7 +1059,14 @@ class AbstractHTTPHandler(BaseHandler):
headers = dict((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.selector, req.data, headers)