summaryrefslogtreecommitdiffstats
path: root/Lib/urlparse.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-08-04 04:29:32 (GMT)
committerGuido van Rossum <guido@python.org>1995-08-04 04:29:32 (GMT)
commitfb1a0cd74f0cd6ddf7c4b6604e6f4e629669446a (patch)
tree8f1081fe97b2b131ef81ec73761d6f50b6464b68 /Lib/urlparse.py
parentbbb0a05972254671ae00213e62adfb13b91ff45b (diff)
downloadcpython-fb1a0cd74f0cd6ddf7c4b6604e6f4e629669446a.zip
cpython-fb1a0cd74f0cd6ddf7c4b6604e6f4e629669446a.tar.gz
cpython-fb1a0cd74f0cd6ddf7c4b6604e6f4e629669446a.tar.bz2
subtle changes to relative rurl joins
Diffstat (limited to 'Lib/urlparse.py')
-rw-r--r--Lib/urlparse.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py
index 9fce0bd..ef2384b 100644
--- a/Lib/urlparse.py
+++ b/Lib/urlparse.py
@@ -68,6 +68,7 @@ def urlparse(url, scheme = '', allow_framents = 1):
# states that these are equivalent).
def urlunparse((scheme, netloc, url, params, query, fragment)):
if netloc:
+ if url[:1] != '/': url = '/' + url
url = '//' + netloc + url
if scheme:
url = scheme + ':' + url
@@ -118,9 +119,8 @@ def urljoin(base, url, allow_framents = 1):
return urlunparse((scheme, netloc, path,
params, query, fragment))
i = string.rfind(bpath, '/')
- if i < 0:
- i = len(bpath)
- path = bpath[:i] + '/' + path
+ if i >= 0:
+ path = bpath[:i] + '/' + path
segments = string.splitfields(path, '/')
if segments[-1] == '.':
segments[-1] = ''