diff options
author | Guido van Rossum <guido@python.org> | 1999-03-17 22:30:10 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-03-17 22:30:10 (GMT) |
commit | a2e18051b724b5d7433de53fb4c8c94ff93e3008 (patch) | |
tree | 32c94fa19787ca329e94b64c830415b97edd9ca5 /Lib | |
parent | 154d909993807105f1d18b088eb9783aad432d03 (diff) | |
download | cpython-a2e18051b724b5d7433de53fb4c8c94ff93e3008.zip cpython-a2e18051b724b5d7433de53fb4c8c94ff93e3008.tar.gz cpython-a2e18051b724b5d7433de53fb4c8c94ff93e3008.tar.bz2 |
Delete non-standard-conforming code in urljoin() that would use the
netloc from the base url as the default netloc for the resulting url
even if the schemes differ.
Once upon a time, when the web was wild, this was a valuable hack
because some people had a URL referencing an ftp server colocated with
an http server without having the host in the ftp URL (so they could
replicate it or change the hostname easily).
More recently, after the file: scheme got added back to the list of
schemes that accept a netloc, it turns out that this caused weirdness
when joining an http: URL with a file: URL -- the resulting file: URL
would always inherit the host from the http: URL because the file:
scheme supports a netloc but in practice never has one.
There are two reasons to get rid of the old, once-valuable hack,
instead of removing the file: scheme from the uses_netloc list. One,
the RFC says that file: uses the netloc syntax, and does not endorse
the old hack. Two, neither netscape 4.5 nor IE 4.0 support the old
hack.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/urlparse.py | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py index af41a7a..698b726 100644 --- a/Lib/urlparse.py +++ b/Lib/urlparse.py @@ -134,18 +134,6 @@ def urljoin(base, url, allow_fragments = 1): urlparse(base, '', allow_fragments) scheme, netloc, path, params, query, fragment = \ urlparse(url, bscheme, allow_fragments) - # XXX Unofficial hack: default netloc to bnetloc even if - # schemes differ - if scheme != bscheme and not netloc and \ - scheme in uses_relative and bscheme in uses_relative and \ - scheme in uses_netloc and bscheme in uses_netloc: - netloc = bnetloc - # Strip the port number - i = find(netloc, '@') - if i < 0: i = 0 - i = find(netloc, ':', i) - if i >= 0: - netloc = netloc[:i] if scheme != bscheme or scheme not in uses_relative: return urlunparse((scheme, netloc, path, params, query, fragment)) |