From: Cory Benfield Date: Thu, 16 May 2013 10:58:18 +0000 (+0100) Subject: Always percent-encode location headers. X-Git-Tag: v1.2.2~4^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b6ebd25215b528c2cad3749973084276d9d74a8;p=services%2Fpython-requests.git Always percent-encode location headers. --- diff --git a/requests/sessions.py b/requests/sessions.py index 77df0e8..a881924 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -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