summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2009-10-11 05:35:44 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2009-10-11 05:35:44 (GMT)
commitdff2028a1b8d680cc489bb3ffb8a5b120e772c8a (patch)
tree278ee6ecc3b25c22122a05cc1d4b2d69f95d3072 /Lib/urllib2.py
parent1ab4095e763ab1924b0ab9fbe22bbe29514c1492 (diff)
downloadcpython-dff2028a1b8d680cc489bb3ffb8a5b120e772c8a.zip
cpython-dff2028a1b8d680cc489bb3ffb8a5b120e772c8a.tar.gz
cpython-dff2028a1b8d680cc489bb3ffb8a5b120e772c8a.tar.bz2
Merged revisions 75333 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75333 | senthil.kumaran | 2009-10-11 07:30:07 +0530 (Sun, 11 Oct 2009) | 3 lines Fixed Issue6894, urllib2 doesn't respect "no_proxy" environment ........
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index cf7e1fa..4763f15 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -111,7 +111,7 @@ from urllib import (unwrap, unquote, splittype, splithost, quote,
splitattr, ftpwrapper, splituser, splitpasswd, splitvalue)
# support for FileHandler, proxies via environment variables
-from urllib import localhost, url2pathname, getproxies
+from urllib import localhost, url2pathname, getproxies, proxy_bypass
# used in User-Agent header sent
__version__ = sys.version[:3]
@@ -698,14 +698,20 @@ class ProxyHandler(BaseHandler):
def proxy_open(self, req, proxy, type):
orig_type = req.get_type()
proxy_type, user, password, hostport = _parse_proxy(proxy)
+
if proxy_type is None:
proxy_type = orig_type
+
+ if req.host and proxy_bypass(req.host):
+ return None
+
if user and password:
user_pass = '%s:%s' % (unquote(user), unquote(password))
creds = base64.b64encode(user_pass).strip()
req.add_header('Proxy-authorization', 'Basic ' + creds)
hostport = unquote(hostport)
req.set_proxy(hostport, proxy_type)
+
if orig_type == proxy_type or orig_type == 'https':
# let other handlers take care of it
return None