mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix Issue754016 - urlparse goes wrong with IP:port without scheme
This commit is contained in:
parent
4aa0d4d2d0
commit
84c7d9f87b
3 changed files with 44 additions and 5 deletions
|
@ -192,11 +192,12 @@ def urlsplit(url, scheme='', allow_fragments=True):
|
|||
v = SplitResult(scheme, netloc, url, query, fragment)
|
||||
_parse_cache[key] = v
|
||||
return v
|
||||
for c in url[:i]:
|
||||
if c not in scheme_chars:
|
||||
break
|
||||
else:
|
||||
scheme, url = url[:i].lower(), url[i+1:]
|
||||
if url.endswith(':') or not url[i+1].isdigit():
|
||||
for c in url[:i]:
|
||||
if c not in scheme_chars:
|
||||
break
|
||||
else:
|
||||
scheme, url = url[:i].lower(), url[i+1:]
|
||||
if url[:2] == '//':
|
||||
netloc, url = _splitnetloc(url, 2)
|
||||
if (('[' in netloc and ']' not in netloc) or
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue