Skip to content
Myr

Handle redirection without scheme.

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

authored by Jérémy Bethmont · committed by Jérémy Bethmont · parent a17110b · Browse files · 1 file+5 added−0 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−0 removed

  • other:+5 added−0 removed

1 file+5 added−0 removed

modified:requests/models.py+5 added
223 unmodified lines
224 history.append(r)225226 url = r.headers['location']227228 # Handle redirection without scheme (see: RFC 1808 Section 4)229 if url.startswith('//'):230 parsed_rurl = urlparse(r.url)231 url = '%s:%s' % (parsed_rurl.scheme, url)232233 # Facilitate non-RFC2616-compliant 'location' headers234 # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')235 if not urlparse(url).netloc:236 url = urljoin(r.url, urllib.quote(urllib.unquote(url)))
394 unmodified lines