summaryrefslogtreecommitdiffstats
path: root/Lib/http/server.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-10-11 06:16:29 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-10-11 06:16:29 (GMT)
commit81523a6b09fc03ce330215dad59b8ce2b073bb76 (patch)
tree68eb901fe0c52b107a860935ac3389902bd387c3 /Lib/http/server.py
parentc8b8b7f6611e98e1420113d60db4864ce1b3c11e (diff)
parent52d27204990775bddd2868b093f33d2fda842fac (diff)
downloadcpython-81523a6b09fc03ce330215dad59b8ce2b073bb76.zip
cpython-81523a6b09fc03ce330215dad59b8ce2b073bb76.tar.gz
cpython-81523a6b09fc03ce330215dad59b8ce2b073bb76.tar.bz2
Automated merge with ssh://hg.python.org/cpython
Diffstat (limited to 'Lib/http/server.py')
-rw-r--r--Lib/http/server.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py
index c4ac703..7167142 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -425,12 +425,14 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
# using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
content = (self.error_message_format %
{'code': code, 'message': _quote_html(message), 'explain': explain})
+ body = content.encode('UTF-8', 'replace')
self.send_response(code, message)
self.send_header("Content-Type", self.error_content_type)
self.send_header('Connection', 'close')
+ self.send_header('Content-Length', int(len(body)))
self.end_headers()
if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
- self.wfile.write(content.encode('UTF-8', 'replace'))
+ self.wfile.write(body)
def send_response(self, code, message=None):
"""Add the response header to the headers buffer and log the