#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <ctype.h>
#include <fcntl.h>
#include <string.h>
#include "cgi.h"
Go to the source code of this file.
Defines | |
#define | _getenv(X) (pCO->pfEnv ? pCO->pfEnv(pCO->pEmbed,(X),0) : getenv(X)) |
#define | CR '\r' |
#define | LF '\n' |
#define | BUFFER_INCREASE 1024 |
#define | BUFFER_MAX 10240 |
#define | CONTENT_MAX 0xA00000 |
#define | FILE_MAX 0xA00000 |
#define | ISAPI_BUFFER 0xA000 |
#define | DEBUGFP (pCO->pDebugInfo->fpDebugInput) |
#define | GETCHAR() (pCO->CharacterInput(pCO)) |
#define | ALLOC(x) (pCO->maf((x),pCO->pSegment)) |
#define | FREE(x) (pCO->mrf((x),pCO->pSegment)) |
#define | TOHEX(x) ((x) >= 'A' ? (((x) & 0xdf) - 'A')+10 : ((x) - '0')) |
#define | READL(x) |
#define | ISAPIVAR(X, Y) |
Functions | |
static int | stricmp (char *a, char *b) |
static char | x2c (char *what) |
static void | unescape (char *s, long *len) |
static void * | my_maf (long size, void *p) |
static void | my_mrf (void *q, void *p) |
static int | CgiGetChar (pCgiObject pCO) |
static void | CgiPutChar (pCgiObject pCO, int ch) |
static int | DebugGetChar (pCgiObject pCO) |
void | cgi_InitCgi (pCgiObject pCO) |
void | cgi_InitIsapi (pCgiObject pCO, LPEXTENSION_CONTROL_BLOCK lpECB) |
long | cgi_ReadHttpRequest (pCgiObject pCO) |
char * | cgi_PostParam (pCgiObject pCO, char *pszParam) |
char * | cgi_GetParam (pCgiObject pCO, char *pszParam) |
char * | cgi_PostParamEx (pCgiObject pCO, char *pszParam, pSymbolList *p) |
char * | cgi_GetParamEx (pCgiObject pCO, char *pszParam, pSymbolList *p) |
FILE * | cgi_FILEp (pCgiObject pCO, char *pszParam) |
char * | cgi_OriginalFileName (pCgiObject pCO, char *pszParam) |
long | cgi_FileLength (pCgiObject pCO, char *pszParam) |
pSymbolList | cgi_PartHeader (pCgiObject pCO, char *pszParam) |
char * | cgi_Header (pCgiObject pCO, char *symbol, pSymbolList pHeader) |
char * | cgi_Referer (pCgiObject pCO) |
char * | cgi_Cookie (pCgiObject pCO) |
char * | cgi_ServerSoftware (pCgiObject pCO) |
char * | cgi_ServerName (pCgiObject pCO) |
char * | cgi_GatewayInterface (pCgiObject pCO) |
char * | cgi_ServerProtocol (pCgiObject pCO) |
char * | cgi_ServerPort (pCgiObject pCO) |
char * | cgi_RequestMethod (pCgiObject pCO) |
char * | cgi_PathInfo (pCgiObject pCO) |
char * | cgi_PathTranslated (pCgiObject pCO) |
char * | cgi_ScriptName (pCgiObject pCO) |
char * | cgi_QueryString (pCgiObject pCO) |
char * | cgi_RemoteHost (pCgiObject pCO) |
char * | cgi_RemoteAddress (pCgiObject pCO) |
char * | cgi_AuthType (pCgiObject pCO) |
char * | cgi_RemoteUser (pCgiObject pCO) |
char * | cgi_RemoteIdent (pCgiObject pCO) |
char * | cgi_ContentType (pCgiObject pCO) |
char * | cgi_ContentLength (pCgiObject pCO) |
char * | cgi_UserAgent (pCgiObject pCO) |
int | cgi_ResizeBuffer (pCgiObject pCO, unsigned long lNewSize) |
long | cgi_FillBuffer (pCgiObject pCO) |
void | cgi_ShiftBuffer (pCgiObject pCO, unsigned long nch) |
void | cgi_NormalizeBuffer (pCgiObject pCO) |
long | cgi_SkipAfterBoundary (pCgiObject pCO) |
int | cgi_GetNextByte (pCgiObject pCO) |
int | cgi_GetNextChar (pCgiObject pCO) |
long | cgi_ReadHeader (pCgiObject pCO, pSymbolList *pHeader) |
int | cgi_ResizeThisBuffer (pCgiObject pCO, char **ppszBuffer, long *plOldSize, long lNewSize) |
void | cgi_FillSymbolAndFile (pCgiObject pCO, char *pszContentDisposition, pSymbolList pHeader) |
long | cgi_GetMultipartParameters (pCgiObject pCO) |
long | cgi_GetGetParameters (pCgiObject pCO) |
long | cgi_GetPostParameters (pCgiObject pCO) |
|
Definition at line 151 of file cgi.c. Referenced by cgi_AuthType(), cgi_ContentLength(), cgi_ContentType(), cgi_Cookie(), cgi_GatewayInterface(), cgi_PathInfo(), cgi_PathTranslated(), cgi_QueryString(), cgi_Referer(), cgi_RemoteAddress(), cgi_RemoteHost(), cgi_RemoteIdent(), cgi_RemoteUser(), cgi_RequestMethod(), cgi_ScriptName(), cgi_ServerName(), cgi_ServerPort(), cgi_ServerProtocol(), cgi_ServerSoftware(), and cgi_UserAgent(). |
|
|
|
|
|
Definition at line 173 of file cgi.c. Referenced by cgi_InitCgi(). |
|
Definition at line 175 of file cgi.c. Referenced by cgi_InitCgi(). |
|
Definition at line 169 of file cgi.c. Referenced by cgi_GetMultipartParameters(), cgi_GetNextByte(), cgi_ReadHeader(), and cgi_SkipAfterBoundary(). |
|
Definition at line 180 of file cgi.c. Referenced by cgi_ReadHttpRequest(), and DebugGetChar(). |
|
Definition at line 176 of file cgi.c. Referenced by cgi_InitCgi(). |
|
|
|
Definition at line 182 of file cgi.c. Referenced by cgi_FillBuffer(). |
|
Definition at line 178 of file cgi.c. Referenced by cgi_InitCgi(). |
|
Value: if( pCO->pDebugInfo->X )return pCO->pDebugInfo->X;\ { DWORD cbBuffer;\ cbBuffer = 0;\ pCO->lpECB->GetServerVariable(pCO->lpECB->ConnID,Y,NULL,&cbBuffer);\ if( cbBuffer == 0 )return NULL;\ pCO->pDebugInfo->X = ALLOC(cbBuffer);\ if( pCO->pDebugInfo->X == NULL )return NULL;\ pCO->lpECB->GetServerVariable(pCO->lpECB->ConnID,Y,pCO->pDebugInfo->X,&cbBuffer);\ return pCO->pDebugInfo->X;} Definition at line 914 of file cgi.c. Referenced by cgi_AuthType(), cgi_ContentLength(), cgi_ContentType(), cgi_Cookie(), cgi_PathInfo(), cgi_PathTranslated(), cgi_QueryString(), cgi_Referer(), cgi_RemoteAddress(), cgi_RemoteHost(), cgi_RemoteUser(), cgi_RequestMethod(), cgi_ScriptName(), cgi_ServerName(), cgi_ServerPort(), cgi_ServerProtocol(), and cgi_ServerSoftware(). |
|
Definition at line 170 of file cgi.c. Referenced by cgi_GetMultipartParameters(), cgi_GetNextByte(), cgi_ReadHeader(), and cgi_SkipAfterBoundary(). |
|
Value: if( fgets(LocalBuffer,1024,DEBUGFP) ){\ LocalBuffer[w=strlen(LocalBuffer)-2] = (char)0; /* remove terminating \r\n (we read binary)*/ \ pCO->pDebugInfo->x = ALLOC(w);\ if( pCO->pDebugInfo->x == NULL )return CGI_ERROR_MEMORY_LOW;\ strcpy(pCO->pDebugInfo->x,LocalBuffer);\ }else pCO->pDebugInfo->x = ""; Referenced by cgi_ReadHttpRequest(). |
|
Referenced by x2c(). |
|
|
|
Definition at line 1302 of file cgi.c. References _getenv, ISAPIVAR, and NULL. Referenced by cgi_ReadHttpRequest(). |
|
Definition at line 1281 of file cgi.c. References _getenv, ISAPIVAR, and NULL. Referenced by cgi_GetMultipartParameters(), and cgi_ReadHttpRequest(). |
|
|
|
Definition at line 798 of file cgi.c. References p. |
|
|
|
Definition at line 1415 of file cgi.c. References GETCHAR. Referenced by cgi_GetMultipartParameters(), cgi_GetNextByte(), cgi_GetNextChar(), cgi_GetPostParameters(), cgi_ReadHeader(), and cgi_SkipAfterBoundary(). |
|
Definition at line 1796 of file cgi.c. References ALLOC, memcpy(), NULL, r, and s. Referenced by cgi_GetMultipartParameters(). |
|
|
|
Definition at line 1979 of file cgi.c. References ALLOC, cgi_QueryString(), memcpy(), NULL, s, and unescape(). Referenced by cgi_GetMultipartParameters(), cgi_GetPostParameters(), and cgi_ReadHttpRequest(). |
|
Definition at line 1864 of file cgi.c. References ALLOC, cbBuffer, cgi_ContentType(), cgi_FillBuffer(), cgi_FillSymbolAndFile(), cgi_GetGetParameters(), cgi_GetNextByte(), cgi_Header(), cgi_ReadHeader(), cgi_ResizeBuffer(), cgi_ResizeThisBuffer(), cgi_ShiftBuffer(), cgi_SkipAfterBoundary(), CR, FREE, fseek(), i, lErrorCode, LF, memcpy(), NULL, pszBuffer, s, and SEEK_SET. Referenced by cgi_ReadHttpRequest(). |
|
Definition at line 1572 of file cgi.c. References cgi_FillBuffer(), cgi_NormalizeBuffer(), cgi_ResizeBuffer(), CR, and LF. Referenced by cgi_GetMultipartParameters(). |
|
Definition at line 1631 of file cgi.c. References cgi_FillBuffer(), and cgi_ResizeBuffer(). |
|
|
|
Definition at line 704 of file cgi.c. References NULL. |
|
Definition at line 2030 of file cgi.c. References ALLOC, cgi_FillBuffer(), cgi_GetGetParameters(), cgi_ResizeBuffer(), memcpy(), NULL, s, and unescape(). Referenced by cgi_ReadHttpRequest(). |
|
Definition at line 863 of file cgi.c. References NULL, and stricmp(). Referenced by cgi_GetMultipartParameters(). |
|
Definition at line 398 of file cgi.c. References BUFFER_INCREASE, BUFFER_MAX, CgiGetChar(), CONTENT_MAX, FILE_MAX, ISAPI_BUFFER, my_maf(), my_mrf(), and NULL. |
|
|
|
Definition at line 1479 of file cgi.c. References cgi_ShiftBuffer(). Referenced by cgi_GetNextByte(), and cgi_ReadHeader(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 665 of file cgi.c. References NULL. |
|
Definition at line 1155 of file cgi.c. References _getenv, ISAPIVAR, and NULL. Referenced by cgi_GetGetParameters(). |
|
Definition at line 1668 of file cgi.c. References cgi_FillBuffer(), cgi_NormalizeBuffer(), cgi_ResizeBuffer(), CR, i, j, LF, pszValue, and w. Referenced by cgi_GetMultipartParameters(). |
|
Definition at line 497 of file cgi.c. References ALLOC, cgi_ContentLength(), cgi_ContentType(), cgi_GetGetParameters(), cgi_GetMultipartParameters(), cgi_GetPostParameters(), cgi_RequestMethod(), DEBUGFP, DebugGetChar(), memset(), NULL, r, READL, s, and w. |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1071 of file cgi.c. References _getenv, ISAPIVAR, and NULL. Referenced by cgi_ReadHttpRequest(). |
|
Definition at line 1380 of file cgi.c. References ALLOC, cbBuffer, FREE, memcpy(), NULL, and s. Referenced by cgi_GetMultipartParameters(), cgi_GetNextByte(), cgi_GetNextChar(), cgi_GetPostParameters(), cgi_ReadHeader(), and cgi_SkipAfterBoundary(). |
|
Definition at line 1758 of file cgi.c. References ALLOC, FREE, memcpy(), NULL, and s. Referenced by cgi_GetMultipartParameters(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1447 of file cgi.c. Referenced by cgi_GetMultipartParameters(), cgi_NormalizeBuffer(), and cgi_SkipAfterBoundary(). |
|
Definition at line 1504 of file cgi.c. References cgi_FillBuffer(), cgi_ResizeBuffer(), cgi_ShiftBuffer(), CR, i, and LF. Referenced by cgi_GetMultipartParameters(). |
|
|
|
Definition at line 267 of file cgi.c. Referenced by cgi_InitCgi(). |
|
|
|
Definition at line 292 of file cgi.c. References DEBUGFP. Referenced by cgi_ReadHttpRequest(). |
|
Definition at line 228 of file cgi.c. Referenced by cgi_InitCgi(). |
|
Definition at line 231 of file cgi.c. References free(). Referenced by cgi_InitCgi(). |
|
|
|
Definition at line 198 of file cgi.c. Referenced by cgi_GetGetParameters(), and cgi_GetPostParameters(). |
|
Definition at line 186 of file cgi.c. References TOHEX. Referenced by unescape(). |