--- parser3/src/targets/isapi/parser3isapi.C 2001/10/22 16:44:43 1.55 +++ parser3/src/targets/isapi/parser3isapi.C 2002/03/04 10:03:07 1.64 @@ -1,10 +1,10 @@ /** @file Parser: IIS extension. - Copyright (c) 2000,2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + Copyright (c) 2000,2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) - $Id: parser3isapi.C,v 1.55 2001/10/22 16:44:43 parser Exp $ + $Id: parser3isapi.C,v 1.64 2002/03/04 10:03:07 paf Exp $ */ #ifndef _MSC_VER @@ -13,11 +13,6 @@ #include "pa_config_includes.h" -#include -#include - -#include - #include "pa_sapi.h" #include "pa_globals.h" #include "pa_request.h" @@ -25,9 +20,11 @@ #include "pool_storage.h" #include "pa_socks.h" -#ifdef XML -#include -#endif +#include +#include +#include + +#include #define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION") @@ -41,9 +38,6 @@ extern const char *gd_RCSIds[]; extern const char *classes_RCSIds[]; extern const char *types_RCSIds[]; extern const char *parser3isapi_RCSIds[]; -#ifdef XML -extern const char *xalan_patched_RCSIds[]; -#endif const char **RCSIds[]={ main_RCSIds, #ifdef USE_SMTP @@ -53,9 +47,6 @@ const char **RCSIds[]={ classes_RCSIds, types_RCSIds, parser3isapi_RCSIds, -#ifdef XML - xalan_patched_RCSIds, -#endif 0 }; @@ -73,24 +64,6 @@ struct SAPI_func_context { }; #endif -#ifdef XML -/** - * Terminate Xalan and Xerces. - * - * Should be called only once per process after deleting all - * instances of XalanTransformer. Once a process has called - * this function, it cannot use the API for the remaining - * lifetime of the process. - - - this requirement is fullfilled by using Pool::register_cleanup - */ -void callXalanTerminate(void *) { - //_asm int 3; - XalanTerminate(); -} -#endif - // goes to 'cs-uri-query' log file field. webmaster: switch it ON[default OFF]. void SAPI::log(Pool& pool, const char *fmt, ...) { SAPI_func_context& ctx=*static_cast(pool.get_context()); @@ -109,7 +82,7 @@ void SAPI::log(Pool& pool, const char *f } /// @todo event log -void SAPI::die(Pool& pool, const char *fmt, ...) { +void SAPI::die(const char *fmt, ...) { exit(1); } @@ -186,9 +159,6 @@ void SAPI::add_header_attribute(Pool& po void SAPI::send_header(Pool& pool) { SAPI_func_context& ctx=*static_cast(pool.get_context()); - ctx.header->APPEND_CONST( - "expires: Fri, 23 Mar 2001 09:32:23 GMT\r\n" - "\r\n"); HSE_SEND_HEADER_EX_INFO header_info; char status_buf[MAX_STATUS_LENGTH]; @@ -229,29 +199,24 @@ void SAPI::send_body(Pool& pool, const v // +int failed_new(size_t size) { + SAPI::die("out of memory in 'new', failed to allocated %u bytes", size); + return 0; // not reached +} + static bool parser_init() { static bool globals_inited=false; if(globals_inited) return true; globals_inited=true; + _set_new_handler(failed_new); + static Pool pool(0); // global pool try { // init socks init_socks(pool); -#ifdef XML - /** - * Initialize Xerces and Xalan. - * - * Should be called only once per process before making - * any other API calls. - */ - //_asm int 3; - XalanInitialize(); - pool.register_cleanup(callXalanTerminate, 0); -#endif - // init global classes init_methoded_array(pool); // init global variables @@ -334,8 +299,8 @@ void real_parser_handler(Pool& pool, LPE // prepare to process request Request request(pool, request_info, - String::UL_USER_HTML - ); + String::UL_HTML|String::UL_OPTIMIZE_BIT, + false /* status_allowed */); // some root-controlled location // c:\windows @@ -393,19 +358,6 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSI }; pool.set_context(&ctx);// no allocations before this line! -#ifdef XML - /** - * Initialize Xerces and Xalan. - * - * Should be called only once per process before making - * any other API calls. - */ - //_asm int 3; - XalanInitialize(); - pool.register_cleanup(callXalanTerminate, 0); -#endif - - bool header_only=strcasecmp(lpECB->lpszMethod, "HEAD")==0; try { // global try call_real_parser_handler__do_SEH(pool, lpECB, header_only); @@ -448,6 +400,5 @@ DWORD WINAPI HttpExtensionProc(LPEXTENSI // unsuccessful finish } - return HSE_STATUS_SUCCESS_AND_KEEP_CONN; }