mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-43882 Remove the newline, and tab early. From query and fragments. (GH-25921)
This commit is contained in:
parent
47895e31b6
commit
985ac01637
2 changed files with 21 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue