From: Chris Dary Date: Tue, 28 Feb 2012 17:08:37 +0000 (-0500) Subject: Decode URL to utf-8 before joining. X-Git-Tag: v0.10.8~6^2^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2645826be0449842dcc812e31541c5254c69e05;p=services%2Fpython-requests.git Decode URL to utf-8 before joining. To avoid UnicodeDecodeError's like on http://blip.fm/~1abvfu --- diff --git a/requests/models.py b/requests/models.py index 8368c9f..aea7723 100644 --- a/requests/models.py +++ b/requests/models.py @@ -227,6 +227,8 @@ class Request(object): # Facilitate non-RFC2616-compliant 'location' headers # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') if not urlparse(url).netloc: + if not isinstance(url, unicode): + url = url.decode('utf-8', 'ignore') url = urljoin(r.url, url) # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4