]> granicus.if.org Git - python/commitdiff
Merged fix for #10860 from 3.2
authorŁukasz Langa <lukasz@langa.pl>
Wed, 19 Oct 2011 00:04:46 +0000 (02:04 +0200)
committerŁukasz Langa <lukasz@langa.pl>
Wed, 19 Oct 2011 00:04:46 +0000 (02:04 +0200)
1  2 
Lib/http/client.py
Lib/test/test_httplib.py

Simple merge
index 17297430c3b55708e3f38264d3e34c389d831857,8a328a9882ef6cbf3e53e79e607728f9620d49ef..ba97da208b11af6729023a5e0c0f2313ef98ec24
@@@ -537,8 -540,25 +539,26 @@@ class HTTPSTest(TestCase)
          h.request('GET', '/nonexistent')
          resp = h.getresponse()
          self.assertEqual(resp.status, 404)
 +        del server
  
+     def test_host_port(self):
+         # Check invalid host_port
+         for hp in ("www.python.org:abc", "user:password@www.python.org"):
+             self.assertRaises(client.InvalidURL, client.HTTPSConnection, hp)
+         for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000",
+                           "fe80::207:e9ff:fe9b", 8000),
+                          ("www.python.org:443", "www.python.org", 443),
+                          ("www.python.org:", "www.python.org", 443),
+                          ("www.python.org", "www.python.org", 443),
+                          ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 443),
+                          ("[fe80::207:e9ff:fe9b]:", "fe80::207:e9ff:fe9b",
+                              443)):
+             c = client.HTTPSConnection(hp)
+             self.assertEqual(h, c.host)
+             self.assertEqual(p, c.port)
  
  class RequestBodyTest(TestCase):
      """Test cases where a request includes a message body."""