Skip to content

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

@zakkak

Description

@zakkak

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions