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