]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Set the request cookies property to an empty dict if cookie parsing fails 428/head
authorJacob Sondergaard <jacob@nephics.com>
Thu, 5 Jan 2012 11:17:01 +0000 (12:17 +0100)
committerJacob Sondergaard <jacob@nephics.com>
Thu, 5 Jan 2012 11:17:01 +0000 (12:17 +0100)
This commit reverses the bug introduced in commit 4a4d871, leaving an
undefined cookies property on failure to parse a request cookie.

The bug results in a 'NoneType is not iterable' error when calling
RequestHandler.get_cookie() after a cookie parsing exception.

tornado/httpserver.py

index e692ba8a9ca34691fb389a1bc6e2cb7fec800635..3e985ba6c7f9dc023061c6d6000984c6c13a4eaf 100644 (file)
@@ -407,7 +407,7 @@ class HTTPRequest(object):
                     self._cookies.load(
                         native_str(self.headers["Cookie"]))
                 except Exception:
-                    self._cookies = None
+                    self._cookies = {}
         return self._cookies
 
     def write(self, chunk, callback=None):