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
This commit is contained in:
Malcolm Tredinnick 2007-09-16 12:10:28 +00:00
parent 68884a571f
commit 1ef4f5eac6
1 changed files with 5 additions and 2 deletions

View File

@ -42,8 +42,11 @@ class ModPythonRequest(http.HttpRequest):
return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '') return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '')
def is_secure(self): def is_secure(self):
# Note: modpython 3.2.10+ has req.is_https(), but we need to support previous versions try:
return 'HTTPS' in self._req.subprocess_env and self._req.subprocess_env['HTTPS'] == 'on' 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): def _load_post_and_files(self):
"Populates self._post and self._files" "Populates self._post and self._files"