From 38fdc4b51f255120d294b5595ab96275e37217da Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Thu, 30 Nov 2023 18:59:53 +0100 Subject: [PATCH] Minimal error pages for UWS_HTTPRESPONSE_NO_WRITEMARK use --- src/HttpErrors.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/HttpErrors.h b/src/HttpErrors.h index 580e5bc..d1ff96e 100644 --- a/src/HttpErrors.h +++ b/src/HttpErrors.h @@ -29,6 +29,8 @@ enum HttpError { HTTP_ERROR_404_FILE_NOT_FOUND = 4 }; +#ifndef UWS_HTTPRESPONSE_NO_WRITEMARK + /* Returned parser errors match this LUT. */ static const std::string_view httpErrorResponses[] = { "", /* Zeroth place is no error so don't use it */ @@ -37,6 +39,18 @@ static const std::string_view httpErrorResponses[] = { "HTTP/1.1 400 Bad Request\r\n\r\n

Bad Request


uWebSockets/20 Server", "HTTP/1.1 404 File Not Found\r\n\r\n

File Not Found


uWebSockets/20 Server" }; + +#else +/* Anonymized pages */ +static const std::string_view httpErrorResponses[] = { + "", /* Zeroth place is no error so don't use it */ + "HTTP/1.1 505 HTTP Version Not Supported\r\n\r\n", + "HTTP/1.1 431 Request Header Fields Too Large\r\n\r\n", + "HTTP/1.1 400 Bad Request\r\n\r\n", + "HTTP/1.1 404 File Not Found\r\n\r\n" +}; +#endif + } #endif \ No newline at end of file