resolve_redirects no longer throws an InvalidSchema exception when the scheme is...
authorBob Carroll <bob.carroll@alum.rit.edu>
Mon, 29 Apr 2013 20:35:44 +0000 (13:35 -0700)
committerBob Carroll <bob.carroll@alum.rit.edu>
Sun, 26 May 2013 21:43:00 +0000 (14:43 -0700)
requests/sessions.py

index f4aeeee..776f97a 100644 (file)
@@ -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.