rwf2/Rocket

Rocket should bind to both IPv6 and IPv4

mitchhentges opened this issue · 2 comments

Bug Reports

  1. Version of rocket: 0.3.3
  2. OS: Arch Linux x64

When Rocket starts a server where the address is localhost, it binds to IPv6 by default, rather than running on both IPv6 and IPv4.
This can cause a confusing developer experience where some tools (like Firefox) will check both IPv4 and IPv6 when you access localhost and will connect, but others (such as netcat, NodeJS's built-in http module, etc) won't find Rocket and will throw a "connection refused" error.
I expected Rocket to work more out-of-box, like http-server.

netstat -tulpn output:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      18215/node          // http-server
tcp6       0      0 ::1:8000                :::*                    LISTEN      16929/hello_world   // Rocket
<snip>
  1. How to reproduce the issue:
    Run the Rocket quickstart
git clone https://github.com/SergioBenitez/Rocket
cd Rocket
git checkout v0.3.3
cd examples/hello_world
cargo run

// from other terminal
netcat localhost 8000
// will immediately exit with exit code 1 (failed to connect)
  1. IMHO I think that Rocket should bind to both IPv4 and IPv6.

I believe this is a dupe of #209.

Ah, yes, looks like the same issue! I should've looked further down that ticket when looking for one similar to mine :)
Thanks!