Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mechanize/_urllib2_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,13 @@ def do_open(self, http_class, req):
set_tunnel = h._set_tunnel
else:
set_tunnel = h.set_tunnel
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]
set_tunnel(req._tunnel_host, headers=tunnel_headers)

try:
h.request(req.get_method(), req.get_selector(), req.data, headers)
Expand Down
Loading