From f4db51309c0333434d9ee96bc52593dacab04c69 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sun, 24 Feb 2008 16:40:58 +0000 Subject: provide for running as a web server child that is, if socket being opened is a null pointer, use FCGI_LISTENSOCK_FILENO Signed-off-by: Michael Krelin --- diff --git a/src/fastcgi.cc b/src/fastcgi.cc index 8b7668c..63b59f8 100644 --- a/src/fastcgi.cc +++ b/src/fastcgi.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include "kingate/fastcgi.h" #include "kingate/exception.h" @@ -15,13 +16,17 @@ namespace kingate { throw exception(CODEPOINT,"failed to FCGX_Init()"); _initialized = true; } - sock = FCGX_OpenSocket(s,bl); - if(sock<0) - throw exception(CODEPOINT,"failed to FCGX_OpenSocket("); - // TODO: check if there is a ':', not if it starts with ':' - if(*s != ':') - if(chmod(s,0777)) // XXX: configurable. - throw exception(CODEPOINT,"failed to chmod()"); + if(!s) { + sock = FCGI_LISTENSOCK_FILENO; + }else{ + sock = FCGX_OpenSocket(s,bl); + if(sock<0) + throw exception(CODEPOINT,"failed to FCGX_OpenSocket("); + // TODO: check if there is a ':', not if it starts with ':' + if(*s != ':') + if(chmod(s,0777)) // XXX: configurable. + throw exception(CODEPOINT,"failed to chmod()"); + } } fcgi_socket::fcgi_socket(int s) : sock(0) { -- cgit v0.9.0.2