summaryrefslogtreecommitdiffstats
path: root/Lib/http/server.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2011-01-22 13:13:05 (GMT)
committerArmin Ronacher <armin.ronacher@active-4.com>2011-01-22 13:13:05 (GMT)
commit8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4 (patch)
tree85053ad58fdc9fd916611a6d3b9cc4942feeeb23 /Lib/http/server.py
parent137e0f0a2218479232405a4e826074148f735666 (diff)
downloadcpython-8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4.zip
cpython-8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4.tar.gz
cpython-8d96d77f9a386c3cadfd9c9f128b99a94aaddfb4.tar.bz2
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.
Diffstat (limited to 'Lib/http/server.py')
-rw-r--r--Lib/http/server.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 515572f..543abe0 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -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':