Invalid user supplied messages should be escaped HTML entity escaped.

This commit is contained in:
Levi Gross 2014-02-04 10:57:15 -05:00
parent 0226b2cd1f
commit 791ea6ae53

View File

@ -18,11 +18,13 @@ import traceback
import inspect import inspect
import errno import errno
import warnings import warnings
import cgi
from gunicorn.errors import AppImportError from gunicorn.errors import AppImportError
from gunicorn.six import text_type, string_types from gunicorn.six import text_type
from gunicorn.workers import SUPPORTED_WORKERS from gunicorn.workers import SUPPORTED_WORKERS
MAXFD = 1024 MAXFD = 1024
REDIRECT_TO = getattr(os, 'devnull', '/dev/null') REDIRECT_TO = getattr(os, 'devnull', '/dev/null')
@ -332,7 +334,7 @@ def write_error(sock, status_int, reason, mesg):
%(mesg)s %(mesg)s
</body> </body>
</html> </html>
""") % {"reason": reason, "mesg": mesg} """) % {"reason": reason, "mesg": cgi.escape(mesg)}
http = textwrap.dedent("""\ http = textwrap.dedent("""\
HTTP/1.1 %s %s\r HTTP/1.1 %s %s\r