Fixed #31010 -- Allowed subdomains of localhost in the Host header by default when DEBUG=True.

This commit is contained in:
Gordon Pendleton 2019-11-23 21:17:31 -05:00 committed by Mariusz Felisiak
parent 3930ec1bf2
commit adb9661789
4 changed files with 10 additions and 4 deletions

View file

@ -758,7 +758,7 @@ class HostValidationTests(SimpleTestCase):
If ALLOWED_HOSTS is empty and DEBUG is True, variants of localhost are
allowed.
"""
valid_hosts = ['localhost', '127.0.0.1', '[::1]']
valid_hosts = ['localhost', 'subdomain.localhost', '127.0.0.1', '[::1]']
for host in valid_hosts:
request = HttpRequest()
request.META = {'HTTP_HOST': host}