mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #25099 -- Fixed crash in AdminEmailHandler on DisallowedHost.
This commit is contained in:
parent
4c0447b2ae
commit
cf29b6b561
5 changed files with 71 additions and 5 deletions
|
@ -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 = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue