summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-10-12 20:53:19 +0200
committerClaude Paroz <claude@2xlibre.net>2014-10-13 17:39:23 +0200
commit6398ebab93a6a19afd1aee9cef120f052a801717 (patch)
tree2d31df16da46979bb8e6e402b88c396cec30e999 /tests
parentbc13a08f89b4a9b7980588b013f358b2721c42a6 (diff)
[1.7.x] Fixed #23638 -- Prevented crash while parsing invalid cookie content
Thanks Philip Gatt for the report and Tim Graham for the review. Backport of 59d487e7fc from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/handlers/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py
index a2f1b622d4..d9d2487396 100644
--- a/tests/handlers/tests.py
+++ b/tests/handlers/tests.py
@@ -80,6 +80,16 @@ class HandlerTests(TestCase):
# much more work than fixing #20557. Feel free to remove force_str()!
self.assertEqual(request.COOKIES['want'], force_str("café"))
+ def test_invalid_unicode_cookie(self):
+ """
+ Invalid cookie content should result in an absent cookie, but not in a
+ crash while trying to decode it (#23638).
+ """
+ environ = RequestFactory().get('/').environ
+ environ['HTTP_COOKIE'] = 'x=W\x03c(h]\x8e'
+ request = WSGIRequest(environ)
+ self.assertEqual(request.COOKIES, {})
+
class TransactionsPerRequestTests(TransactionTestCase):