Skip to content

Commit cd0cb60

Browse files
committed
Escape error messages before printing them.
git-svn-id: svn://cherokee-project.com/CTK/trunk@5234 5dc97367-97f1-0310-9951-d761b3857238
1 parent a1bb403 commit cd0cb60

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

CTK/Server.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
# CTK: Cherokee Toolkit
24
#
35
# Authors:
@@ -35,6 +37,8 @@
3537
from Post import Post
3638
from HTTP import HTTP_Response, HTTP_Error
3739

40+
from cgi import escape as escape_html
41+
3842

3943
class PostValidator:
4044
def __init__ (self, post, validation_list):
@@ -139,9 +143,6 @@ def manage_exception():
139143
print >> sys.stderr, info
140144

141145
# Custom error management
142-
#page = error.page (info, desc)
143-
#response = HTTP_Response (error=500, body=page.Render())
144-
#self.send (str(response))
145146
if error.page:
146147
try:
147148
page = error.page (info, desc)
@@ -153,7 +154,7 @@ def manage_exception():
153154
pass
154155

155156
# No error handling page
156-
html = '<pre>%s</pre>'%(info)
157+
html = '<pre>%s</pre>' %(escape_html(info))
157158
self.send (str(HTTP_Error(desc=html)))
158159

159160
try:

0 commit comments

Comments
 (0)