mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-13 09:16:14 +01:00
Merge pull request #1366 from dmach/connection-proxy-no-auth
Fix crash when HTTP_PROXY env contains no auth
This commit is contained in:
commit
b8f6f070a0
@ -107,10 +107,11 @@ def get_proxy_manager(env):
|
||||
user_agent=f"osc/{__version__}",
|
||||
)
|
||||
|
||||
proxy_basic_auth = urllib.parse.unquote(proxy_purl.auth)
|
||||
proxy_basic_auth = proxy_basic_auth.encode("utf-8")
|
||||
proxy_basic_auth = base64.b64encode(proxy_basic_auth).decode()
|
||||
proxy_headers["Proxy-Authorization"] = f"Basic {proxy_basic_auth:s}"
|
||||
if proxy_purl.auth:
|
||||
proxy_basic_auth = urllib.parse.unquote(proxy_purl.auth)
|
||||
proxy_basic_auth = proxy_basic_auth.encode("utf-8")
|
||||
proxy_basic_auth = base64.b64encode(proxy_basic_auth).decode()
|
||||
proxy_headers["Proxy-Authorization"] = f"Basic {proxy_basic_auth:s}"
|
||||
|
||||
manager = urllib3.ProxyManager(proxy_url, proxy_headers=proxy_headers)
|
||||
return manager
|
||||
|
Loading…
Reference in New Issue
Block a user