add a 422 Header status - Unprocessable Entity

This commit is contained in:
Tomasz Sowa 2023-11-08 17:59:40 +01:00
parent bcde5c628a
commit a54d70bed4
Signed by: tomasz.sowa
GPG Key ID: 662CC1438638588B
2 changed files with 16 additions and 13 deletions

View File

@ -950,7 +950,7 @@ void App::Start()
log << log2 << "App: requests queue exceeded limit of " << config.request_queue_job_limit log << log2 << "App: requests queue exceeded limit of " << config.request_queue_job_limit
<< " requests (skipping this request)" << logend; << " requests (skipping this request)" << logend;
cur.request->http_status = Header::status_503_service_unavailale; cur.request->http_status = Header::status_503_service_unavailable;
cur.request->FinishRequest(); cur.request->FinishRequest();
do_process_request = false; do_process_request = false;

View File

@ -50,18 +50,18 @@ public:
* headers' names * headers' names
*/ */
static constexpr const wchar_t * content_type = L"Content-Type"; static constexpr const wchar_t * content_type = L"Content-Type";
static constexpr const wchar_t * accept = L"Accept"; static constexpr const wchar_t * accept = L"Accept";
static constexpr const wchar_t * accept_language = L"Accept-Language"; static constexpr const wchar_t * accept_language = L"Accept-Language";
static constexpr const wchar_t * authorization = L"Authorization"; static constexpr const wchar_t * authorization = L"Authorization";
static constexpr const wchar_t * allow = L"Allow"; static constexpr const wchar_t * allow = L"Allow";
static constexpr const wchar_t * very = L"Very"; static constexpr const wchar_t * very = L"Very";
static constexpr const wchar_t * origin = L"Origin"; static constexpr const wchar_t * origin = L"Origin";
static constexpr const wchar_t * access_control_allow_methods = L"Access-Control-Allow-Methods"; static constexpr const wchar_t * access_control_allow_methods = L"Access-Control-Allow-Methods";
static constexpr const wchar_t * access_control_allow_origin = L"Access-Control-Allow-Origin"; static constexpr const wchar_t * access_control_allow_origin = L"Access-Control-Allow-Origin";
static constexpr const wchar_t * access_control_allow_headers = L"Access-Control-Allow-Headers"; static constexpr const wchar_t * access_control_allow_headers = L"Access-Control-Allow-Headers";
static constexpr const wchar_t * access_control_allow_credentials = L"Access-Control-Allow-Credentials"; static constexpr const wchar_t * access_control_allow_credentials = L"Access-Control-Allow-Credentials";
static constexpr const wchar_t * access_control_expose_headers = L"Access-Control-Expose-Headers"; static constexpr const wchar_t * access_control_expose_headers = L"Access-Control-Expose-Headers";
static constexpr const wchar_t * access_control_max_age = L"Access-Control-Max-Age"; static constexpr const wchar_t * access_control_max_age = L"Access-Control-Max-Age";
/* /*
* headers' names lower case * headers' names lower case
@ -77,15 +77,15 @@ public:
static constexpr const wchar_t * text_html = L"text/html"; static constexpr const wchar_t * text_html = L"text/html";
static constexpr const wchar_t * application_json = L"application/json"; static constexpr const wchar_t * application_json = L"application/json";
static constexpr const wchar_t * application_xml = L"application/xml"; static constexpr const wchar_t * application_xml = L"application/xml";
static constexpr const wchar_t * application_xhtml_xml = L"application/xhtml+xml"; static constexpr const wchar_t * application_xhtml_xml = L"application/xhtml+xml";
static constexpr const wchar_t * text_csv = L"text/csv"; static constexpr const wchar_t * text_csv = L"text/csv";
static constexpr const wchar_t * text_javascript = L"text/javascript"; static constexpr const wchar_t * text_javascript = L"text/javascript";
static constexpr const wchar_t * text_xml = L"text/xml"; static constexpr const wchar_t * text_xml = L"text/xml";
static constexpr const wchar_t * all_all = L"*/*"; static constexpr const wchar_t * all_all = L"*/*";
static constexpr const wchar_t * text_all = L"text/*"; static constexpr const wchar_t * text_all = L"text/*";
static constexpr const wchar_t * application_all = L"application/*"; static constexpr const wchar_t * application_all = L"application/*";
static constexpr const wchar_t * text_html_utf8 = L"text/html; charset=UTF-8"; static constexpr const wchar_t * text_html_utf8 = L"text/html; charset=UTF-8";
static constexpr const wchar_t * application_json_utf8 = L"application/json; charset=UTF-8"; static constexpr const wchar_t * application_json_utf8 = L"application/json; charset=UTF-8";
@ -98,7 +98,7 @@ public:
static constexpr const wchar_t * application_x_www_form_urlencoded = L"application/x-www-form-urlencoded"; static constexpr const wchar_t * application_x_www_form_urlencoded = L"application/x-www-form-urlencoded";
static constexpr const wchar_t * multipart_form_data = L"multipart/form-data"; static constexpr const wchar_t * multipart_form_data = L"multipart/form-data";
static constexpr const wchar_t * bearer = L"Bearer"; static constexpr const wchar_t * bearer = L"Bearer";
static constexpr const wchar_t * winix = L"Winix"; static constexpr const wchar_t * winix = L"Winix";
@ -114,8 +114,9 @@ public:
static const int status_403_forbidden = 403; static const int status_403_forbidden = 403;
static const int status_404_not_found = 404; static const int status_404_not_found = 404;
static const int status_414_uri_too_long = 414; static const int status_414_uri_too_long = 414;
static const int status_422_unprocessable_entity = 422;
static const int status_500_internal_server_error = 500; static const int status_500_internal_server_error = 500;
static const int status_503_service_unavailale = 503; static const int status_503_service_unavailable = 503;
static constexpr const wchar_t * str_status_200 = L"OK"; static constexpr const wchar_t * str_status_200 = L"OK";
@ -130,6 +131,7 @@ public:
static constexpr const wchar_t * str_status_403 = L"Forbidden"; static constexpr const wchar_t * str_status_403 = L"Forbidden";
static constexpr const wchar_t * str_status_404 = L"Not Found"; static constexpr const wchar_t * str_status_404 = L"Not Found";
static constexpr const wchar_t * str_status_414 = L"URI Too Long"; static constexpr const wchar_t * str_status_414 = L"URI Too Long";
static constexpr const wchar_t * str_status_422 = L"Unprocessable Entity";
static constexpr const wchar_t * str_status_500 = L"Internal Server Error"; static constexpr const wchar_t * str_status_500 = L"Internal Server Error";
static constexpr const wchar_t * str_status_503 = L"Service Unavailable"; static constexpr const wchar_t * str_status_503 = L"Service Unavailable";
@ -163,8 +165,9 @@ protected:
{status_403_forbidden, str_status_403}, {status_403_forbidden, str_status_403},
{status_404_not_found, str_status_404}, {status_404_not_found, str_status_404},
{status_414_uri_too_long, str_status_414}, {status_414_uri_too_long, str_status_414},
{status_422_unprocessable_entity, str_status_422},
{status_500_internal_server_error, str_status_500}, {status_500_internal_server_error, str_status_500},
{status_503_service_unavailale, str_status_503}, {status_503_service_unavailable, str_status_503},
}; };
}; };