#23815: CsrfViewMiddleware UnicodeDecodeError
-------------------------------------+-------------------------------------
Reporter: codeitloadit | Owner: nobody
Type: Bug | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: middleware | Triage Stage: Accepted
CsrfViewMiddleware |
UnicodeDecodeError |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by claudep):
Reproducible with:
{{{
#!diff
diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py
index 9c6e2e5..f22cddb 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):
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23815#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.6c1fe8706ac53e988f642d53894a7262%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.