mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #10980: encode headers with latin1 instead of ASCII in the HTTP server.
This makes the implementation of PEP 3333 compliant servers on top of BaseHTTPServer possible.
This commit is contained in:
parent
137e0f0a22
commit
8d96d77f9a
3 changed files with 16 additions and 2 deletions
|
@ -448,7 +448,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
|
|||
message = ''
|
||||
if self.request_version != 'HTTP/0.9':
|
||||
self.wfile.write(("%s %d %s\r\n" %
|
||||
(self.protocol_version, code, message)).encode('ASCII', 'strict'))
|
||||
(self.protocol_version, code, message)).encode('latin1', 'strict'))
|
||||
|
||||
def send_header(self, keyword, value):
|
||||
"""Send a MIME header."""
|
||||
|
@ -456,7 +456,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
|
|||
if not hasattr(self, '_headers_buffer'):
|
||||
self._headers_buffer = []
|
||||
self._headers_buffer.append(
|
||||
("%s: %s\r\n" % (keyword, value)).encode('ASCII', 'strict'))
|
||||
("%s: %s\r\n" % (keyword, value)).encode('latin1', 'strict'))
|
||||
|
||||
if keyword.lower() == 'connection':
|
||||
if value.lower() == 'close':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue