Skip to content

Commit

Permalink
django-nonrel#82 Handle IPv6 hostnames
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Coman committed Nov 22, 2017
1 parent 7e2c47e commit ab0ff48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions djangotoolbox/sites/dynamicsite.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class DynamicSiteIDMiddleware(object):
def process_request(self, request):
# Ignore port if it's 80 or 443
if ':' in request.get_host():
domain, port = request.get_host().split(':')
domain, port = request.get_host().rsplit(':', 1)
if int(port) not in (80, 443):
domain = request.get_host()
else:
domain = request.get_host().split(':')[0]
domain = request.get_host().rsplit(':', 1)[0]

# Domains are case insensitive
domain = domain.lower()
Expand Down

0 comments on commit ab0ff48

Please sign in to comment.