summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2021-05-05 22:50:05 (GMT)
committerGitHub <noreply@github.com>2021-05-05 22:50:05 (GMT)
commit985ac016373403e8ad41f8d563c4355ffa8d49ff (patch)
treec461373b90899ad9fe5e93b72f53ee8d84303f1f /Lib/urllib
parent47895e31b6f626bc6ce47d175fe9d43c1098909d (diff)
downloadcpython-985ac016373403e8ad41f8d563c4355ffa8d49ff.zip
cpython-985ac016373403e8ad41f8d563c4355ffa8d49ff.tar.gz
cpython-985ac016373403e8ad41f8d563c4355ffa8d49ff.tar.bz2
bpo-43882 Remove the newline, and tab early. From query and fragments. (GH-25921)
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/parse.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index 4249163..b35997b 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