Skip to content
Myr

Add patch to avoid bytestring/str hodgepodge

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

When patching Host header into URL, verify that host type matches urlparse return type before putting it all back together

authored by Brian Bamsch · committed by Brian Bamsch · parent b28531f · Browse files · 1 file+6 added−0 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+6 added−0 removed

  • other:+6 added−0 removed

1 file+6 added−0 removed

modified:requests/cookies.py+6 added
55 unmodified lines
56 return self._r.url57 # If they did set it, retrieve it and reconstruct the expected domain58 host = self._r.headers['Host']59 parsed = urlparse(self._r.url)6061 # If parsed url is str type, ensure that host is also str type62 if isinstance(parsed.scheme, str) and not isinstance(host, str)\63 and isinstance(host, bytes):64 host = host.decode('ascii')6566 # Reconstruct the URL as we expect it67 return urlunparse([68 parsed.scheme, host, parsed.path, parsed.params, parsed.query,69 parsed.fragment
477 unmodified lines