Skip to content

Commit 38fdc4b

Browse files
Alex HultmanAlex Hultman
Alex Hultman
authored and
Alex Hultman
committed
Minimal error pages for UWS_HTTPRESPONSE_NO_WRITEMARK use
1 parent 973a975 commit 38fdc4b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/HttpErrors.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ enum HttpError {
2929
HTTP_ERROR_404_FILE_NOT_FOUND = 4
3030
};
3131

32+
#ifndef UWS_HTTPRESPONSE_NO_WRITEMARK
33+
3234
/* Returned parser errors match this LUT. */
3335
static const std::string_view httpErrorResponses[] = {
3436
"", /* Zeroth place is no error so don't use it */
@@ -37,6 +39,18 @@ static const std::string_view httpErrorResponses[] = {
3739
"HTTP/1.1 400 Bad Request\r\n\r\n<h1>Bad Request</h1><hr><i>uWebSockets/20 Server</i>",
3840
"HTTP/1.1 404 File Not Found\r\n\r\n<h1>File Not Found</h1><hr><i>uWebSockets/20 Server</i>"
3941
};
42+
43+
#else
44+
/* Anonymized pages */
45+
static const std::string_view httpErrorResponses[] = {
46+
"", /* Zeroth place is no error so don't use it */
47+
"HTTP/1.1 505 HTTP Version Not Supported\r\n\r\n",
48+
"HTTP/1.1 431 Request Header Fields Too Large\r\n\r\n",
49+
"HTTP/1.1 400 Bad Request\r\n\r\n",
50+
"HTTP/1.1 404 File Not Found\r\n\r\n"
51+
};
52+
#endif
53+
4054
}
4155

4256
#endif

0 commit comments

Comments
 (0)