mercurial/hg.py
changeset 429 688d03d6997a
parent 428 183c87d4e1a0
parent 426 8c90ab5644c9
child 434 08f00b6494f4
--- a/mercurial/hg.py	Tue Jun 21 20:40:53 2005 -0800
+++ b/mercurial/hg.py	Tue Jun 21 21:04:49 2005 -0800
@@ -1365,9 +1365,15 @@
         self.ui = ui
         no_list = [ "localhost", "127.0.0.1" ]
         host = ui.config("http_proxy", "host")
+        if host is None:
+            host = os.environ.get("http_proxy")
+        if host and host.startswith('http://'):
+            host = host[7:]
         user = ui.config("http_proxy", "user")
         passwd = ui.config("http_proxy", "passwd")
         no = ui.config("http_proxy", "no")
+        if no is None:
+            no = os.environ.get("no_proxy")
         if no:
             no_list = no_list + no.split(",")
             
@@ -1380,6 +1386,9 @@
 
         # Note: urllib2 takes proxy values from the environment and those will
         # take precedence
+        for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
+            if os.environ.has_key(env):
+                del os.environ[env]
 
         proxy_handler = urllib2.BaseHandler()
         if host and not no_proxy: