diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2021-05-03 19:08:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 19:08:59 (GMT) |
commit | 8a595744e696a0fb92dccc5d4e45da41571270a1 (patch) | |
tree | e1593a8b1cdc8d60936c7431fe74add4764b7e5c /Lib/urllib | |
parent | bf124244f0595fb3b4f969a31644b7d110de41ef (diff) | |
download | cpython-8a595744e696a0fb92dccc5d4e45da41571270a1.zip cpython-8a595744e696a0fb92dccc5d4e45da41571270a1.tar.gz cpython-8a595744e696a0fb92dccc5d4e45da41571270a1.tar.bz2 |
[3.9] bpo-43882 Remove the newline, and tab early. From query and fragments. (#25853)
* Remove the newline, and tab early. From query and fragments.
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/parse.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index c11c695..b7965fe 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -456,6 +456,11 @@ def urlsplit(url, scheme='', allow_fragments=True): """ url, scheme, _coerce_result = _coerce_args(url, scheme) + + for b in _UNSAFE_URL_BYTES_TO_REMOVE: + url = url.replace(b, "") + scheme = scheme.replace(b, "") + allow_fragments = bool(allow_fragments) key = url, scheme, allow_fragments, type(url), type(scheme) cached = _parse_cache.get(key, None) @@ -472,9 +477,6 @@ def urlsplit(url, scheme='', allow_fragments=True): else: scheme, url = url[:i].lower(), url[i+1:] - for b in _UNSAFE_URL_BYTES_TO_REMOVE: - url = url.replace(b, "") - if url[:2] == '//': netloc, url = _splitnetloc(url, 2) if (('[' in netloc and ']' not in netloc) or |