devkral added the comment:
ah, I get the idea behind urlunsplit. But still:
for e.g. http, http:/// is invalid. These urls are invalid for e.g. requests.
May I ask:
urllib.parse is for web protocol urls? If yes, then there should be an option
which defaults to my version
devkral added the comment:
Ok, then the problem is in unsplit.
Because: :/// is not a valid url.
Next try: in urlunsplit:
if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
if url and url[:1] != '/' and scheme in ("file", "&quo
devkral added the comment:
first a correction; there is one protocol where it make sense:
file
I would change:
...
elif scheme:
...
to
...
elif scheme and scheme != "file":
...
Second: no it is not a correct behaviour. Urlunsplit is supposed to create a
valid url from a tuple
New submission from devkral :
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"))