Fixed #24463 -- Removed mod_python functionality from HttpRequest._get_scheme()
This commit is contained in:
parent
a3e89f13df
commit
ccff08c194
@ -1,7 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
@ -157,11 +156,14 @@ class HttpRequest(object):
|
|||||||
return iri_to_uri(location)
|
return iri_to_uri(location)
|
||||||
|
|
||||||
def _get_scheme(self):
|
def _get_scheme(self):
|
||||||
return 'https' if os.environ.get("HTTPS") == "on" else 'http'
|
"""
|
||||||
|
Hook for subclasses like WSGIRequest to implement. Returns 'http' by
|
||||||
|
default.
|
||||||
|
"""
|
||||||
|
return 'http'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def scheme(self):
|
def scheme(self):
|
||||||
# First, check the SECURE_PROXY_SSL_HEADER setting.
|
|
||||||
if settings.SECURE_PROXY_SSL_HEADER:
|
if settings.SECURE_PROXY_SSL_HEADER:
|
||||||
try:
|
try:
|
||||||
header, value = settings.SECURE_PROXY_SSL_HEADER
|
header, value = settings.SECURE_PROXY_SSL_HEADER
|
||||||
@ -171,8 +173,6 @@ class HttpRequest(object):
|
|||||||
)
|
)
|
||||||
if self.META.get(header, None) == value:
|
if self.META.get(header, None) == value:
|
||||||
return 'https'
|
return 'https'
|
||||||
# Failing that, fall back to _get_scheme(), which is a hook for
|
|
||||||
# subclasses to implement.
|
|
||||||
return self._get_scheme()
|
return self._get_scheme()
|
||||||
|
|
||||||
def is_secure(self):
|
def is_secure(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user