summaryrefslogtreecommitdiff
path: root/tests/requests
diff options
context:
space:
mode:
authorVlastimil Zíma <vlastimil.zima@gmail.com>2015-09-03 20:52:49 +0200
committerTim Graham <timograham@gmail.com>2015-09-04 09:24:21 -0400
commitcf29b6b5610f242d18dcc31eb897c873109b67e2 (patch)
treebd60ca9d686cd22a002e7a2e2f3d4ab288c1d9eb /tests/requests
parent4c0447b2ae57f4e8c44bcb2f371d160cb8daa930 (diff)
downloaddjango-cf29b6b5610f242d18dcc31eb897c873109b67e2.tar.gz
Fixed #25099 -- Fixed crash in AdminEmailHandler on DisallowedHost.
Diffstat (limited to 'tests/requests')
-rw-r--r--tests/requests/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 8a0b32d1c0..3a3d7e7733 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -502,6 +502,18 @@ class RequestsTests(SimpleTestCase):
with self.assertRaises(UnreadablePostError):
request.FILES
+ @override_settings(ALLOWED_HOSTS=['example.com'])
+ def test_get_raw_uri(self):
+ factory = RequestFactory(HTTP_HOST='evil.com')
+ request = factory.get('////absolute-uri')
+ self.assertEqual(request.get_raw_uri(), 'http://evil.com//absolute-uri')
+
+ request = factory.get('/?foo=bar')
+ self.assertEqual(request.get_raw_uri(), 'http://evil.com/?foo=bar')
+
+ request = factory.get('/path/with:colons')
+ self.assertEqual(request.get_raw_uri(), 'http://evil.com/path/with:colons')
+
class HostValidationTests(SimpleTestCase):
poisoned_hosts = [