From ee7960b4fdac6b6a3636faf028fd25c969c39ca7 Mon Sep 17 00:00:00 2001 From: Eddie Linder Date: Tue, 27 Oct 2026 09:00:40 +0200 Subject: [PATCH] Use credentials from the proxy URL for HTTP(S) proxies Since 8f75402c3c (#5875), _setHTTPHandlers() parses username:password from the proxy URL but only passes them to SOCKS. For HTTP(S) proxies the proxy string is rebuilt from --proxy-cred alone, so credentials given in --proxy or in the HTTP_PROXY environment variable are dropped and the proxy answers 407. --- lib/core/option.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/core/option.py b/lib/core/option.py index 0af99b6fef8..7dc79e8f0d1 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1375,6 +1375,8 @@ def _setHTTPHandlers(): if conf.proxyCred: # Reference: http://stackoverflow.com/questions/34079/how-to-specify-an-authenticated-proxy-for-a-python-http-connection proxyString = "%s@" % conf.proxyCred + elif username is not None: + proxyString = "%s:%s@" % (username, password) else: proxyString = ""