]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
rase 400, not 500 on invalid unicode in decode_argument
authorMinRK <benjaminrk@gmail.com>
Mon, 23 Dec 2013 00:34:06 +0000 (16:34 -0800)
committerMinRK <benjaminrk@gmail.com>
Mon, 23 Dec 2013 21:59:43 +0000 (13:59 -0800)
tornado/web.py

index b6d7e97edd941b9cf4c2c5826c96f8d562eaf6f7..915ddb9d92b59dda4db831c988f109177d4f951f 100644 (file)
@@ -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):