From: Bob Carroll Date: Mon, 29 Apr 2013 20:35:44 +0000 (-0700) Subject: resolve_redirects no longer throws an InvalidSchema exception when the scheme is... X-Git-Tag: 2.0~19^2~11^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e715d7184b98f6c2a8c4810e7524e2e9a5a033c3;p=services%2Fpython-requests.git resolve_redirects no longer throws an InvalidSchema exception when the scheme is uppercase --- diff --git a/requests/sessions.py b/requests/sessions.py index f4aeeee..776f97a 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -97,6 +97,10 @@ class SessionRedirectMixin(object): parsed_rurl = urlparse(resp.url) url = '%s:%s' % (parsed_rurl.scheme, url) + # The scheme should be lower case... + scheme, uri = url.split('://') + url = '%s://%s' % (scheme.lower(), uri) + # Facilitate non-RFC2616-compliant 'location' headers # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') # Compliant with RFC3986, we percent encode the url.