Merged revisions 86676 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86676 | senthil.kumaran | 2010-11-22 12:48:26 +0800 (Mon, 22 Nov 2010) | 4 lines

  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:
Senthil Kumaran 2010-11-22 05:04:33 +00:00
parent 949de7a7c4
commit 0b7cac11bf
3 changed files with 28 additions and 1 deletions

View file

@ -1052,7 +1052,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