Fix Issue754016 - urlparse goes wrong with IP:port without scheme

This commit is contained in:
Senthil Kumaran 2010-08-04 04:50:44 +00:00
parent 4aa0d4d2d0
commit 84c7d9f87b
3 changed files with 44 additions and 5 deletions

View file

@ -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