Merge pull request #316 from Ssamm45/master

Fix unix socket code
This commit is contained in:
Adam D. Ruppe 2022-01-11 20:12:21 -05:00 committed by GitHub
commit 956105e969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

8
cgi.d
View File

@ -4010,20 +4010,20 @@ void serveFastCgi(alias fun, CustomCgi = Cgi, long maxContentLength = defaultMax
}
auto lp = params.listeningPort;
auto host = params.listeningHost;
FCGX_Request request;
if(lp) {
if(lp || !host.empty) {
// 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();
int sock;
auto host = params.listeningHost;
if(host.startsWith("unix:")) {
sock = FCGX_OpenSocket(toStringz(params.listeningHosa["unix:".length .. $]), 12);
sock = FCGX_OpenSocket(toStringz(params.listeningHost["unix:".length .. $]), 12);
} else if(host.startsWith("abstract:")) {
sock = FCGX_OpenSocket(toStringz("\0" ~ params.listeningHosa["abstract:".length .. $]), 12);
sock = FCGX_OpenSocket(toStringz("\0" ~ params.listeningHost["abstract:".length .. $]), 12);
} else {
sock = FCGX_OpenSocket(toStringz(params.listeningHost ~ ":" ~ to!string(lp)), 12);
}