Commit 151802d7 authored by Matti Picus's avatar Matti Picus
Browse files

fix urllib.parse sanitization

--HG--
branch : py3.7
parent 1a9b2aecfde0
......@@ -427,6 +427,10 @@ def urlsplit(url, scheme='', allow_fragments=True):
if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth
clear_cache()
netloc = query = fragment = ''
for b in _UNSAFE_URL_BYTES_TO_REMOVE:
url = url.replace(b, "")
i = url.find(':')
if i > 0:
if url[:i] == 'http': # optimize the common case
......@@ -455,9 +459,6 @@ def urlsplit(url, scheme='', allow_fragments=True):
# not a port number
scheme, url = url[:i].lower(), rest
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment