diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2020-12-29 12:18:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 12:18:42 (GMT) |
commit | 030a713183084594659aefd77b76fe30178e23c8 (patch) | |
tree | f1cbb34ad0b1c8ff42e08252205090865293a4ba /Lib/urllib/request.py | |
parent | c1af128f5a5893839536453dcc8b2ed7b95b3c3a (diff) | |
download | cpython-030a713183084594659aefd77b76fe30178e23c8.zip cpython-030a713183084594659aefd77b76fe30178e23c8.tar.gz cpython-030a713183084594659aefd77b76fe30178e23c8.tar.bz2 |
Allow / character in username,password fields in _PROXY envvars. (#23973)
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r-- | Lib/urllib/request.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 39974d9..e5febe6 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -773,7 +773,11 @@ def _parse_proxy(proxy): raise ValueError("proxy URL with no authority: %r" % proxy) # We have an authority, so for RFC 3986-compliant URLs (by ss 3. # and 3.3.), path is empty or starts with '/' - end = r_scheme.find("/", 2) + if '@' in r_scheme: + host_separator = r_scheme.find('@') + end = r_scheme.find("/", host_separator) + else: + end = r_scheme.find("/", 2) if end == -1: end = None authority = r_scheme[2:end] |