diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-05-19 00:12:00 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-05-19 00:12:00 (GMT) |
commit | 1be320ebdd5b1f46f32e32c83f3c1e982e2d27e2 (patch) | |
tree | fb0310f6514c7f5c95601a2c96bff142df426a44 /Lib/urllib | |
parent | 8d886046821f1cd43147c340b04ee0f067157749 (diff) | |
download | cpython-1be320ebdd5b1f46f32e32c83f3c1e982e2d27e2.zip cpython-1be320ebdd5b1f46f32e32c83f3c1e982e2d27e2.tar.gz cpython-1be320ebdd5b1f46f32e32c83f3c1e982e2d27e2.tar.bz2 |
Issue9374 - Generic parsing of query and fragment portion of urls for any scheme
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/parse.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 01067ae..47b7962 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -44,16 +44,9 @@ uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '', 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh'] -non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', - 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips'] uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips', 'mms', '', 'sftp'] -uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms', - 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', ''] -uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', - 'nntp', 'wais', 'https', 'shttp', 'snews', - 'file', 'prospero', ''] # Characters valid in scheme names scheme_chars = ('abcdefghijklmnopqrstuvwxyz' @@ -357,9 +350,9 @@ def urlsplit(url, scheme='', allow_fragments=True): if (('[' in netloc and ']' not in netloc) or (']' in netloc and '[' not in netloc)): raise ValueError("Invalid IPv6 URL") - if allow_fragments and scheme in uses_fragment and '#' in url: + if allow_fragments and '#' in url: url, fragment = url.split('#', 1) - if scheme in uses_query and '?' in url: + if '?' in url: url, query = url.split('?', 1) v = SplitResult(scheme, netloc, url, query, fragment) _parse_cache[key] = v |