From: MinRK Date: Mon, 23 Dec 2013 00:34:06 +0000 (-0800) Subject: rase 400, not 500 on invalid unicode in decode_argument X-Git-Tag: v3.2.0b1~20^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12d1ed56dfbb3811cace62003fb7a9132ee4e451;p=thirdparty%2Ftornado.git rase 400, not 500 on invalid unicode in decode_argument --- diff --git a/tornado/web.py b/tornado/web.py index b6d7e97ed..915ddb9d9 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -447,7 +447,10 @@ class RequestHandler(object): The name of the argument is provided if known, but may be None (e.g. for unnamed groups in the url regex). """ - return _unicode(value) + try: + return _unicode(value) + except UnicodeDecodeError: + raise HTTPError(400, "Invalid unicode: %r" % value) @property def cookies(self):