commit | 37484dc324b442d1fdab10f05f657cef80845279 | [log] [tgz] |
---|---|---|
author | Senthil Kumaran <senthil@uthcode.com> | Thu May 24 21:54:34 2012 +0800 |
committer | Senthil Kumaran <senthil@uthcode.com> | Thu May 24 21:54:34 2012 +0800 |
tree | 97a52c7235afcb348b7d9d614402a187fe108c18 | |
parent | cd8799f077d236a06a86a9cf707de2a246fb800d [diff] [blame] |
Issue #14036: return None when port in urlparse cross 65535
diff --git a/Lib/urlparse.py b/Lib/urlparse.py index 4c57725..8a20756 100644 --- a/Lib/urlparse.py +++ b/Lib/urlparse.py
@@ -97,9 +97,11 @@ 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