mercurial/url.py
changeset 15081 d30ec2d16c5a
parent 15027 1e45b92f4fb2
parent 15077 02734d2baa79
child 16683 525fdb738975
--- a/mercurial/url.py	Sat Aug 13 00:08:26 2011 +0200
+++ b/mercurial/url.py	Sat Sep 10 17:56:42 2011 -0500
@@ -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