summaryrefslogtreecommitdiff
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 03bd5f8af2..a976533918 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)