Fix middleware bug
This commit is contained in:
parent
72e74f6c14
commit
9c8ab7b0d5
1 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpResponse, HttpResponseRedirect, HttpRequest
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class LoggedInHintCookieMiddleware(object):
|
||||||
if not request.is_secure():
|
if not request.is_secure():
|
||||||
if self.cookie_correct(request):
|
if self.cookie_correct(request):
|
||||||
# redirect insecure (assuming http) requests with hint cookie to https
|
# redirect insecure (assuming http) requests with hint cookie to https
|
||||||
url = HttpRequest.build_absolute_uri()
|
url = request.build_absolute_uri()
|
||||||
assert url[:5] == 'http:'
|
assert url[:5] == 'http:'
|
||||||
return HttpResponseRedirect('https:' + url[5:])
|
return HttpResponseRedirect('https:' + url[5:])
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue