Skip to content
Myr

Merge pull request #1637 from Lukasa/redir

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

Correctly lowercase a redirect scheme.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 3246fc0, 0051837 · Browse files · 1 file+5 added−4 removed
This commit

State

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

Diff stats

1 file+5 added−4 removed

  • other:+5 added−4 removed

1 file+5 added−4 removed

modified:requests/sessions.py+5 added-4 removed
10 unmodified lines
11import os12from collections import Mapping13from datetime import datetime1415from .compat import cookielib, OrderedDict, urljoin, urlparse15from .compat import cookielib, OrderedDict, urljoin, urlparse, urlunparse16from .cookies import cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar17from .models import Request, PreparedRequest18from .hooks import default_hooks, dispatch_hook19from .utils import to_key_val_list, default_headers
72 unmodified lines
92 parsed_rurl = urlparse(resp.url)93 url = '%s:%s' % (parsed_rurl.scheme, url)9495 # The scheme should be lower case...96 if '://' in url:97 scheme, uri = url.split('://', 1)98 url = '%s://%s' % (scheme.lower(), uri)96 parsed = urlparse(url)97 parsed = (parsed.scheme.lower(), parsed.netloc, parsed.path,98 parsed.params, parsed.query, parsed.fragment)99 url = urlunparse(parsed)100101 # Facilitate non-RFC2616-compliant 'location' headers102 # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')103 # Compliant with RFC3986, we percent encode the url.
425 unmodified lines