use geturl to lower scheme
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by daftshady · committed by daftshady · parent 8c8938e · Browse files · 2 files·+4 added−8 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+4 added−8 removed
- other:+4 added−8 removed
Provenance
- Commit
4972133- Tree
afe9a43- Author
daftshady <daftonshady@gmail.com>- Committer
daftshady <daftonshady@gmail.com>- Parent
8c8938e
2 files changed+4 added−8 removed
modified:requests/adapters.py+2 added-4 removed
12 unmodified lines13 from .models import Response14 from .packages.urllib3.poolmanager import PoolManager, proxy_from_url15 from .packages.urllib3.response import HTTPResponse16 from .packages.urllib3.util import Timeout as TimeoutSauce17-from .compat import urlparse, basestring, urldefrag, unquote, urlunparse17+from .compat import urlparse, basestring, urldefrag, unquote18 from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,19 except_on_missing_scheme, get_auth_from_url)20 from .structures import CaseInsensitiveDict21 from .packages.urllib3.exceptions import MaxRetryError185 unmodified lines207 conn = self.proxy_manager[proxy].connection_from_url(url)208 else:209 # Only scheme should be lower case210 parsed = urlparse(url)211- parsed = (parsed.scheme, parsed.netloc, parsed.path,212- parsed.params, parsed.query, parsed.fragment)213- url = urlunparse(parsed)211+ url = parsed.geturl()212 conn = self.poolmanager.connection_from_url(url)213 214 return conn215 162 unmodified linesmodified:requests/sessions.py+2 added-4 removed
10 unmodified lines11 import os12 from collections import Mapping13 from datetime import datetime14 15-from .compat import cookielib, OrderedDict, urljoin, urlparse, urlunparse, builtin_str15+from .compat import cookielib, OrderedDict, urljoin, urlparse, builtin_str16 from .cookies import cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar17 from .models import Request, PreparedRequest18 from .hooks import default_hooks, dispatch_hook19 from .utils import to_key_val_list, default_headers73 unmodified lines93 url = '%s:%s' % (parsed_rurl.scheme, url)94 95 # The scheme should be lower case...96 parsed = urlparse(url)97- parsed = (parsed.scheme, parsed.netloc, parsed.path,98- parsed.params, parsed.query, parsed.fragment)99- url = urlunparse(parsed)97+ url = parsed.geturl()98 99 # Facilitate non-RFC2616-compliant 'location' headers100 # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')101 # Compliant with RFC3986, we percent encode the url.431 unmodified lines