Fixed #25099 -- Fixed crash in AdminEmailHandler on DisallowedHost.

This commit is contained in:
Vlastimil Zíma 2015-09-03 20:52:49 +02:00 committed by Tim Graham
parent 4c0447b2ae
commit cf29b6b561
5 changed files with 71 additions and 5 deletions

View file

@ -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 = [