summaryrefslogtreecommitdiffstats
path: root/Lib/http/server.py
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2011-02-25 15:42:01 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2011-02-25 15:42:01 (GMT)
commit8f36af7a4c9409a673412e4bdfbad76d700abc3a (patch)
tree1b61599a07604a96539e98098b055c577cd7e6a8 /Lib/http/server.py
parenta391b11320f729f6eec6c772c00b3e62c2746eaf (diff)
downloadcpython-8f36af7a4c9409a673412e4bdfbad76d700abc3a.zip
cpython-8f36af7a4c9409a673412e4bdfbad76d700abc3a.tar.gz
cpython-8f36af7a4c9409a673412e4bdfbad76d700abc3a.tar.bz2
Normalize the encoding names for Latin-1 and UTF-8 to
'latin-1' and 'utf-8'. These are optimized in the Python Unicode implementation to result in more direct processing, bypassing the codec registry. Also see issue11303.
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 543abe0..a35fd9d 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('latin1', 'strict'))
+ (self.protocol_version, code, message)).encode('latin-1', '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('latin1', 'strict'))
+ ("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
if keyword.lower() == 'connection':
if value.lower() == 'close':