--- parser3/src/targets/cgi/parser3.C 2003/03/13 12:34:21 1.216.2.29 +++ parser3/src/targets/cgi/parser3.C 2003/03/26 07:45:24 1.216.2.30.2.7 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_PARSER3_C="$Date: 2003/03/13 12:34:21 $"; +static const char* IDENT_PARSER3_C="$Date: 2003/03/26 07:45:24 $"; #include "pa_config_includes.h" @@ -20,6 +20,8 @@ static const char* IDENT_PARSER3_C="$Dat #include "pa_socks.h" #include "pa_version.h" + + #ifdef WIN32 # include # include "getopt.h" @@ -42,7 +44,6 @@ static const char* argv0; static const char* config_filespec_cstr=0; static bool fail_on_config_read_problem=true; -static bool force_header_output=false; static bool cgi; ///< we were started as CGI? static bool mail_received=false; ///< we were started with -m option? [asked to parse incoming message to $mail:received] @@ -115,7 +116,7 @@ void SAPI::log(SAPI_Info&, const char* f static void die_or_abort(const char* fmt, va_list args, bool write_core) { //_asm int 3; #ifdef DEBUG_POOL_MALLOC - extern void log_pool_stats(Pool& pool); + extern void log_pool_stats(); log_pool_stats(SAPI_info); #endif @@ -173,14 +174,14 @@ void SAPI::abort(const char* fmt, ...) { va_end(args); } -char* SAPI::get_env(Pool& pool, SAPI_Info& , const char* name) { +char* SAPI::get_env(SAPI_Info& , const char* name) { if(char *local=getenv(name)) - return pool.copy(local); + return pa_strdup(local); else return 0; } -const char* const *SAPI::environment(SAPI_Info&, Pool&) { +const char* const *SAPI::environment(SAPI_Info&) { #ifdef _MSC_VER extern char **_environ; return _environ; @@ -204,13 +205,13 @@ size_t SAPI::read_post(SAPI_Info& , char } void SAPI::add_header_attribute(SAPI_Info& , const char* dont_store_key, const char* dont_store_value) { - if(cgi || force_header_output) + if(cgi) printf("%s: %s\n", dont_store_key, dont_store_value); } /// @todo intelligent cache-control void SAPI::send_header(SAPI_Info& ) { - if(cgi || force_header_output) { + if(cgi) { // puts("expires: Fri, 23 Mar 2001 09:32:23 GMT"); // header | body delimiter @@ -289,9 +290,6 @@ static void real_parser_handler( // init global variables pa_globals_init(); - // request pool, must be different ptr from global [used in VStateless_class.add_method] - Pool request_pool; - if(!filespec_to_process || !*filespec_to_process) SAPI::die("Parser/%s", PARSER_VERSION); @@ -308,7 +306,7 @@ static void real_parser_handler( request_info.document_root=document_root_buf; } else throw Exception("parser.runtime", - Exception::undefined_source, + 0, "CGI: no PATH_INFO defined(in reinventing DOCUMENT_ROOT)"); } else { full_file_spec("", document_root_buf, sizeof(document_root_buf)); @@ -332,9 +330,9 @@ static void real_parser_handler( request_info.uri=env_request_uri; else if(query_string) { - CharPtr reconstructed_uri(new char[ + char* reconstructed_uri=new(PointerFreeGC) char[ strlen(path_info)+1/*'?'*/+ - strlen(query_string)+1/*0*/]); + strlen(query_string)+1/*0*/]; strcpy(reconstructed_uri, path_info); strcat(reconstructed_uri, "?"); strcat(reconstructed_uri, query_string); @@ -393,12 +391,12 @@ static void real_parser_handler( SAPI::die("Execution canceled"); // prepare to process request - Request request(request_pool, SAPI_info, + Request request(SAPI_info, request_info, /*#ifdef _DEBUG - String::UL_HTML|String::UL_OPTIMIZE_BIT + String::L_HTML|String::L_OPTIMIZE_BIT #else*/ - cgi ? String::UL_HTML|String::UL_OPTIMIZE_BIT : String::UL_AS_IS + cgi ? String::Language(String::L_HTML|String::L_OPTIMIZE_BIT) : String::L_AS_IS /*#endif*/ , true /* status_allowed */); @@ -444,7 +442,7 @@ static void real_parser_handler( pa_done_socks(); #ifdef DEBUG_POOL_MALLOC - extern void log_pool_stats(Pool& pool); + extern void log_pool_stats(); log_pool_stats(request_pool); #endif } @@ -498,16 +496,16 @@ static void call_real_parser_handler__do if(executed.with_system_exception) if(executed.system_exception) if(_EXCEPTION_RECORD *er=executed.system_exception->ExceptionRecord) - throw Exception(Exception::undefined_type, - Exception::undefined_source, + throw Exception(0, + 0, "Exception 0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress); else - throw Exception(Exception::undefined_type, - Exception::undefined_source, + throw Exception(0, + 0, "Exception "); else - throw Exception(Exception::undefined_type, - Exception::undefined_source, + throw Exception(0, + 0, "Exception "); #endif } @@ -616,7 +614,10 @@ int main(int argc, char *argv[]) { // Set flag to the new value _CrtSetDbgFlag( tmpFlag ); - _CrtSetBreakAlloc(43829); //147302 + //_CrtSetBreakAlloc(62143); //147302 + + _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); #endif char filespec_to_process[MAX_STRING];