Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mx doesn't support http_proxys requiring authorization (aka following the format http://user:password@host:port) #251

Open
zakkak opened this issue Jan 12, 2022 · 0 comments

Comments

@zakkak
Copy link
Contributor

zakkak commented Jan 12, 2022

mx appears to only support unauthorized http_proxys following the format http://host:port while it should also support http://user:password@host:port and set http.proxyUser and http.proxyPassword accordingly.

The code at fault is:

mx/mx.py

Lines 12966 to 12981 in 29c0deb

def _parse_http_proxy(envVarNames):
"""
Parses the value of the first existing environment variable named
in `envVarNames` into a host and port tuple where port is None if
it's not present in the environment variable.
"""
p = re.compile(r'(?:https?://)?([^:]+):?(\d+)?/?$')
for name in envVarNames:
value = get_env(name)
if value:
m = p.match(value)
if m:
return m.group(1), m.group(2)
else:
abort("Value of " + name + " is not valid: " + value)
return (None, None)

and

mx/mx.py

Lines 13007 to 13012 in 29c0deb

host, port = _parse_http_proxy(["HTTP_PROXY", "http_proxy"])
add_proxy_property('proxyHost', host)
add_proxy_property('proxyPort', port)
host, port = _parse_http_proxy(["HTTPS_PROXY", "https_proxy"])
add_proxy_property('https.proxyHost', host)
add_proxy_property('https.proxyPort', port)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant