diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2009-07-25 04:24:38 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2009-07-25 04:24:38 (GMT) |
commit | 97f0c6be463bd83764e0e5d76e79f1831ef29df0 (patch) | |
tree | 37c1df16f5de614b3d7bc86bfe471f7253f76577 /Lib/test/test_urllib2.py | |
parent | be0e177ae52f84e2787f511693d4889d7fc9d5d7 (diff) | |
download | cpython-97f0c6be463bd83764e0e5d76e79f1831ef29df0.zip cpython-97f0c6be463bd83764e0e5d76e79f1831ef29df0.tar.gz cpython-97f0c6be463bd83764e0e5d76e79f1831ef29df0.tar.bz2 |
Fixed Issue1424152 in Py3k: urllib2 fails with HTTPS over Proxy.
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r-- | Lib/test/test_urllib2.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 7efa1d8..8093f0e 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -947,6 +947,23 @@ class HandlerTests(unittest.TestCase): self.assertEqual([(handlers[0], "http_open")], [tup[0:2] for tup in o.calls]) + def test_proxy_https(self): + o = OpenerDirector() + ph = urllib.request.ProxyHandler(dict(https="proxy.example.com:3128")) + o.add_handler(ph) + meth_spec = [ + [("https_open", "return response")] + ] + handlers = add_ordered_mock_handlers(o, meth_spec) + + req = Request("https://www.example.com/") + self.assertEqual(req.get_host(), "www.example.com") + r = o.open(req) + self.assertEqual(req.get_host(), "proxy.example.com:3128") + self.assertEqual([(handlers[0], "https_open")], + [tup[0:2] for tup in o.calls]) + + def test_basic_auth(self, quote_char='"'): opener = OpenerDirector() password_manager = MockPasswordManager() |