Error pages need connection close

This commit is contained in:
Alex Hultman
2023-12-01 10:43:15 +01:00
parent 38fdc4b51f
commit c5aab195bd
+8 -8
View File
@@ -34,20 +34,20 @@ enum HttpError {
/* Returned parser errors match this LUT. */
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<h1>HTTP Version Not Supported</h1><p>This server does not support HTTP/1.0.</p><hr><i>uWebSockets/20 Server</i>",
"HTTP/1.1 431 Request Header Fields Too Large\r\n\r\n<h1>Request Header Fields Too Large</h1><hr><i>uWebSockets/20 Server</i>",
"HTTP/1.1 400 Bad Request\r\n\r\n<h1>Bad Request</h1><hr><i>uWebSockets/20 Server</i>",
"HTTP/1.1 404 File Not Found\r\n\r\n<h1>File Not Found</h1><hr><i>uWebSockets/20 Server</i>"
"HTTP/1.1 505 HTTP Version Not Supported\r\nConnection: close\r\n\r\n<h1>HTTP Version Not Supported</h1><p>This server does not support HTTP/1.0.</p><hr><i>uWebSockets/20 Server</i>",
"HTTP/1.1 431 Request Header Fields Too Large\r\nConnection: close\r\n\r\n<h1>Request Header Fields Too Large</h1><hr><i>uWebSockets/20 Server</i>",
"HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n<h1>Bad Request</h1><hr><i>uWebSockets/20 Server</i>",
"HTTP/1.1 404 File Not Found\r\nConnection: close\r\n\r\n<h1>File Not Found</h1><hr><i>uWebSockets/20 Server</i>"
};
#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"
"HTTP/1.1 505 HTTP Version Not Supported\r\nConnection: close\r\n\r\n",
"HTTP/1.1 431 Request Header Fields Too Large\r\nConnection: close\r\n\r\n",
"HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n",
"HTTP/1.1 404 File Not Found\r\nConnection: close\r\n\r\n"
};
#endif