diff options
author | Claude Paroz <claude@2xlibre.net> | 2014-10-12 20:53:19 +0200 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2014-10-13 17:37:58 +0200 |
commit | 59d487e7fc02980e76dad053dd989c8b4899444f (patch) | |
tree | 1260e1c50168f4d93a432c0c14c97ac2bedfb924 /tests/handlers | |
parent | 8701b5900774be3126321c2449b4d0e8091a9725 (diff) | |
download | django-59d487e7fc02980e76dad053dd989c8b4899444f.tar.gz |
Fixed #23638 -- Prevented crash while parsing invalid cookie content
Thanks Philip Gatt for the report and Tim Graham for the review.
Diffstat (limited to 'tests/handlers')
-rw-r--r-- | tests/handlers/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py index ee74affcc6..31a0ac38bb 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, {}) + @override_settings(ROOT_URLCONF='handlers.urls') class TransactionsPerRequestTests(TransactionTestCase): |