--- parser3/src/targets/cgi/parser3.C 2024/11/09 15:38:21 1.358 +++ parser3/src/targets/cgi/parser3.C 2024/11/10 12:57:17 1.361 @@ -5,7 +5,7 @@ Authors: Konstantin Morshnev , Alexandr Petrosian */ -volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.358 2024/11/09 15:38:21 moko Exp $"; +volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.361 2024/11/10 12:57:17 moko Exp $"; #include "pa_config_includes.h" @@ -192,10 +192,14 @@ void SAPI::add_header_attribute(SAPI_Inf info.add_header(dont_store_key, dont_store_value); } -void SAPI::send_header(SAPI_Info& info) { +void SAPI::send_headers(SAPI_Info& info) { info.send_headers(); } +void SAPI::clear_headers(SAPI_Info& info) { + info.clear_headers(); +} + size_t SAPI::send_body(SAPI_Info& info, const void *buf, size_t size) { return info.send_body(buf, size); } @@ -384,7 +388,7 @@ static void connection_handler(SAPI_Info Request r(info, request_info, String::Language(String::L_HTML|String::L_OPTIMIZE_BIT)); // process the request r.core(config_filespec, strcasecmp(request_info.method, "HEAD")==0, main_method_name, &httpd_class_name); - } catch(const Exception& e) { // exception in connection handling or unhandled exception + } catch(const Exception& e) { // exception in connection handling SAPI::log(info, "%s", e.comment()); const char* status = info.exception_http_status(e.type()); if(*status) @@ -729,8 +733,9 @@ int main(int argc, char *argv[]) { } REAL_PARSER_HANDLER(cgi); - } catch(const Exception& e) { // exception in unhandled exception - SAPI::die("%s", e.comment()); + } catch(const Exception& e) { // exception in config_handler + SAPI::log(*sapi_info, "%s", e.comment()); + SAPI::send_error(*sapi_info, e.comment(), strcmp(e.type(), "file.missing") ? "500" : "404"); } #ifdef PA_DEBUG_CGI_ENTRY_EXIT