diff options
| author | Claude Paroz <claude@2xlibre.net> | 2015-01-05 18:23:57 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-01-06 08:45:10 +0100 |
| commit | d8fb557a519a419a53d648ce1ef12dad8673151f (patch) | |
| tree | 572027e863af5386a62da128a82830b98c5bdebf /tests | |
| parent | 0e21fd4e4048718fe065a8ff080c1d0df8173883 (diff) | |
[1.7.x] Fixed #23815 -- Prevented UnicodeDecodeError in CSRF middleware
Thanks codeitloadit for the report, living180 for investigations
and Tim Graham for the review.
Backport of 27dd7e7271 from master.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/csrf_tests/tests.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py index 6199ca84bd..a2a8f1c925 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -300,6 +300,11 @@ class CsrfViewMiddlewareTest(TestCase): req2 = CsrfViewMiddleware().process_view(req, post_form_view, (), {}) self.assertNotEqual(None, req2) self.assertEqual(403, req2.status_code) + # Non-ASCII + req.META['HTTP_REFERER'] = b'\xd8B\xf6I\xdf' + req2 = CsrfViewMiddleware().process_view(req, post_form_view, (), {}) + self.assertNotEqual(None, req2) + self.assertEqual(403, req2.status_code) @override_settings(ALLOWED_HOSTS=['www.example.com']) def test_https_good_referer(self): |
