Commit 3853586e authored by Senthil Kumaran's avatar Senthil Kumaran

Fix issue11442 - Add a charset parameter to the Content-type to avoid XSS attacks.

Patch by Tom N. (Backported from py3k codeline).
parent 6e0a8b8a
......@@ -16,6 +16,7 @@ import BaseHTTPServer
import urllib
import urlparse
import cgi
import sys
import shutil
import mimetypes
try:
......@@ -132,7 +133,8 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
length = f.tell()
f.seek(0)
self.send_response(200)
self.send_header("Content-type", "text/html")
encoding = sys.getfilesystemencoding()
self.send_header("Content-type", "text/html; charset=%s" % encoding)
self.send_header("Content-Length", str(length))
self.end_headers()
return f
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment