1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #2092: added a "is_secure()" method to HttpRequest which correctly handles the subtleties of mod_python's interaction with os.environ. This one's been bugging me for about a *year*, so many many thanks to k.shaposhnikov@gmail.com for figuring it out, and Tim Shaffer for pointing out this ticket.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3410 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2006-07-21 16:20:22 +00:00
parent 8bdd19beea
commit e9a236d86c
7 changed files with 29 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
from django.conf import settings
from django import http
from django.core.mail import mail_managers
import md5, os
import md5
class CommonMiddleware(object):
"""
@@ -44,7 +44,7 @@ class CommonMiddleware(object):
if new_url != old_url:
# Redirect
if new_url[0]:
newurl = "%s://%s%s" % (os.environ.get('HTTPS') == 'on' and 'https' or 'http', new_url[0], new_url[1])
newurl = "%s://%s%s" % (request.is_secure() and 'https' or 'http', new_url[0], new_url[1])
else:
newurl = new_url[1]
if request.GET: