summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/parse.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-11-22 04:48:26 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-11-22 04:48:26 (GMT)
commitc295862ce04c6bf2b1d2ba5b8218f6198c62a241 (patch)
treeceaa20b7dc94b3ecf4ee5bc0446011e6d32ac8a6 /Lib/urllib/parse.py
parent1e600dc01fa294deb05243378e7419df1b6750ba (diff)
downloadcpython-c295862ce04c6bf2b1d2ba5b8218f6198c62a241.zip
cpython-c295862ce04c6bf2b1d2ba5b8218f6198c62a241.tar.gz
cpython-c295862ce04c6bf2b1d2ba5b8218f6198c62a241.tar.bz2
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.
Diffstat (limited to 'Lib/urllib/parse.py')
-rw-r--r--Lib/urllib/parse.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index 2ddd281..78f3084 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -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