--- parser3/src/targets/cgi/parser3.C 2003/03/18 15:14:20 1.216.2.30.2.1 +++ parser3/src/targets/cgi/parser3.C 2003/03/31 08:35:45 1.216.2.30.2.14 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_PARSER3_C="$Date: 2003/03/18 15:14:20 $"; +static const char* IDENT_PARSER3_C="$Date: 2003/03/31 08:35:45 $"; #include "pa_config_includes.h" @@ -44,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] @@ -175,14 +174,14 @@ void SAPI::abort(const char* fmt, ...) { va_end(args); } -char* SAPI::get_envSAPI_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; @@ -206,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 @@ -291,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); @@ -310,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)); @@ -334,9 +330,9 @@ static void real_parser_handler( request_info.uri=env_request_uri; else if(query_string) { - const char* 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); @@ -395,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 */); @@ -500,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 } @@ -532,6 +528,21 @@ static void usage(const char* program) { } int main(int argc, char *argv[]) { + GC_java_finalization=0; + +#ifndef PA_DEBUG_DISABLE_GC +// GC_dont_gc=1; // Dont collect unless explicitly requested +#endif + + /* + Array test; + test+=3; + test+=4; +// int a=test.count(); + int b=test.get(0); +// int b=test.get(10); + printf("%d", b);//test.count());*/ + #ifdef SIGUSR1 if(signal(SIGUSR1, SIGUSR1_handler)==SIG_ERR) SAPI::die("Can not set handler for SIGUSR1"); @@ -618,7 +629,7 @@ int main(int argc, char *argv[]) { // Set flag to the new value _CrtSetDbgFlag( tmpFlag ); - _CrtSetBreakAlloc(62143); //147302 + //_CrtSetBreakAlloc(62143); //147302 _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );