hackney icon indicating copy to clipboard operation
hackney copied to clipboard

Connect to IPv6 addresses

Open nroi opened this issue 7 years ago • 2 comments

Hackney supports connecting to a client by providing the IPv4 instead of its hostname:

hackney:request(get, '78.46.175.29')

It also supports connecting to IPv6 hosts:

hackney:request(get, 'ipv6.xnet.space')

But it fails when attempting to connect to an IPv6 host by providing is IPv6 address:

hackney:request(get, '2a01:4f8:c0c:1de8::2')

I've tried different IPv6 notations, but hackney seems to assume that the given URL is either a hostname, or an IPv4 address.

If it were possible to connect to IPv6 addresses, this would also provide the possibility to implement something like "happy eyeballs" / RFC 8305 on top of hackney. I'm currently using hackney with a very crude workaround to decide whether to use IPv4 or IPv6 to connect to a host.

nroi avatar Feb 03 '19 11:02 nroi

normally the url should be given as hackney:request(get, "http://[2a01:4f8:c0c:1de8::2]"). But then there is an issue with IDNA that should be fixed. I will take care of it later today :)

As eyeball, there is #206 opened long time ago . I aim to implement it but any PR is welcome :)

benoitc avatar Feb 08 '19 08:02 benoitc

idna error has been fixed in latest master with 42875a9b9149be828e698736579eab65607b113f.

benoitc avatar Feb 08 '19 09:02 benoitc