From 6e5f75cd24ff17ae694e385aa066f34a0d325e1f Mon Sep 17 00:00:00 2001 From: Alex Dehnert Date: Sat, 29 May 2010 22:34:45 -0400 Subject: [PATCH] localhost check needs to use portless-HTTP_HOST As a bonus, this gets around the problem that the Django dev server doesn't set REQUEST_URI. --- django/mit/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/mit/__init__.py b/django/mit/__init__.py index 8858248..8f785ae 100644 --- a/django/mit/__init__.py +++ b/django/mit/__init__.py @@ -46,7 +46,8 @@ class ScriptsRemoteUserBackend(RemoteUserBackend): return user def scripts_login(request, **kwargs): - if request.META['HTTP_HOST'] == 'localhost': + host = request.META['HTTP_HOST'].split(':')[0] + if host == 'localhost': return login(request, **kwargs) elif request.META['SERVER_PORT'] == '444': if request.user.is_authenticated(): @@ -64,6 +65,5 @@ def scripts_login(request, **kwargs): return login(request, **kwargs) else: # Move to port 444 - host = request.META['HTTP_HOST'].split(':')[0] redirect_to = "https://%s:444%s" % (host, request.META['REQUEST_URI'], ) return HttpResponseRedirect(redirect_to) -- 2.44.0