--- parser3/src/targets/apache13/Attic/mod_parser3.C 2001/10/19 12:43:30 1.3 +++ parser3/src/targets/apache13/Attic/mod_parser3.C 2001/10/22 16:44:43 1.7 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: mod_parser3.C,v 1.3 2001/10/19 12:43:30 parser Exp $ + $Id: mod_parser3.C,v 1.7 2001/10/22 16:44:43 parser Exp $ */ #include "httpd.h" @@ -141,7 +141,7 @@ static const char *cmd_parser_config(cmd //@{ /// SAPI func decl void SAPI::log(Pool& pool, const char *fmt, ...) { - request_rec *r=static_cast(pool.context()); + request_rec *r=static_cast(pool.get_context()); va_list args; va_start(args,fmt); @@ -152,13 +152,25 @@ void SAPI::log(Pool& pool, const char *f va_end(args); } +void SAPI::die(const char *fmt, ...) { + va_list args; + va_start(args,fmt); + char buf[MAX_STRING]; + size_t size=vsnprintf(buf, MAX_STRING, fmt, args); + remove_crlf(buf, buf+size); + ap_log_error(APLOG_MARK, APLOG_EMERG, 0, "%s", buf); + va_end(args); + + exit(1); +} + const char *SAPI::get_env(Pool& pool, const char *name) { - request_rec *r=static_cast(pool.context()); + request_rec *r=static_cast(pool.get_context()); return (const char *)ap_table_get(r->subprocess_env, name); } size_t SAPI::read_post(Pool& pool, char *buf, size_t max_bytes) { - request_rec *r=static_cast(pool.context()); + request_rec *r=static_cast(pool.get_context()); /* ap_log_error(APLOG_MARK, APLOG_DEBUG, r->server, "mod_parser3: SAPI::read_post(max=%u)", max_bytes); @@ -185,7 +197,7 @@ size_t SAPI::read_post(Pool& pool, char } void SAPI::add_header_attribute(Pool& pool, const char *key, const char *value) { - request_rec *r=static_cast(pool.context()); + request_rec *r=static_cast(pool.get_context()); if(strcasecmp(key, "location")==0) r->status=302; @@ -204,7 +216,7 @@ void SAPI::add_header_attribute(Pool& po } void SAPI::send_header(Pool& pool) { - request_rec *r=static_cast(pool.context()); + request_rec *r=static_cast(pool.get_context()); ap_hard_timeout("Send header", r); ap_send_http_header(r); @@ -212,7 +224,7 @@ void SAPI::send_header(Pool& pool) { } void SAPI::send_body(Pool& pool, const void *buf, size_t size) { - request_rec *r=static_cast(pool.context()); + request_rec *r=static_cast(pool.get_context()); ap_hard_timeout("Send body", r); ap_rwrite(buf, size, r); @@ -259,13 +271,13 @@ static void real_parser_handler(Pool& po } void call_real_parser_handler__do_SEH(Pool& pool, request_rec *r) { -#ifdef WIN32 +#if _MSC_VER & !defined(_DEBUG) LPEXCEPTION_POINTERS system_exception=0; __try { #endif real_parser_handler(pool, r); -#if _MSC_VER +#if _MSC_VER & !defined(_DEBUG) } __except ( (system_exception=GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) { @@ -273,8 +285,8 @@ void call_real_parser_handler__do_SEH(Po if(system_exception) if(_EXCEPTION_RECORD *er=system_exception->ExceptionRecord) throw Exception(0, 0, - 0, - "Exception 0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress); + 0, + "Exception 0x%08X at 0x%08X", er->ExceptionCode, er->ExceptionAddress); else throw Exception(0, 0, 0, "Exception "); else @@ -284,7 +296,7 @@ void call_real_parser_handler__do_SEH(Po } static int parser_handler(request_rec *r) { -// _asm int 3; + //_asm int 3; if(r->finfo.st_mode == 0) return NOT_FOUND; @@ -413,9 +425,7 @@ static void setup_module_cells() { // init global variables pa_globals_init(pool); } catch(const Exception& e) { // global problem - ap_log_error(APLOG_MARK, APLOG_EMERG, 0, - "setup_module_cells failed: ", e.comment()); - exit(1); + SAPI::die("setup_module_cells failed: %s", e.comment()); } }