--- parser3/src/targets/apache/mod_parser3_core.C 2020/08/13 10:52:34 1.20 +++ parser3/src/targets/apache/mod_parser3_core.C 2020/08/13 13:00:28 1.22 @@ -5,7 +5,7 @@ Parser: apache 1.3/2.X module, part, com Author: Alexandr Petrosian (http://paf.design.ru) */ -volatile const char * IDENT_MOD_PARSER3_CORE_C="$Id: mod_parser3_core.C,v 1.20 2020/08/13 10:52:34 moko Exp $"; +volatile const char * IDENT_MOD_PARSER3_CORE_C="$Id: mod_parser3_core.C,v 1.22 2020/08/13 13:00:28 moko Exp $"; #include "pa_config_includes.h" @@ -37,7 +37,7 @@ void pa_setup_module_cells() { // init libraries pa_globals_init(); } catch(const Exception& e) { // global problem - SAPI::abort("setup_module_cells failed: %s", e.comment()); + SAPI::die("setup_module_cells failed: %s", e.comment()); } } @@ -67,31 +67,15 @@ void SAPI::log(SAPI_Info& SAPI_info, con va_end(args); } -static void die_or_abort(const char* fmt, va_list args, bool write_core) { +void SAPI::die(const char* fmt, ...) { + va_list args; + va_start(args, fmt); char buf[MAX_LOG_STRING]; size_t size=vsnprintf(buf, MAX_LOG_STRING, fmt, args); size=remove_crlf(buf, buf+size); pa_ap_log_error(PA_APLOG_MARK, PA_APLOG_EMERG, 0, "%s", buf); - - // exit & try to produce core dump - if(write_core) - abort(); - else - exit(1); -} - -void SAPI::die(const char* fmt, ...) { - va_list args; - va_start(args, fmt); - die_or_abort(fmt, args, false/*write core?*/); - va_end(args); -} - -void SAPI::abort(const char* fmt, ...) { - va_list args; - va_start(args, fmt); - die_or_abort(fmt, args, true/*write core?*/); - va_end(args); + exit(1); +// va_end(args); } char* SAPI::Env::get(SAPI_Info& SAPI_info, const char* name) { @@ -104,11 +88,13 @@ struct SAPI_environment_append_info { const char** cur; }; #endif + static const char* mk_env_pair(const char* key, const char* value) { char *result=new(PointerFreeGC) char[strlen(key)+1/*=*/+strlen(value)+1/*0*/]; strcpy(result, key); strcat(result, "="); strcat(result, value); return result; } + static int SAPI_environment_append(void *d, const char* k, const char* val) { if( k && val ) { SAPI_environment_append_info& info= @@ -117,6 +103,7 @@ static int SAPI_environment_append(void } return 1/*true*/; } + const char* const* SAPI::Env::get(SAPI_Info& SAPI_info) { const pa_table *t=SAPI_info.r->subprocess_env; const char** result=new const char*[pa_ap_table_size(t)+1/*0*/]; @@ -126,9 +113,8 @@ const char* const* SAPI::Env::get(SAPI_I } size_t SAPI::read_post(SAPI_Info& SAPI_info, char *buf, size_t max_bytes) { -/* pa_ap_log_error(PA_APLOG_MARK, PA_APLOG_DEBUG, SAPI_info.r->server, -"mod_parser3: SAPI::read_post(max=%u)", max_bytes); - */ +// pa_ap_log_error(PA_APLOG_MARK, PA_APLOG_DEBUG, SAPI_info.r->server, "mod_parser3: SAPI::read_post(max=%u)", max_bytes); + int retval; if((retval = pa_ap_setup_client_block(SAPI_info.r, PA_REQUEST_CHUNKED_ERROR))) return 0; @@ -151,8 +137,7 @@ size_t SAPI::read_post(SAPI_Info& SAPI_i } /// @test location provide with protocol. think about internal redirects -void SAPI::add_header_attribute(SAPI_Info& SAPI_info, - const char* dont_store_key, const char* dont_store_value) { +void SAPI::add_header_attribute(SAPI_Info& SAPI_info, const char* dont_store_key, const char* dont_store_value) { if(strcasecmp(dont_store_key, "location")==0) *SAPI_info.r->status=302; @@ -186,15 +171,8 @@ size_t SAPI::send_body(SAPI_Info& SAPI_i //@} -#ifndef PA_DEBUG_DISABLE_GC -#ifndef _MSC_VER -extern long GC_large_alloc_warn_suppressed; -#endif -#endif - /** main workhorse - @todo intelligent cache-control */ static void real_parser_handler(SAPI_Info& SAPI_info, Parser_module_config *dcfg) {