mercurial/url.py
branchstable
changeset 15077 02734d2baa79
parent 15025 0593e8f81c71
child 15081 d30ec2d16c5a
--- a/mercurial/url.py	Sat Sep 10 13:23:41 2011 +0100
+++ b/mercurial/url.py	Thu Sep 08 20:40:24 2011 -0300
@@ -93,13 +93,15 @@
             proxies = {}
 
         # urllib2 takes proxy values from the environment and those
-        # will take precedence if found, so drop them
-        for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
-            try:
-                if env in os.environ:
-                    del os.environ[env]
-            except OSError:
-                pass
+        # will take precedence if found. So, if there's a config entry
+        # defining a proxy, drop the environment ones
+        if ui.config("http_proxy", "host"):
+            for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
+                try:
+                    if env in os.environ:
+                        del os.environ[env]
+                except OSError:
+                    pass
 
         urllib2.ProxyHandler.__init__(self, proxies)
         self.ui = ui