Issue #15628 has been updated by deivid (David Rodr=EDguez).


Hi!

Any feedback about this? We're considering implementing "Happy Eyeballs" in=
 rubygems by monkeypatching `TCPSocket.new`, in order to fix longstanding i=
ssues with `gem install` timing out on ipv6-capable clients. But it would f=
eel much better if this was built in.

----------------------------------------
Feature #15628: init_inetsock_internal should fallback to IPv4 if IPv6 is u=
nreachable
https://bugs.ruby-lang.org/issues/15628#change-87378

* Author: sonalkr132 (Aditya Prakash)
* Status: Open
* Priority: Normal
----------------------------------------
Hi,

This is not really bug but more of a missing feature. Let me layout steps t=
o reproduce what I am trying to achieve:
* Add local entries for `example.com` =


```
$ echo "::1     example.com www.example.com
127.0.0.1 example.com www.example.com" | sudo tee  --append /etc/hosts
```
* Add rule to `DROP` ipv6 packets: `sudo ip6tables -P INPUT DROP`
* Start a server: `ruby -rwebrick -e 'WEBrick::HTTPServer.new(Port: 8000).s=
tart'`
* Making request using Net:HTTP with timeout (`Net::OpenTimeout`) after aft=
er 60 seconds: `ruby -rnet/http -e "Net::HTTP.get(URI('http://example.com:8=
000'))"`


As far as I understand, [init_inetsock_internal](https://github.com/ruby/ru=
by/blob/4444025d16ae1a586eee6a0ac9bdd09e33833f3c/ext/socket/ipsocket.c#L42)=
 needs to fallback to ipv4 for Net::HTTP.get to work. IPv6 route being brok=
e is expected and hence, [RFC8305](https://tools.ietf.org/html/rfc8305) rec=
ommends fallback to IPv4.
Support for IPv6 fallback is spotty across languages and http clients, for =
example, [golang supports it](https://github.com/golang/go/blob/master/src/=
net/dial.go#L47) but python doesn't, making request with `curl` works but `=
wget` hangs.



-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>