summaryrefslogtreecommitdiff
path: root/Lib/urlparse.py
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2008-08-14 16:51:00 +0000
committerFacundo Batista <facundobatista@gmail.com>2008-08-14 16:51:00 +0000
commit67d1981c5172e840ac3e2fc3505ce9c3abe5cd63 (patch)
treeef2d24d280373c3739dcb2ceff0edd07c422f266 /Lib/urlparse.py
parent8401eec7fab006b65b82a213f3312b96e0ae29e8 (diff)
downloadcpython-git-67d1981c5172e840ac3e2fc3505ce9c3abe5cd63.tar.gz
Issue 1432. Fixes a bug caused because of the evolution
of the RFC that describes the behaviour. Note that we now have the same behaviour than the current browsers.
Diffstat (limited to 'Lib/urlparse.py')
-rw-r--r--Lib/urlparse.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py
index c384db782b..1914304bfb 100644
--- a/Lib/urlparse.py
+++ b/Lib/urlparse.py
@@ -217,9 +217,18 @@ def urljoin(base, url, allow_fragments=True):
if path[:1] == '/':
return urlunparse((scheme, netloc, path,
params, query, fragment))
- if not (path or params or query):
- return urlunparse((scheme, netloc, bpath,
- bparams, bquery, fragment))
+ if not path:
+ path = bpath
+ if not params:
+ params = bparams
+ else:
+ path = path[:-1]
+ return urlunparse((scheme, netloc, path,
+ params, query, fragment))
+ if not query:
+ query = bquery
+ return urlunparse((scheme, netloc, path,
+ params, query, fragment))
segments = bpath.split('/')[:-1] + path.split('/')
# XXX The stuff below is bogus in various ways...
if segments[-1] == '.':