net-http2 icon indicating copy to clipboard operation
net-http2 copied to clipboard

Deduce address family from Socket.getaddrinfo

Open celsworth opened this issue 7 years ago • 3 comments

This removes the dependence on AF_INET and allows IPv6-only hosts to be connected to.

Closes #32.

celsworth avatar Jul 24 '18 09:07 celsworth

Hey Chris, can you expand on the benefits of this PR? Thank you.

ostinelli avatar Mar 08 '19 16:03 ostinelli

Hi :)

Yeah no problem - I found that when trying to connect to a host that only had IPv6 connectivity, it failed because the address family was assumed to be AF_INET (IPv4). To connect to an IPv6 host, you have to pass AF_INET6. This PR works out which one to use based on the address that is passed in - so you can now use the library to connect to IPv6 hosts :)

celsworth avatar Mar 08 '19 16:03 celsworth

Got it. Will merge asa I do a new release. Thank you!

ostinelli avatar Mar 11 '19 16:03 ostinelli

I would really appreciate a merging of this. We're running apnotic on IPv6-only hosts trying to connect to APNS (using NAT64). This fails since apnotic/net-http2 cannot connect to IPv6 addresses:

Errno::EPROTONOSUPPORT:Protocol not supported

A1bi avatar Nov 15 '22 23:11 A1bi

Couldn't wait, so I've created a fork with this fix on top of the recent upstream changes (v0.18.4). If you want to use it, just add this to your Gemfile:

gem 'net-http2', git: 'https://github.com/A1bi/net-http2.git', branch: 'ipv6-fix'

A1bi avatar Mar 11 '23 21:03 A1bi

Thank you, merged and pushed 0.18.5.

ostinelli avatar Mar 31 '23 01:03 ostinelli