*
*/
#ifndef lint
-static const char rcsid[] = "$Id: cgi-fcgi.c,v 1.7 1999/07/28 00:38:34 roberts Exp $";
+static const char rcsid[] = "$Id: cgi-fcgi.c,v 1.10 1999/08/27 19:39:17 roberts Exp $";
#endif /* not lint */
#include "fcgi_config.h"
* the Web server. Used in main to prevent
* rescheduling WebServerReadHandler. */
+static void WriteStdinEof(void)
+{
+ static int stdin_eof_sent = 0;
+
+ if (stdin_eof_sent)
+ return;
+
+ *((FCGI_Header *)fromWS.stop) = MakeHeader(FCGI_STDIN, requestId, 0, 0);
+ fromWS.stop += sizeof(FCGI_Header);
+ stdin_eof_sent = 1;
+}
+
/*
*----------------------------------------------------------------------
*
bytesToRead -= bytesRead;
fromWS.stop = &fromWS.buff[sizeof(FCGI_Header) + bytesRead];
webServerReadHandlerEOF = (bytesRead == 0);
+
+ if (bytesToRead <= 0)
+ WriteStdinEof();
+
ScheduleIo();
}
\f
{
int listenFd, i;
- if((listenFd = OS_CreateLocalIpcFd(bindPath)) == -1) {
+ /* @@@ Should be able to pick up the backlog as an arg */
+ if((listenFd = OS_CreateLocalIpcFd(bindPath, 5)) == -1) {
exit(OS_Errno);
}
}
} else if(*appPathPtr == '\0') {
strcpy(appPathPtr, argv[i]);
- } else if(isdigit(argv[i][0]) && *nServersPtr == 0) {
+ } else if(isdigit((int)argv[i][0]) && *nServersPtr == 0) {
*nServersPtr = atoi(argv[i]);
if(*nServersPtr <= 0) {
fprintf(stderr, "Number of servers must be greater than 0\n");
numFDs = max(appServerSock, STDIN_FILENO) + 1;
OS_SetFlags(appServerSock, O_NONBLOCK);
+ if (bytesToRead <= 0)
+ WriteStdinEof();
+
ScheduleIo();
+
while(!exitStatusSet) {
/*
* NULL = wait forever (or at least until there's something