diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2009-10-11 04:58:55 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2009-10-11 04:58:55 (GMT) |
commit | 7bb0497336a18520bd87da2bd2fba809ae56ee1a (patch) | |
tree | 046f3d765b4dd45ac3d95ef9eb854e60ae8c2472 /Lib/test | |
parent | 7291cf83048e45e4bb2aca776292bad0abe0d4e8 (diff) | |
download | cpython-7bb0497336a18520bd87da2bd2fba809ae56ee1a.zip cpython-7bb0497336a18520bd87da2bd2fba809ae56ee1a.tar.gz cpython-7bb0497336a18520bd87da2bd2fba809ae56ee1a.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/test')
-rw-r--r-- | Lib/test/test_urllib2.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 8093f0e..f1c478c 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -947,6 +947,22 @@ class HandlerTests(unittest.TestCase): self.assertEqual([(handlers[0], "http_open")], [tup[0:2] for tup in o.calls]) + def test_proxy_no_proxy(self): + os.environ['no_proxy'] = 'python.org' + o = OpenerDirector() + ph = urllib.request.ProxyHandler(dict(http="proxy.example.com")) + o.add_handler(ph) + req = Request("http://www.perl.org/") + self.assertEqual(req.get_host(), "www.perl.org") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com") + req = Request("http://www.python.org") + self.assertEqual(req.get_host(), "www.python.org") + r = o.open(req) + self.assertEqual(req.get_host(), "www.python.org") + del os.environ['no_proxy'] + + def test_proxy_https(self): o = OpenerDirector() ph = urllib.request.ProxyHandler(dict(https="proxy.example.com:3128")) |