You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9f03afd
Browse filesBrowse the repository at this point in the historyBrowse files
gh-51540: Let proxy auth handlers answer a 407 to CONNECT for https URLs (#161596)
urllib.request could not authenticate with a proxy for an https URL
using ProxyBasicAuthHandler or ProxyDigestAuthHandler: http.client
raised a plain OSError when the proxy answered the CONNECT request
with 407, so the http_error_407 handlers never ran.
* http.client: add ProxyTunnelError, an OSError subclass carrying the
code, reason and headers of the proxy's response. It holds no
socket and can be pickled.
* urllib.request: do_open() passes a 407 to CONNECT on to the error
handlers, so the request is retried with Proxy-Authorization on the
CONNECT. Other CONNECT failures still raise URLError.
* Request.set_proxy() keeps the tunnel when a request is re-opened, so
the retried request still sends the path, not the absolute URL.
* ProxyDigestAuthHandler computes the digest over the CONNECT request
(CONNECT host:port) when tunnelling.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments