summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2011-07-08 13:52:11 -0700
committerShawn O. Pearce <sop@google.com>2011-07-20 07:11:00 -0700
commita101f1c1670c9992c28980a7028dc6c60028af69 (patch)
treeb151941371a98d0d1a6228fb0303ede7e05b0879 /git_config.py
parent49cd59bc867d5fc29abcdbc4aac9bb7b826b6705 (diff)
downloadgit-repo-a101f1c1670c9992c28980a7028dc6c60028af69.tar.gz
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
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/git_config.py b/git_config.py
index 19c19f19..289a5b64 100644
--- a/git_config.py
+++ b/git_config.py
@@ -563,6 +563,12 @@ class Remote(object):
563 self._review_port = info[2] 563 self._review_port = info[2]
564 else: 564 else:
565 try: 565 try:
566 if 'http_proxy' in os.environ:
567 proxy_url = os.environ['http_proxy']
568 proxy_support = urllib2.ProxyHandler({"http" : proxy_url, "https" : proxy_url})
569 opener = urllib2.build_opener(proxy_support)
570 urllib2.install_opener(opener)
571
566 info = urlopen(u).read() 572 info = urlopen(u).read()
567 if info == 'NOT_AVAILABLE': 573 if info == 'NOT_AVAILABLE':
568 raise UploadError('%s: SSH disabled' % self.review) 574 raise UploadError('%s: SSH disabled' % self.review)