diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-05-05 23:04:38 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-05 23:04:38 (GMT) |
| commit | 24f1d1a8a2c4aa58a606b4b6d5fa4305a3b91705 (patch) | |
| tree | 1029cef73df5ba4c151754cf9f7ef9135d142d2a /Lib/urllib/parse.py | |
| parent | 3b2a45ff95a68acc8276b37678c98740a232f6d4 (diff) | |
| download | cpython-24f1d1a8a2c4aa58a606b4b6d5fa4305a3b91705.zip cpython-24f1d1a8a2c4aa58a606b4b6d5fa4305a3b91705.tar.gz cpython-24f1d1a8a2c4aa58a606b4b6d5fa4305a3b91705.tar.bz2 | |
bpo-43882 Remove the newline, and tab early. From query and fragments. (GH-25936)
(cherry picked from commit 985ac016373403e8ad41f8d563c4355ffa8d49ff)
Diffstat (limited to 'Lib/urllib/parse.py')
| -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 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 |
