*
*/
#ifndef lint
-static const char rcsid[] = "$Id: fcgiapp.c,v 1.25 2001/06/22 13:17:19 skimo Exp $";
+static const char rcsid[] = "$Id: fcgiapp.c,v 1.26 2001/06/22 14:21:03 robs Exp $";
#endif /* not lint */
#include <assert.h>
#endif
#ifdef _WIN32
+#undef DLLAPI
#define DLLAPI __declspec(dllexport)
#endif
-#include "fcgiapp.h"
-#include "fcgiappmisc.h"
-
#include "fcgimisc.h"
#include "fastcgi.h"
#include "fcgios.h"
+#include "fcgiapp.h"
/*
* This is a workaround for one version of the HP C compiler
return newString;
}
-\f
+
/*
*----------------------------------------------------------------------
*
ASSERT(stream->isClosed); /* bug in fillBufProc if not */
return EOF;
}
-\f
+
/*
*----------------------------------------------------------------------
*
stream->stopUnget = stream->rdNext;
}
}
-\f
+
/*
*----------------------------------------------------------------------
*
*p = '\0';
return str;
}
-\f
+
/*
*----------------------------------------------------------------------
*
int FCGX_HasSeenEOF(FCGX_Stream *stream) {
return (stream->isClosed) ? EOF : 0;
}
-\f
+
/*
*----------------------------------------------------------------------
*
ASSERT(stream->isClosed); /* bug in emptyBuffProc if not */
return EOF;
}
-\f
+
/*
*----------------------------------------------------------------------
*
stream->emptyBuffProc(stream, FALSE);
}
}
-\f
+
/*
*----------------------------------------------------------------------
*
{
return FCGX_PutStr(str, strlen(str), stream);
}
-\f
+
/*
*----------------------------------------------------------------------
*
*destPtr = dest;
*srcPtr = src;
}
-\f
+
/*
*----------------------------------------------------------------------
*
stream->emptyBuffProc(stream, FALSE);
return (stream->isClosed) ? -1 : 0;
}
-\f
+
/*
*----------------------------------------------------------------------
*
}
return (stream->FCGI_errno == 0) ? 0 : EOF;
}
-\f
+
/*
*----------------------------------------------------------------------
*
* of the stream that are now all lumped under isClosed.
*/
}
-\f
+
/*
*======================================================================
* Parameters
char **cur; /* current item in vec; *cur == NULL */
} Params;
typedef Params *ParamsPtr;
-\f
+
/*
*----------------------------------------------------------------------
*
*result->cur = NULL;
return result;
}
-\f
+
/*
*----------------------------------------------------------------------
*
free(paramsPtr);
*paramsPtrPtr = NULL;
}
-\f
+
/*
*----------------------------------------------------------------------
*
}
*paramsPtr->cur = NULL;
}
-\f
+
/*
*----------------------------------------------------------------------
*
}
return NULL;
}
-\f
+
/*
*----------------------------------------------------------------------
*
*
*----------------------------------------------------------------------
*/
-\f
+
/*
*----------------------------------------------------------------------
*
}
return 0;
}
-\f
+
/*
*----------------------------------------------------------------------
*
header.reserved = 0;
return header;
}
-\f
+
/*
*----------------------------------------------------------------------
*
memset(body.reserved, 0, sizeof(body.reserved));
return body;
}
-\f
+
/*
*----------------------------------------------------------------------
*
memset(body.reserved, 0, sizeof(body.reserved));
return body;
}
-\f
+
/*
*----------------------------------------------------------------------
*
u = ((u + 7) & (ULONG_MAX - 7)) - u;
return p + u;
}
-\f
+
/*
* State associated with a stream
int rawWrite; /* writer: write data without stream headers */
FCGX_Request *reqDataPtr; /* request data not specific to one stream */
} FCGX_Stream_Data;
-\f
+
/*
*----------------------------------------------------------------------
*
}
data->reqDataPtr->nWriters--;
}
-\f
+
static int write_it_all(int fd, char *buf, int len)
stream->wrNext += sizeof(FCGI_Header);
}
}
-\f
+
/*
* Return codes for Process* functions
*/
return MGMT_RECORD;
}
-\f
+
/*
*----------------------------------------------------------------------
*
data->reqDataPtr->isBeginProcessed = TRUE;
return BEGIN_RECORD;
}
-\f
+
/*
*----------------------------------------------------------------------
*
}
return STREAM_RECORD;
}
-\f
+
/*
*----------------------------------------------------------------------
*
}
}
}
-\f
+
/*
*----------------------------------------------------------------------
*
}
return stream;
}
-\f
+
/*
*----------------------------------------------------------------------
*
- * FreeStream --
+ * FCGX_FreeStream --
*
* Frees all storage allocated when *streamPtr was created,
* and nulls out *streamPtr.
*
*----------------------------------------------------------------------
*/
-void FreeStream(FCGX_Stream **streamPtr)
+void FCGX_FreeStream(FCGX_Stream **streamPtr)
{
FCGX_Stream *stream = *streamPtr;
FCGX_Stream_Data *data;
free(stream);
*streamPtr = NULL;
}
-\f
+
/*
*----------------------------------------------------------------------
*
stream->isClosed = FALSE;
return stream;
}
-\f
+
/*
*----------------------------------------------------------------------
*
return NewStream(reqDataPtr, bufflen, TRUE, streamType);
}
-
/*
*----------------------------------------------------------------------
*
return NewStream(reqDataPtr, bufflen, FALSE, streamType);
}
-
/*
*----------------------------------------------------------------------
*
- * CreateWriter --
+ * FCGX_CreateWriter --
*
* Creates a stream to write streamType FastCGI records, using
* the given ipcFd and request Id. This function is provided
*
*----------------------------------------------------------------------
*/
-FCGX_Stream *CreateWriter(
+FCGX_Stream *FCGX_CreateWriter(
int ipcFd,
int requestId,
int bufflen,
reqDataPtr->nWriters = 2;
return NewWriter(reqDataPtr, bufflen, streamType);
}
-\f
+
/*
*======================================================================
* Control
return !isFastCGI;
}
-\f
+
/*
*----------------------------------------------------------------------
*
if (request == NULL)
return;
- FreeStream(&request->in);
- FreeStream(&request->out);
- FreeStream(&request->err);
+ FCGX_FreeStream(&request->in);
+ FCGX_FreeStream(&request->out);
+ FCGX_FreeStream(&request->err);
FreeParams(&request->paramsPtr);
if (close) {
reqDataPtr->envp = reqDataPtr->paramsPtr->vec;
return 0;
}
-\f
+
/*
*----------------------------------------------------------------------
*
SetReaderType(stream, FCGI_DATA);
return 0;
}
-\f
+
/*
*----------------------------------------------------------------------
*