ostinelli / net-http2

NetHttp2 is an HTTP/2 client for Ruby.
MIT License
141 stars 31 forks source link

Deduce address family from Socket.getaddrinfo #33

Closed celsworth closed 1 year ago

celsworth commented 6 years ago

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

Closes #32.

ostinelli commented 5 years ago

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

celsworth commented 5 years ago

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

ostinelli commented 5 years ago

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

A1bi commented 2 years ago

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 commented 1 year ago

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'
ostinelli commented 1 year ago

Thank you, merged and pushed 0.18.5.