self.assertEqual(p.port, 80)
self.assertEqual(p.geturl(), url)
+ # Verify an illegal port of value greater than 65535 is set as None
+ url = "http://www.python.org:65536"
+ p = urlparse.urlsplit(url)
+ self.assertEqual(p.port, None)
+
def test_issue14072(self):
p1 = urlparse.urlsplit('tel:+31-641044153')
self.assertEqual(p1.scheme, 'tel')
netloc = self.netloc.split('@')[-1].split(']')[-1]
if ':' in netloc:
port = netloc.split(':')[1]
- return int(port, 10)
- else:
- return None
+ port = int(port, 10)
+ # verify legal port
+ if (0 <= port <= 65535):
+ return port
+ return None
from collections import namedtuple
Library
-------
+- Issue #14036: Add an additional check to validate that port in urlparse does
+ not go in illegal range and returns None.
+
- Issue #14888: Fix misbehaviour of the _md5 module when called on data
larger than 2**32 bytes.