--- parser3/src/targets/cgi/parser3.C 2001/05/15 11:36:15 1.78 +++ parser3/src/targets/cgi/parser3.C 2001/05/24 09:29:52 1.90 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: parser3.C,v 1.78 2001/05/15 11:36:15 parser Exp $ + $Id: parser3.C,v 1.90 2001/05/24 09:29:52 parser Exp $ */ #include "pa_config_includes.h" @@ -21,6 +21,9 @@ #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 +52,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 +84,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 +257,7 @@ int main(int argc, char *argv[]) { // prepare to process request Request request(pool, request_info, - cgi ? String::UL_USER_HTML : String::UL_AS_IS + cgi||1 ? String::UL_USER_HTML : String::UL_AS_IS ); // some root-controlled location @@ -266,8 +272,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,8 +289,10 @@ 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