Skip to content
Myr

fix #2247

Before adoption: this commit came in with the history the project adopted, so no landing records it.

We have to pass urllib3 the url without the authentication information, else it will be parsed by httplib as a netloc and included in the request line and Host header

authored by Thomas Weißschuh · committed by Thomas Weißschuh · parent de76fbe · Browse files · 2 files+17 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+17 added−2 removed

  • other:+17 added−2 removed

2 files+17 added−2 removed

modified:requests/adapters.py+2 added-2 removed
15 unmodified lines
16from .packages.urllib3.response import HTTPResponse17from .packages.urllib3.util import Timeout as TimeoutSauce18from .compat import urlparse, basestring, urldefrag19from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,20 prepend_scheme_if_needed, get_auth_from_url)20 prepend_scheme_if_needed, get_auth_from_url, urldefragauth)21from .structures import CaseInsensitiveDict22from .packages.urllib3.exceptions import ConnectTimeoutError23from .packages.urllib3.exceptions import HTTPError as _HTTPError24from .packages.urllib3.exceptions import MaxRetryError
244 unmodified lines
269 scheme = urlparse(request.url).scheme270 proxy = proxies.get(scheme)271272 if proxy and scheme != 'https':273 url, _ = urldefrag(request.url)273 url = urldefragauth(request.url)274 else:275 url = request.path_url276277 return url
149 unmodified lines
modified:requests/utils.py+15 added
670 unmodified lines
671 else:672 out = string.decode(encoding)673674 return out675676677def urldefragauth(url):678 """679 Given a url remove the fragment and the authentication part680 """681 scheme, netloc, path, params, query, fragment = urlparse(url)682683 # see func:`prepend_scheme_if_needed`684 if not netloc:685 netloc, path = path, netloc686687 netloc = netloc.rsplit('@', 1)[-1]688689 return urlunparse((scheme, netloc, path, params, query, ''))