vibe-d / vibe.d

Official vibe.d development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regression #249 - failed to listen to address with default

hholst80 opened this issue · comments

# dmd --version
DMD64 D Compiler v2.105.3

Up-to-date vibe-d 0.9.7: target for configuration [library] is up to date.
[main(----) INF] Listening for requests on http://[::]:1337/
Failed to listen on 0.0.0.0:1337

Which is strange because there is nothing listening on IPv4 on port 1337.

# ss -tlpn
State    Recv-Q   Send-Q      Local Address:Port        Peer Address:Port   Process                                                                     
LISTEN   0        4096              0.0.0.0:27017            0.0.0.0:*       users:(("mongod",pid=1286,fd=11))                                          
LISTEN   0        4096            127.0.0.1:8384             0.0.0.0:*       users:(("syncthing",pid=1492,fd=26))                                       
LISTEN   0        10           127.0.0.1%lo:53               0.0.0.0:*       users:(("connmand",pid=1029,fd=12))                                        
LISTEN   0        511             127.0.0.1:10002            0.0.0.0:*       users:(("node",pid=1311,fd=20))                                            
LISTEN   0        511             127.0.0.1:10000            0.0.0.0:*       users:(("node",pid=1311,fd=18))                                            
LISTEN   0        511             127.0.0.1:10001            0.0.0.0:*       users:(("node",pid=1311,fd=19))                                            
LISTEN   0        10               [::1]%lo:53                  [::]:*       users:(("connmand",pid=1029,fd=13))                                        
LISTEN   0        4096                    *:22000                  *:*       users:(("syncthing",pid=1492,fd=13))   

If I set bindAddresses to 127.0.0.1 or even 0.0.0.0 it works, as expected.

# cat source/app.d
import std.stdio;
import std.conv;
import std.net.curl;
import std.array;
import std.process;
import vibe.d;

int main() {
    // Configure server settings
    auto settings = new HTTPServerSettings;
    settings.port = 1337;
    // settings.bindAddresses = ["0.0.0.0"];

    // Initialize server
    auto router = new URLRouter;

    // Start the server
    listenHTTP(settings, router);

    return runEventLoop();
}
[main(----) INF] Listening for requests on http://0.0.0.0:1337/