summaryrefslogtreecommitdiff
path: root/django/core/handlers/modpython.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-09-16 12:10:28 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-09-16 12:10:28 +0000
commit1ef4f5eac64507eb2c0ba5b8babe0229f2803117 (patch)
tree8c5d737cf45923d1ba53729a3f79e97d4f7ea02b /django/core/handlers/modpython.py
parent68884a571ffa49a93898f0368f64638c31623fb7 (diff)
Fixed #4710 -- Improved mod_python HTTPS checking. Thanks, Aaron Maxwell, SmileyChris and Graham Dumpleton.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6359 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/handlers/modpython.py')
-rw-r--r--django/core/handlers/modpython.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py
index f98566be96..d4f5e55011 100644
--- a/django/core/handlers/modpython.py
+++ b/django/core/handlers/modpython.py
@@ -42,8 +42,11 @@ class ModPythonRequest(http.HttpRequest):
return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '')
def is_secure(self):
- # Note: modpython 3.2.10+ has req.is_https(), but we need to support previous versions
- return 'HTTPS' in self._req.subprocess_env and self._req.subprocess_env['HTTPS'] == 'on'
+ try:
+ return self._req.is_https()
+ except AttributeError:
+ # mod_python < 3.2.10 doesn't have req.is_https().
+ return self._req.subprocess_env.get('HTTPS', '').lower() in ('on', '1')
def _load_post_and_files(self):
"Populates self._post and self._files"