Skip to content

DynamicSiteIDMiddleware fails when application when the request.host is an IPv6 address #82

Open
@comandrei

Description

Environment:

Django==1.8.18
djangotoolbox==1.8.0
Python 2.7.6

When performing a request as http://[2406:da00:ff00::36f3:801a]:80, the process_request method will throw a ValueError while unpacking the host to determine domain/port combination.

def process_request(self, request):
        # Ignore port if it's 80 or 443
        if ':' in request.get_host():
            domain, port = request.get_host().split(':')
            if int(port) not in (80, 443):
                domain = request.get_host()
        else:
            domain = request.get_host().split(':')[0]

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions