Author: mtredinnick
Date: 2007-09-16 07:10:28 -0500 (Sun, 16 Sep 2007)
New Revision: 6359

Modified:
   django/trunk/django/core/handlers/modpython.py
Log:
Fixed #4710 -- Improved mod_python HTTPS checking. Thanks, Aaron Maxwell, 
SmileyChris and Graham Dumpleton.


Modified: django/trunk/django/core/handlers/modpython.py
===================================================================
--- django/trunk/django/core/handlers/modpython.py      2007-09-16 11:59:56 UTC 
(rev 6358)
+++ django/trunk/django/core/handlers/modpython.py      2007-09-16 12:10:28 UTC 
(rev 6359)
@@ -42,8 +42,11 @@
         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"


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to