From 582106b93f80b715ee3bccc039fb2b8299c21fb6 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Mon, 13 May 2013 00:08:04 -0400 Subject: [PATCH] Remove whitespace/control-character check from RequestHandler.redirect. 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 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tornado/web.py b/tornado/web.py index 905621c2..af5ea512 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -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):