Mercurial > hg-stable
comparison mercurial/hg.py @ 424:9294dce4b633
Allow override of HTTP_PROXY, http_proxy and no_proxy; make no_proxy work.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Allow override of HTTP_PROXY, http_proxy and no_proxy; make no_proxy work.
manifest hash: cfddccef1e8acaa8b06e652e5bbc274d31f0df1d
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFCtIp/W7P1GVgWeRoRAgNRAJ4//Ptbq9Cba7S2L5ltvP92gcijZQCeKuU/
S/togHQXp34v2ypVH+8wyP4=
=jpn2
-----END PGP SIGNATURE-----
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sat, 18 Jun 2005 21:56:31 +0100 |
parents | e9e1efd5291c |
children | 8c90ab5644c9 |
comparison
equal
deleted
inserted
replaced
423:25afb21d97ba | 424:9294dce4b633 |
---|---|
1329 def __init__(self, ui, path): | 1329 def __init__(self, ui, path): |
1330 self.url = path | 1330 self.url = path |
1331 self.ui = ui | 1331 self.ui = ui |
1332 no_list = [ "localhost", "127.0.0.1" ] | 1332 no_list = [ "localhost", "127.0.0.1" ] |
1333 host = ui.config("http_proxy", "host") | 1333 host = ui.config("http_proxy", "host") |
1334 if host is None: | |
1335 host = os.environ.get("http_proxy") | |
1334 user = ui.config("http_proxy", "user") | 1336 user = ui.config("http_proxy", "user") |
1335 passwd = ui.config("http_proxy", "passwd") | 1337 passwd = ui.config("http_proxy", "passwd") |
1336 no = ui.config("http_proxy", "no") | 1338 no = ui.config("http_proxy", "no") |
1339 if no is None: | |
1340 no = os.environ.get("no_proxy") | |
1337 if no: | 1341 if no: |
1338 no_list = no_list + no.split(",") | 1342 no_list = no_list + no.split(",") |
1339 | 1343 |
1340 no_proxy = 0 | 1344 no_proxy = 0 |
1341 for h in no_list: | 1345 for h in no_list: |
1344 path == "http://" + h): | 1348 path == "http://" + h): |
1345 no_proxy = 1 | 1349 no_proxy = 1 |
1346 | 1350 |
1347 # Note: urllib2 takes proxy values from the environment and those will | 1351 # Note: urllib2 takes proxy values from the environment and those will |
1348 # take precedence | 1352 # take precedence |
1353 for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]: | |
1354 if os.environ.has_key(env): | |
1355 del os.environ[env] | |
1349 | 1356 |
1350 proxy_handler = urllib2.BaseHandler() | 1357 proxy_handler = urllib2.BaseHandler() |
1351 if host and not no_proxy: | 1358 if host and not no_proxy: |
1352 proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host}) | 1359 proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host}) |
1353 | 1360 |