equal
deleted
inserted
replaced
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 |