Issue #14036: return None when port in urlparse cross 65535

This commit is contained in:
Senthil Kumaran 2012-05-24 21:56:17 +08:00
parent 346c5de08e
commit 2fc5a50809
3 changed files with 11 additions and 0 deletions

View file

@ -524,6 +524,11 @@ class UrlParseTestCase(unittest.TestCase):
self.assertEqual(p.port, 80)
self.assertEqual(p.geturl(), url)
# Verify an illegal port is returned as None
url = b"HTTP://WWW.PYTHON.ORG:65536/doc/#frag"
p = urllib.parse.urlsplit(url)
self.assertEqual(p.port, None)
def test_attributes_bad_port(self):
"""Check handling of non-integer ports."""
p = urllib.parse.urlsplit("http://www.example.net:foo")