]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Remove whitespace/control-character check from RequestHandler.redirect.
authorBen Darnell <ben@bendarnell.com>
Mon, 13 May 2013 04:08:04 +0000 (00:08 -0400)
committerBen Darnell <ben@bendarnell.com>
Mon, 13 May 2013 04:24:49 +0000 (00:24 -0400)
Control characters (and newlines and tabs) will be caught in
set_header (which will raise an exception instead of silently
stripping them).  Spaces will now be allowed through, producing
invalid urls, but at least they won't mess up the header framing.

Closes #617.

tornado/web.py

index 905621c21bf09cc80ae2a0b8d8f1f84c68b98548..af5ea5127fe268df3a90ea1e7bd7cf616e22e112 100644 (file)
@@ -500,10 +500,8 @@ class RequestHandler(object):
         else:
             assert isinstance(status, int) and 300 <= status <= 399
         self.set_status(status)
-        # Remove whitespace
-        url = re.sub(br"[\x00-\x20]+", "", utf8(url))
         self.set_header("Location", urlparse.urljoin(utf8(self.request.uri),
-                                                     url))
+                                                     utf8(url)))
         self.finish()
 
     def write(self, chunk):