Always percent-encode location headers.

This commit is contained in:
Cory Benfield
2013-05-16 11:58:18 +01:00
parent eacb91afb1
commit 2b6ebd2521
+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