--- parser3/src/include/pa_sapi.h 2023/09/26 20:49:07 1.38 +++ parser3/src/include/pa_sapi.h 2024/11/10 00:28:42 1.41 @@ -1,14 +1,14 @@ /** @file Parser: web server api interface object decl. - Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) Authors: Konstantin Morshnev , Alexandr Petrosian */ #ifndef PA_SAPI_H #define PA_SAPI_H -#define IDENT_PA_SAPI_H "$Id: pa_sapi.h,v 1.38 2023/09/26 20:49:07 moko Exp $" +#define IDENT_PA_SAPI_H "$Id: pa_sapi.h,v 1.41 2024/11/10 00:28:42 moko Exp $" // includes @@ -30,17 +30,13 @@ struct SAPI { /// add response header attribute [but do not send it to client] static void add_header_attribute(SAPI_Info& info, const char* dont_store_key, const char* dont_store_value); /// send collected header attributes to client - static void send_header(SAPI_Info& info); + static void send_headers(SAPI_Info& info); + /// clear collected header attributes + static void clear_headers(SAPI_Info& info); /// output body bytes static size_t send_body(SAPI_Info& info, const void *buf, size_t size); - - static void send_error(SAPI_Info& info, const char *exception_cstr, const char *status = "500"){ - // 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_header(info); - send_body(info, exception_cstr, strlen(exception_cstr)); - } + // send error to client + static void send_error(SAPI_Info& info, const char *exception_cstr, const char *status = "500"); class Env { public: