Skip to content

Add support for IPv6 Zone Identifiers #57

Open
@mahmoud

Description

@mahmoud

Due to hyperlink using socket.inet_pton() to parse IPv6, IPv6 zone identifiers aren't supported.

>>> hyperlink.URL.from_text(u'https://[fe80:3438:7667:5c77:ce27%eth0]')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "hyperlink/_url.py", line 1135, in from_text
    rooted, userinfo, uses_netloc)
  File "hyperlink/_url.py", line 797, in __init__
    _, self._host = parse_host(_textcheck('host', host, '/?#@'))
  File "hyperlink/_url.py", line 697, in parse_host
    raise URLParseError('invalid IPv6 host: %r (%r)' % (host, se))
hyperlink._url.URLParseError: invalid IPv6 host: u'fe80:3438:7667:5c77:ce27%eth0' (error('illegal IP address string passed to inet_pton',))

While inet_pton() may not support them, other socket module functions do. This is probably best addressed by switching to regex-based parsing of hosts, which also happens to address hyperlink's Windows-specific branch (socket module on Windows Py2 doesn't support inet_pton).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions