equal
deleted
inserted
replaced
1363 def __init__(self, ui, path): |
1363 def __init__(self, ui, path): |
1364 self.url = path |
1364 self.url = path |
1365 self.ui = ui |
1365 self.ui = ui |
1366 no_list = [ "localhost", "127.0.0.1" ] |
1366 no_list = [ "localhost", "127.0.0.1" ] |
1367 host = ui.config("http_proxy", "host") |
1367 host = ui.config("http_proxy", "host") |
|
1368 if host is None: |
|
1369 host = os.environ.get("http_proxy") |
|
1370 if host and host.startswith('http://'): |
|
1371 host = host[7:] |
1368 user = ui.config("http_proxy", "user") |
1372 user = ui.config("http_proxy", "user") |
1369 passwd = ui.config("http_proxy", "passwd") |
1373 passwd = ui.config("http_proxy", "passwd") |
1370 no = ui.config("http_proxy", "no") |
1374 no = ui.config("http_proxy", "no") |
|
1375 if no is None: |
|
1376 no = os.environ.get("no_proxy") |
1371 if no: |
1377 if no: |
1372 no_list = no_list + no.split(",") |
1378 no_list = no_list + no.split(",") |
1373 |
1379 |
1374 no_proxy = 0 |
1380 no_proxy = 0 |
1375 for h in no_list: |
1381 for h in no_list: |
1378 path == "http://" + h): |
1384 path == "http://" + h): |
1379 no_proxy = 1 |
1385 no_proxy = 1 |
1380 |
1386 |
1381 # Note: urllib2 takes proxy values from the environment and those will |
1387 # Note: urllib2 takes proxy values from the environment and those will |
1382 # take precedence |
1388 # take precedence |
|
1389 for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]: |
|
1390 if os.environ.has_key(env): |
|
1391 del os.environ[env] |
1383 |
1392 |
1384 proxy_handler = urllib2.BaseHandler() |
1393 proxy_handler = urllib2.BaseHandler() |
1385 if host and not no_proxy: |
1394 if host and not no_proxy: |
1386 proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host}) |
1395 proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host}) |
1387 |
1396 |