[issue35377] urlsplit scheme argument broken
devkral
report at bugs.python.org
Sun Dec 2 10:27:37 EST 2018
New submission from devkral <devkral at web.de>:
the scheme argument of urlsplit/urlparse is completely broken.
here two examples:
urlunsplit(urlsplit("httpbin.org", scheme="https://"))
'https://:httpbin.org'
urlunsplit(urlsplit("httpbin.org", scheme="https"))
'https:///httpbin.org'
Fix: change urlsplit logic like this:
...
url, scheme, _coerce_result = _coerce_args(url, scheme)
scheme = scheme.rstrip("://") # this removes ://
...
i = url.find('://') # harden against arbitrary :
if i > 0:
...
elif scheme:
netloc, url = _splitnetloc(url, 0) # if scheme is specified, netloc is implied
sry too lazy to create a patch from this. Most probably are all python versions affected but I checked only 2.7 and 3.7 .
----------
components: Library (Lib)
messages: 330884
nosy: devkral
priority: normal
severity: normal
status: open
title: urlsplit scheme argument broken
versions: Python 2.7, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35377>
_______________________________________
More information about the Python-bugs-list
mailing list