diff options
author | Claude Paroz <claude@2xlibre.net> | 2016-08-12 15:31:18 +0200 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2016-08-23 22:40:07 +0200 |
commit | 48c34f3336cbbc906066636a7aa35270a7b44895 (patch) | |
tree | ac9ebdd1e77ca5af5e01b8a21ad9f3e59d4e8e3c /tests/handlers | |
parent | 384f89f8f843953ac11cf211f85291b5c14baeb9 (diff) | |
download | django-48c34f3336cbbc906066636a7aa35270a7b44895.tar.gz |
Fixed #26971 -- Prevented crash with non-UTF-8 incoming PATH_INFO
Thanks Tim Graham and Loïc Bistuer for the reviews.
Diffstat (limited to 'tests/handlers')
-rw-r--r-- | tests/handlers/tests.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py index 9f01cb201a..ea7a5ba130 100644 --- a/tests/handlers/tests.py +++ b/tests/handlers/tests.py @@ -33,12 +33,16 @@ class HandlerTests(SimpleTestCase): self.assertIsNotNone(handler._request_middleware) def test_bad_path_info(self): - """Tests for bug #15672 ('request' referenced before assignment)""" + """ + A non-UTF-8 path populates PATH_INFO with an URL-encoded path and + produces a 404. + """ environ = RequestFactory().get('/').environ environ['PATH_INFO'] = b'\xed' if six.PY2 else '\xed' handler = WSGIHandler() response = handler(environ, lambda *a, **k: None) - self.assertEqual(response.status_code, 400) + # The path of the request will be encoded to '/%ED'. + self.assertEqual(response.status_code, 404) def test_non_ascii_query_string(self): """ |