The problem is in `urlunparse`. If you check the RFC 2396, it has the following regular expression:
^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
where group 3 is the //netloc, and 4 is netloc substring, of an url http://netloc/foobar - and this is what Python should use to parse an URI using RFC 2396... but:
>>> pat.fullmatch('////netloc').group(4)
''
>>> pat.fullmatch('/relative').group(4)
>>>
Someone took the shortcut. no netloc is different from netloc being the empty string '', but
>>> urlparse('////netloc')
ParseResult(scheme='', netloc='', path='//netloc', params='', query='', fragment='')
>>> urlparse('/netloc')
ParseResult(scheme='', netloc='', path='/netloc', params='', query='', fragment='')
In the latter parsing result netloc should be *None*. Unfortunately I believe it is too late to change this either way. |