Skip to content
Myr

Added support for URLs with path not encoded.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jérémy Bethmont · committed by Jérémy Bethmont · parent f18c40f · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:requests/models.py+3 added-2 removed
183 unmodified lines
184 # Facilitate non-RFC2616-compliant 'location' headers185 # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')186 if not urlparse(url).netloc:187 parent_url_components = urlparse(self.url)188 url = '%s://%s/%s' % (parent_url_components.scheme, parent_url_components.netloc, url)188 url = '%s://%s/%s' % (parent_url_components.scheme, parent_url_components.netloc, urllib.quote(urllib.unquote(url)))189190 # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4191 if r.status_code is 303:192 method = 'GET'
37 unmodified lines
230231 def _build_url(self):232 """Build the actual URL to use"""233234 # Support for unicode domain names.234 # Support for unicode domain names and paths.235 parsed_url = list(urlparse(self.url))236 parsed_url[1] = parsed_url[1].encode('idna')237 parsed_url[2] = urllib.quote(urllib.unquote(parsed_url[2]))238 self.url = urlunparse(parsed_url)239240 if self._enc_params:241 if urlparse(self.url).query:
310 unmodified lines