mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
url: remove unnecessary deletion of environ variables while dealing with proxy
Currently we delete proxy environment variables if ui.config contains proxy values. This is unnecessary because urllib2.ProxyHandler class only reads proxy from environment it is initialised by None. But url.py never passes None, so there is no point urllib2 will take environment variables in account. This also prevents deleting environment variables which is not safe. This code was introduced while resolving Bug 2451 even it is in one of comments (sixth one) on bug that we can safely remove this part. Link to bug : https://bz.mercurial-scm.org/show_bug.cgi?id=2451
This commit is contained in:
parent
57ef32586b
commit
658b1f6e91
@ -15,7 +15,6 @@ import socket
|
||||
|
||||
from .i18n import _
|
||||
from . import (
|
||||
encoding,
|
||||
error,
|
||||
httpconnection as httpconnectionmod,
|
||||
keepalive,
|
||||
@ -113,17 +112,6 @@ class proxyhandler(urlreq.proxyhandler):
|
||||
else:
|
||||
proxies = {}
|
||||
|
||||
# urllib2 takes proxy values from the environment and those
|
||||
# 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 encoding.environ:
|
||||
del encoding.environ[env]
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
urlreq.proxyhandler.__init__(self, proxies)
|
||||
self.ui = ui
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user