--- parser3/src/targets/cgi/parser3.C 2001/10/19 12:43:30 1.122 +++ parser3/src/targets/cgi/parser3.C 2001/10/29 13:04:47 1.126 @@ -4,7 +4,7 @@ Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: parser3.C,v 1.122 2001/10/19 12:43:30 parser Exp $ + $Id: parser3.C,v 1.126 2001/10/29 13:04:47 paf Exp $ */ #include "pa_config_includes.h" @@ -19,12 +19,13 @@ #include "pa_request.h" #include "pa_socks.h" #include "pa_version.h" +#include "pool_storage.h" #ifdef XML #include #endif -//#define DEBUG_POOL_MALLOC +#define DEBUG_POOL_MALLOC // consts @@ -58,13 +59,13 @@ const char **RCSIds[]={ const size_t READ_POST_CHUNK_SIZE=0x400*0x400; // 1M const char *argv0; -Pool pool(0); // global pool [dont describe to doxygen: it confuses it with param names] +Pool_storage pool_storage; +Pool pool(&pool_storage); // global pool [dont describe to doxygen: it confuses it with param names] bool cgi; ///< we were started as CGI? // SAPI -// appends to parser3.log located beside my binary if openable, to stderr otherwize -void SAPI::log(Pool& , const char *fmt, ...) { +static void log(const char *fmt, va_list args) { bool opened; FILE *f=0; @@ -85,15 +86,12 @@ void SAPI::log(Pool& , const char *fmt, const char *stamp=ctime(&t); fprintf(f, "[%.*s] ", strlen(stamp)-1, stamp); // message - va_list args; - va_start(args,fmt); char buf[MAX_STRING]; size_t size=vsnprintf(buf, MAX_STRING, fmt, args); remove_crlf(buf, buf+size); fwrite(buf, size, 1, f); - va_end(args); // newline fprintf(f, "\n"); @@ -103,6 +101,23 @@ void SAPI::log(Pool& , const char *fmt, fflush(f); } +// appends to parser3.log located beside my binary if openable, to stderr otherwize +void SAPI::log(Pool& , const char *fmt, ...) { + va_list args; + va_start(args,fmt); + ::log(fmt, args); + va_end(args); +} + +void SAPI::die(const char *fmt, ...) { + va_list args; + va_start(args,fmt); + ::log(fmt, args); + va_end(args); + + exit(1); +} + const char *SAPI::get_env(Pool& , const char *name) { return getenv(name); } @@ -308,7 +323,7 @@ void real_parser_handler( void call_real_parser_handler__do_SEH( const char *filespec_to_process, const char *request_method, bool header_only) { -#ifdef WIN32 +#if _MSC_VER & !defined(_DEBUG) LPEXCEPTION_POINTERS system_exception=0; __try { #endif @@ -316,7 +331,7 @@ void call_real_parser_handler__do_SEH( filespec_to_process, request_method, header_only); -#if _MSC_VER +#if _MSC_VER & !defined(_DEBUG) } __except ( (system_exception=GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) {