diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2011-01-22 13:44:22 (GMT) |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2011-01-22 13:44:22 (GMT) |
commit | 59531287fdfa27431d0aacfaab3808036153f181 (patch) | |
tree | a1d48ad13f041973d552568abc904c540d79fd53 /Lib/http | |
parent | 8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4 (diff) | |
download | cpython-59531287fdfa27431d0aacfaab3808036153f181.zip cpython-59531287fdfa27431d0aacfaab3808036153f181.tar.gz cpython-59531287fdfa27431d0aacfaab3808036153f181.tar.bz2 |
To match the behaviour of HTTP server, the HTTP client library now also encodes
headers with iso-8859-1 (latin1) encoding. It was already doing that for
incoming headers which makes this behaviour now consistent in both incoming and
outgoing direction.
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/client.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index bb9fa9b..347aa61 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -696,7 +696,7 @@ class HTTPConnection: self.send(connect_bytes) for header, value in self._tunnel_headers.iteritems(): header_str = "%s: %s\r\n" % (header, value) - header_bytes = header_str.encode("ascii") + header_bytes = header_str.encode("latin1") self.send(header_bytes) response = self.response_class(self.sock, method = self._method) @@ -935,7 +935,7 @@ class HTTPConnection: values = list(values) for i, one_value in enumerate(values): if hasattr(one_value, 'encode'): - values[i] = one_value.encode('ascii') + values[i] = one_value.encode('latin1') elif isinstance(one_value, int): values[i] = str(one_value).encode('ascii') value = b'\r\n\t'.join(values) |