Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for IPv6 Zone Identifiers #57

Open
mahmoud opened this issue Jan 8, 2018 · 0 comments
Open

Add support for IPv6 Zone Identifiers #57

mahmoud opened this issue Jan 8, 2018 · 0 comments

Comments

@mahmoud
Copy link
Member

mahmoud commented Jan 8, 2018

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant