--- parser3/src/targets/isapi/parser3isapi.C 2024/11/04 03:53:25 1.129 +++ parser3/src/targets/isapi/parser3isapi.C 2024/11/10 00:28:42 1.131 @@ -5,7 +5,7 @@ Authors: Konstantin Morshnev , Alexandr Petrosian */ -volatile const char * IDENT_PARSER3ISAPI_C="$Id: parser3isapi.C,v 1.129 2024/11/04 03:53:25 moko Exp $"; +volatile const char * IDENT_PARSER3ISAPI_C="$Id: parser3isapi.C,v 1.131 2024/11/10 00:28:42 moko Exp $"; #ifndef _MSC_VER # error compile ISAPI module with MSVC [no urge for now to make it autoconf-ed (PAF)] @@ -99,6 +99,14 @@ void SAPI::die(const char* fmt, ...) { // va_end(args); } +void SAPI::send_error(SAPI_Info& info, const char *exception_cstr, const char *status){ + // capitalized headers passed for preventing malloc during capitalization + add_header_attribute(info, HTTP_STATUS_CAPITALIZED, status); + add_header_attribute(info, HTTP_CONTENT_TYPE_CAPITALIZED, "text/plain"); + send_headers(info); + send_body(info, exception_cstr, strlen(exception_cstr)); +} + char* SAPI::Env::get(SAPI_Info& SAPI_info, const char* name) { char *variable_buf=new(PointerFreeGC) char[MAX_STRING]; DWORD variable_len = MAX_STRING-1; @@ -206,7 +214,7 @@ void SAPI::add_header_attribute(SAPI_Inf } /// @todo intelligent cache-control -void SAPI::send_header(SAPI_Info& SAPI_info) { +void SAPI::send_headers(SAPI_Info& SAPI_info) { HSE_SEND_HEADER_EX_INFO header_info; char status_buf[MAX_STATUS_LENGTH]; @@ -238,6 +246,10 @@ void SAPI::send_header(SAPI_Info& SAPI_i HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL); } +void SAPI::clear_headers(SAPI_Info& info) { + SAPI_info.header.clear(); +} + size_t SAPI::send_body(SAPI_Info& SAPI_info, const void *buf, size_t size) { DWORD num_bytes=size; if(!SAPI_info.lpECB->WriteClient(SAPI_info.lpECB->ConnID,