Skip to content

Commit c5aab19

Browse files
Alex HultmanAlex Hultman
authored andcommitted
Error pages need connection close
1 parent 38fdc4b commit c5aab19

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/HttpErrors.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ enum HttpError {
3434
/* Returned parser errors match this LUT. */
3535
static const std::string_view httpErrorResponses[] = {
3636
"", /* Zeroth place is no error so don't use it */
37-
"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>",
38-
"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>",
39-
"HTTP/1.1 400 Bad Request\r\n\r\n<h1>Bad Request</h1><hr><i>uWebSockets/20 Server</i>",
40-
"HTTP/1.1 404 File Not Found\r\n\r\n<h1>File Not Found</h1><hr><i>uWebSockets/20 Server</i>"
37+
"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>",
38+
"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>",
39+
"HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n<h1>Bad Request</h1><hr><i>uWebSockets/20 Server</i>",
40+
"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>"
4141
};
4242

4343
#else
4444
/* Anonymized pages */
4545
static const std::string_view httpErrorResponses[] = {
4646
"", /* 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"
47+
"HTTP/1.1 505 HTTP Version Not Supported\r\nConnection: close\r\n\r\n",
48+
"HTTP/1.1 431 Request Header Fields Too Large\r\nConnection: close\r\n\r\n",
49+
"HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n",
50+
"HTTP/1.1 404 File Not Found\r\nConnection: close\r\n\r\n"
5151
};
5252
#endif
5353

0 commit comments

Comments
 (0)