python: escape more variable when formatting error_message_format

This commit is contained in:
Tatsuhiro Tsujikawa 2012-08-24 23:25:02 +09:00
parent 9d66fc4b88
commit 595806a913
1 changed files with 6 additions and 2 deletions

View File

@ -1143,6 +1143,7 @@ try:
error_content_type = 'text/html; charset=UTF-8' error_content_type = 'text/html; charset=UTF-8'
# Same HTML from Apache error page
error_message_format = '''\ error_message_format = '''\
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head> <html><head>
@ -1167,8 +1168,11 @@ try:
explain = longmsg explain = longmsg
content = self.error_message_format.format(\ content = self.error_message_format.format(\
code=code, reason = escape(message), explain=explain, code=code,
server=self.server_version, hostname=socket.getfqdn(), reason = escape(message),
explain=escape(explain),
server=escape(self.server_version),
hostname=escape(socket.getfqdn()),
port=self.server.server_address[1]).encode('UTF-8') port=self.server.server_address[1]).encode('UTF-8')
self.send_response(code, message) self.send_response(code, message)