diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-05-19 14:15:19 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-05-19 14:15:19 (GMT) |
commit | 6709b7d5d1b8643856a3e0f864c0657a927f427a (patch) | |
tree | 56ca8f96edcb3a3e158e42c7003efdae583f1a11 /Lib/urllib/parse.py | |
parent | 5fa4a896016e8a265b6afee64c61a1083c6ffa47 (diff) | |
download | cpython-6709b7d5d1b8643856a3e0f864c0657a927f427a.zip cpython-6709b7d5d1b8643856a3e0f864c0657a927f427a.tar.gz cpython-6709b7d5d1b8643856a3e0f864c0657a927f427a.tar.bz2 |
#14072: Fix parsing of tel URIs in urlparse by making the check for ports stricter.
Diffstat (limited to 'Lib/urllib/parse.py')
-rw-r--r-- | Lib/urllib/parse.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 47b7962..92170ad 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -338,12 +338,12 @@ def urlsplit(url, scheme='', allow_fragments=True): if c not in scheme_chars: break else: - try: - # make sure "url" is not actually a port number (in which case - # "scheme" is really part of the path - _testportnum = int(url[i+1:]) - except ValueError: - scheme, url = url[:i].lower(), url[i+1:] + # make sure "url" is not actually a port number (in which case + # "scheme" is really part of the path) + rest = url[i+1:] + if not rest or any(c not in '0123456789' for c in rest): + # not a port number + scheme, url = url[:i].lower(), rest if url[:2] == '//': netloc, url = _splitnetloc(url, 2) |