From: Matt Giuca Date: Wed, 15 Feb 2012 01:00:47 +0000 (+1100) Subject: Now requotes the entire URL, not just the path (Issue #429). X-Git-Tag: v0.10.2~20^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bd5406c0628b4e917d5dc47eb0fbf0697e8ea3d;p=services%2Fpython-requests.git Now requotes the entire URL, not just the path (Issue #429). --- diff --git a/requests/models.py b/requests/models.py index dcc51b0..6b8743b 100644 --- a/requests/models.py +++ b/requests/models.py @@ -321,20 +321,30 @@ class Request(object): path = '/' if is_py2: + if isinstance(scheme, str): + scheme = scheme.encode('utf-8') + if isinstance(netloc, str): + netloc = netloc.encode('utf-8') if isinstance(path, str): path = path.encode('utf-8') - - path = requote_path(path) + if isinstance(params, str): + params = params.encode('utf-8') + if isinstance(query, str): + query = query.encode('utf-8') + if isinstance(fragment, str): + fragment = fragment.encode('utf-8') url = (urlunparse([ scheme, netloc, path, params, query, fragment ])) if self._enc_params: if urlparse(url).query: - return '%s&%s' % (url, self._enc_params) + url = '%s&%s' % (url, self._enc_params) else: - return '%s?%s' % (url, self._enc_params) - else: - return url + url = '%s?%s' % (url, self._enc_params) + + url = requote_path(url) + + return url @property def path_url(self):