summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2009-05-24 09:14:50 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2009-05-24 09:14:50 (GMT)
commite266f25cf1f9ad28409f4c11c40595fb25f555da (patch)
treef6a44ac991861418765056f676d17bcf2520d7a1 /Lib/test/test_urllib2.py
parent655d835415800085cddbacecfc8a22111d70a5ef (diff)
downloadcpython-e266f25cf1f9ad28409f4c11c40595fb25f555da.zip
cpython-e266f25cf1f9ad28409f4c11c40595fb25f555da.tar.gz
cpython-e266f25cf1f9ad28409f4c11c40595fb25f555da.tar.bz2
Fixed Issue1424152, urllib2 fails with HTTPS over Proxy.
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r--Lib/test/test_urllib2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index ff164c2..9edd7c2 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -939,6 +939,21 @@ 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 = urllib2.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()