diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-12-29 12:46:05 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-29 12:46:05 (GMT) |
| commit | df794406a8803e3d6062af8404d7564833f9af28 (patch) | |
| tree | 96fa8c46a12d2deafc452fc93ca280a94c0e24f3 /Lib/urllib/request.py | |
| parent | 1ceb097cecc0bbec1cd872c11c5ed2735b840539 (diff) | |
| download | cpython-df794406a8803e3d6062af8404d7564833f9af28.zip cpython-df794406a8803e3d6062af8404d7564833f9af28.tar.gz cpython-df794406a8803e3d6062af8404d7564833f9af28.tar.bz2 | |
Allow / character in username,password fields in _PROXY envvars. (GH-23973)
(cherry picked from commit 030a713183084594659aefd77b76fe30178e23c8)
Co-authored-by: Senthil Kumaran <senthil@uthcode.com>
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 a8c870b..57d9914 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -771,7 +771,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] |
