url was already parsed, don't urlparse twice
authorMatt Robenolt <matt@ydekproductions.com>
Mon, 24 Nov 2014 01:54:44 +0000 (17:54 -0800)
committerMatt Robenolt <matt@ydekproductions.com>
Mon, 24 Nov 2014 01:54:44 +0000 (17:54 -0800)
requests/sessions.py

index c2f42b1403c99a8bee47be4e8565d62f9fc249b5..4eb374fdb63bc5ea4d2c4d513310dcf582d51f9f 100644 (file)
@@ -129,7 +129,7 @@ class SessionRedirectMixin(object):
             # Facilitate relative 'location' headers, as allowed by RFC 7231.
             # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')
             # Compliant with RFC3986, we percent encode the url.
-            if not urlparse(url).netloc:
+            if not parsed.netloc:
                 url = urljoin(resp.url, requote_uri(url))
             else:
                 url = requote_uri(url)