Fix parsing system proxy var containing "user:password@" part

This commit is contained in:
Alexey Minnekhanov
2018-08-23 11:15:33 +03:00
parent 44a3cb3b2e
commit dde5ee3701

View File

@@ -248,6 +248,11 @@ class NetworkSettings(object):
proto = "{0}://".format(prefix)
if proxyline[:len(proto)] == proto:
proxyline = proxyline[len(proto):]
# sometimes proxyline contains "user:password@" section before proxy address
# remove it if present, so later split by ":" works
if '@' in proxyline:
userPass, proxyline = proxyline.split("@")
# TODO: do something with user/password?
proxAddr, proxPort = proxyline.split(":")
proxPort = int(proxPort.rstrip("/"))
proxy = (proxAddr, proxPort)