--- parser3/src/targets/cgi/parser3.C 2001/04/28 08:44:09 1.73 +++ parser3/src/targets/cgi/parser3.C 2001/08/24 09:26:11 1.95 @@ -4,9 +4,8 @@ Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: parser3.C,v 1.73 2001/04/28 08:44:09 paf Exp $ */ +static const char *RCSId="$Id: parser3.C,v 1.95 2001/08/24 09:26:11 parser Exp $"; #include "pa_config_includes.h" @@ -15,12 +14,15 @@ #endif #include "pa_sapi.h" -#include "pa_common.h" #include "classes.h" +#include "pa_common.h" #include "pa_request.h" #include "pa_socks.h" #include "pa_version.h" +//#define DEBUG_POOL_MALLOC + + /// IIS refuses to read bigger chunks const size_t READ_POST_CHUNK_SIZE=0x400*0x400; // 1M @@ -49,7 +51,8 @@ static LONG WINAPI TopLevelExceptionFilt #endif // SAPI -// appends to parser3.log located beside my binary + +// appends to parser3.log located beside my binary if openable, to stderr otherwize void SAPI::log(Pool& pool, const char *fmt, ...) { bool opened; FILE *f=0; @@ -80,6 +83,8 @@ void SAPI::log(Pool& pool, const char *f if(opened) fclose(f); + else + fflush(f); } const char *SAPI::get_env(Pool& pool, const char *name) { @@ -251,7 +256,7 @@ int main(int argc, char *argv[]) { // prepare to process request Request request(pool, request_info, - cgi ? String::UL_HTML_TYPO : String::UL_AS_IS + cgi ? String::UL_USER_HTML : String::UL_AS_IS ); // some root-controlled location @@ -266,8 +271,13 @@ int main(int argc, char *argv[]) { // beside by binary static char site_auto_path[MAX_STRING]; - strncpy(site_auto_path, argv[0], MAX_STRING); // filespec of my binary - rsplit(site_auto_path, '/'); rsplit(site_auto_path, '\\');// strip filename + strncpy(site_auto_path, argv0, MAX_STRING); // filespec of my binary + if(!( + rsplit(site_auto_path, '/') || + rsplit(site_auto_path, '\\'))) { // strip filename + // no path, just filename + site_auto_path[0]='.'; site_auto_path[1]=0; + } // process the request request.core( @@ -278,6 +288,11 @@ int main(int argc, char *argv[]) { // done_socks(); +#ifdef DEBUG_POOL_MALLOC + extern void log_pool_stats(Pool& pool); + log_pool_stats(pool); +#endif + // must be last in PTRY{}PCATCH #ifdef WIN32 SetUnhandledExceptionFilter(0); @@ -317,4 +332,7 @@ int main(int argc, char *argv[]) { return 1; } PEND_CATCH + + if(!cgi) + SAPI::send_body(pool, "\n", 1); }