getRequestHostname() has similar problems, which this addresses:

    def new_getRequestHostname(self):
        host = self.getHeader(b'host')
        if host:
            if host.startswith(b'['):
                if host.find(b']') < host.rfind(b':'):
                    return host[:host.rfind(b':')]
                else:
                    return host
        host = self.getHost().host
        try:
            ip = IPAddress(host.decode("idna"))
        except AddrFormatError:
            # If we could not convert the hostname to an IPAddress, assume that
            # it is a hostname.
            return networkString(host)
        if ip.version == 4:
            return networkString(host)
        else:
            return networkString(b'[' + host + b']')

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1604608

Title:
  ipv6 client causes errors in twisted.web

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/twisted/+bug/1604608/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to