mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Fix Issue4493 - urllib2 adds '/' to the path component of url, when it does not
starts with one. This behavior is exhibited by browser and other clients.
This commit is contained in:
parent
1e600dc01f
commit
c295862ce0
4 changed files with 29 additions and 2 deletions
|
@ -699,7 +699,12 @@ def splithost(url):
|
|||
_hostprog = re.compile('^//([^/?]*)(.*)$')
|
||||
|
||||
match = _hostprog.match(url)
|
||||
if match: return match.group(1, 2)
|
||||
if match:
|
||||
host_port = match.group(1)
|
||||
path = match.group(2)
|
||||
if path and not path.startswith('/'):
|
||||
path = '/' + path
|
||||
return host_port, path
|
||||
return None, url
|
||||
|
||||
_userprog = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue