-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WEBRick::HTTPServer creates ipv6only socket for host ::
#99
Comments
Does anyone have a workaround for this to force webrick to serve on both IPv4 and IPv6? I'm using |
Same issue with WEBrick 1.8.1 on macOS under Ruby 3.3.4 ( |
hmm, I don't know what I did test back in August, but for me using
Will bind correctly:
This also works on macOS too. Used Ruby 3.3.5 and WEBrick 1.8.1 for testing. I also tested with Ruby 3.1.1 and WEBrick 1.7.0, like @pohlarized did, and it also worked as expected. |
The IPv6 host
::
is kind of analogous to the IPv4 address0.0.0.0
, however it should usually (depending on the OS) listen for traffic coming from IPv4 and IPv6 addresses, unless specified differently by the OS.However, i have observed that across different linux distros i have tried (manjaro, arch, debian), WEBRick will open its socket in ipv6-only mode.
I assume that the reason is this line as using the
Socket.tcp_server_sockets
function manually leads to the same result.However, e.g. using the
TCPServer
from thesocket
stdlib opens a socker that's not in ipv6-only mode.Sample code i have used:
I have tested this with webrick 1.7.0 on ruby 3.1.1 and on ruby 2.6.3, both yielding the same result.
I have observed the mode using
ss -tlne
, where the local address is shown as[::]:8080
, which indicates ipv6-only mode inss
, while it should be*:8080
in non-ipv6-only mode.It also says
v6only:1
in the process description, while it should sayv6only:0
.Also here's the sample code using
TCPServer
that correctly opens the socket:The text was updated successfully, but these errors were encountered: