mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #33569 -- Added SECURE_PROXY_SSL_HEADER support for list of protocols in the header value.
This commit is contained in:
committed by
Mariusz Felisiak
parent
d46e158ee2
commit
1cf60ce601
@@ -424,6 +424,26 @@ class SecureProxySslHeaderTest(SimpleTestCase):
|
||||
req.META["HTTP_X_FORWARDED_PROTO"] = "https"
|
||||
self.assertIs(req.is_secure(), True)
|
||||
|
||||
@override_settings(SECURE_PROXY_SSL_HEADER=("HTTP_X_FORWARDED_PROTO", "https"))
|
||||
def test_set_with_xheader_leftmost_right(self):
|
||||
req = HttpRequest()
|
||||
req.META["HTTP_X_FORWARDED_PROTO"] = "https, http"
|
||||
self.assertIs(req.is_secure(), True)
|
||||
req.META["HTTP_X_FORWARDED_PROTO"] = "https , http"
|
||||
self.assertIs(req.is_secure(), True)
|
||||
|
||||
@override_settings(SECURE_PROXY_SSL_HEADER=("HTTP_X_FORWARDED_PROTO", "https"))
|
||||
def test_set_with_xheader_leftmost_not_secure(self):
|
||||
req = HttpRequest()
|
||||
req.META["HTTP_X_FORWARDED_PROTO"] = "http, https"
|
||||
self.assertIs(req.is_secure(), False)
|
||||
|
||||
@override_settings(SECURE_PROXY_SSL_HEADER=("HTTP_X_FORWARDED_PROTO", "https"))
|
||||
def test_set_with_xheader_multiple_not_secure(self):
|
||||
req = HttpRequest()
|
||||
req.META["HTTP_X_FORWARDED_PROTO"] = "http ,wrongvalue,http,http"
|
||||
self.assertIs(req.is_secure(), False)
|
||||
|
||||
@override_settings(SECURE_PROXY_SSL_HEADER=("HTTP_X_FORWARDED_PROTO", "https"))
|
||||
def test_xheader_preferred_to_underlying_request(self):
|
||||
class ProxyRequest(HttpRequest):
|
||||
|
||||
Reference in New Issue
Block a user