diff --git a/cgi.d b/cgi.d index e5dfcbe..a2a7ada 100644 --- a/cgi.d +++ b/cgi.d @@ -4016,7 +4016,18 @@ void serveFastCgi(alias fun, CustomCgi = Cgi, long maxContentLength = defaultMax // if a listening port was specified on the command line, we want to spawn ourself // (needed for nginx without spawn-fcgi, e.g. on Windows) FCGX_Init(); - auto sock = FCGX_OpenSocket(toStringz(params.listeningHost ~ ":" ~ to!string(lp)), 12); + + int sock; + + auto host = params.listeningHost; + if(host.startsWith("unix:")) { + sock = FCGX_OpenSocket(toStringz(params.listeningHosa["unix:".length .. $]), 12); + } else if(host.startsWith("abstract:")) { + sock = FCGX_OpenSocket(toStringz("\0" ~ params.listeningHosa["abstract:".length .. $]), 12); + } else { + sock = FCGX_OpenSocket(toStringz(params.listeningHost ~ ":" ~ to!string(lp)), 12); + } + if(sock < 0) throw new Exception("Couldn't listen on the port"); FCGX_InitRequest(&request, sock, 0);