mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Honor 'http_proxy' environment variable
'repo upload' makes http request using urllib2 python library. Unfortunately this library does not work (by default) in case if the user behind a proxy. This change adds proxy handler in case if 'http_proxy' environment variable is set. Change-Id: Ic4176ad733fc21bd5b59661b3eacc2f0a7c3c1ff
This commit is contained in:
parent
49cd59bc86
commit
a101f1c167
@ -563,6 +563,12 @@ class Remote(object):
|
||||
self._review_port = info[2]
|
||||
else:
|
||||
try:
|
||||
if 'http_proxy' in os.environ:
|
||||
proxy_url = os.environ['http_proxy']
|
||||
proxy_support = urllib2.ProxyHandler({"http" : proxy_url, "https" : proxy_url})
|
||||
opener = urllib2.build_opener(proxy_support)
|
||||
urllib2.install_opener(opener)
|
||||
|
||||
info = urlopen(u).read()
|
||||
if info == 'NOT_AVAILABLE':
|
||||
raise UploadError('%s: SSH disabled' % self.review)
|
||||
|
Loading…
Reference in New Issue
Block a user