Merge pull request #1361 from Lukasa/1360

Always percent-encode location headers.
This commit is contained in:
Kenneth Reitz
2013-05-20 13:04:08 -07:00
+3 -1
View File
@@ -111,9 +111,11 @@ class SessionRedirectMixin(object):
# 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.
if not urlparse(url).netloc:
# Compliant with RFC3986, we percent encode the url.
url = urljoin(resp.url, requote_uri(url))
else:
url = requote_uri(url)
prepared_request.url = url