--- parser3/src/targets/isapi/parser3isapi.C 2019/12/25 22:22:07 1.112 +++ parser3/src/targets/isapi/parser3isapi.C 2020/10/10 06:08:38 1.115 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -volatile const char * IDENT_PARSER3ISAPI_C="$Id: parser3isapi.C,v 1.112 2019/12/25 22:22:07 moko Exp $"; +volatile const char * IDENT_PARSER3ISAPI_C="$Id: parser3isapi.C,v 1.115 2020/10/10 06:08:38 moko Exp $"; #ifndef _MSC_VER # error compile ISAPI module with MSVC [no urge for now to make it autoconf-ed (PAF)] @@ -83,30 +83,19 @@ void SAPI::log(SAPI_Info& SAPI_info, con DWORD size=vsnprintf(start, MAX_LOG_STRING-strlen(prefix), fmt, args); size=remove_crlf(start, start+size); - SAPI_info.lpECB->ServerSupportFunction(SAPI_info.lpECB->ConnID, - HSE_APPEND_LOG_PARAMETER, buf, &size, 0); + SAPI_info.lpECB->ServerSupportFunction(SAPI_info.lpECB->ConnID, HSE_APPEND_LOG_PARAMETER, buf, &size, 0); } /// @todo event log -static void abort(const char* fmt, va_list args) { +void SAPI::die(const char* fmt, ...) { + va_list args; + va_start(args, fmt); if(FILE *log=fopen("c:\\parser3die.log", "at")) { vfprintf(log, fmt, args); fclose(log); } - // exit & try to produce core dump + // abnormal exit abort(); -} -void SAPI::die(const char* fmt, ...) { - va_list args; - va_start(args, fmt); - ::abort(fmt, args); -// va_end(args); -} - -void SAPI::abort(const char* fmt, ...) { - va_list args; - va_start(args, fmt); - ::abort(fmt, args); // va_end(args); } @@ -212,7 +201,7 @@ void SAPI::add_header_attribute(SAPI_Inf SAPI_info.http_response_code=302; if(strcasecmp(dont_store_key, HTTP_STATUS)==0) - SAPI_info.http_response_code=atoi(dont_store_value); + SAPI_info.http_response_code=pa_atoi(dont_store_value); else (*SAPI_info.header) << capitalize(dont_store_key) << ": " << pa_strdup(dont_store_value) << "\r\n"; } @@ -386,10 +375,7 @@ void real_parser_handler(SAPI_Info& SAPI } #ifdef PA_SUPPRESS_SYSTEM_EXCEPTION -static const Exception -call_real_parser_handler__do_PEH_return_it( - SAPI_Info& SAPI_info, bool header_only) -{ +static const Exception call_real_parser_handler__do_PEH_return_it(SAPI_Info& SAPI_info, bool header_only) { try { real_parser_handler(SAPI_info, header_only); } catch(const Exception& e) { @@ -398,33 +384,21 @@ call_real_parser_handler__do_PEH_return_ return Exception(); } -static void call_real_parser_handler__supress_system_exception( - SAPI_Info& SAPI_info, bool header_only) -{ + +static void call_real_parser_handler__supress_system_exception(SAPI_Info& SAPI_info, bool header_only) { Exception parser_exception; LPEXCEPTION_POINTERS system_exception=0; __try { - parser_exception=call_real_parser_handler__do_PEH_return_it( - SAPI_info, header_only); - } __except ( - (system_exception=GetExceptionInformation()), - EXCEPTION_EXECUTE_HANDLER) - { - + parser_exception=call_real_parser_handler__do_PEH_return_it(SAPI_info, header_only); + } __except ( (system_exception=GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) { if(system_exception) if(_EXCEPTION_RECORD *er=system_exception->ExceptionRecord) - throw Exception("system", - 0, - "0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress); + throw Exception("system", 0, "0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress); else - throw Exception("system", - 0, - ""); + throw Exception("system", 0, ""); else - throw Exception("system", - 0, - ""); + throw Exception("system", 0, ""); } if(parser_exception)