diff --git a/src/http.c b/src/http.c
index ceccbcd..3d77df8 100644
--- a/src/http.c
+++ b/src/http.c
@@ -39,16 +39,21 @@ const char *c_simple_http_response_code_error_to_response(
enum C_SIMPLE_HTTP_ResponseCode response_code) {
switch (response_code) {
case C_SIMPLE_HTTP_Response_400_Bad_Request:
- return "HTTP/1.1 400 Bad Request\nAllow: GET\nContent-Type: text/html\n"
+ return "HTTP/1.1 400 Bad Request\nAllow: GET\n"
+ "Connection: close\n"
+ "Content-Type: text/html\n"
"Content-Length: 25\n\n"
"
400 Bad Request
\n";
case C_SIMPLE_HTTP_Response_404_Not_Found:
- return "HTTP/1.1 404 Not Found\nAllow: GET\nContent-Type: text/html\n"
+ return "HTTP/1.1 404 Not Found\nAllow: GET\n"
+ "Connection: close\n"
+ "Content-Type: text/html\n"
"Content-Length: 23\n\n"
"404 Not Found
\n";
case C_SIMPLE_HTTP_Response_500_Internal_Server_Error:
default:
return "HTTP/1.1 500 Internal Server Error\nAllow: GET\n"
+ "Connection: close\n"
"Content-Type: text/html\n"
"Content-Length: 35\n\n"
"500 Internal Server Error
\n";
diff --git a/src/main.c b/src/main.c
index 035c24d..7c65510 100644
--- a/src/main.c
+++ b/src/main.c
@@ -363,6 +363,7 @@ int main(int argc, char **argv) {
if (response && response_code == C_SIMPLE_HTTP_Response_200_OK) {
CHECK_ERROR_WRITE(write(connection_fd, "HTTP/1.1 200 OK\n", 16));
CHECK_ERROR_WRITE(write(connection_fd, "Allow: GET\n", 11));
+ CHECK_ERROR_WRITE(write(connection_fd, "Connection: close\n", 18));
CHECK_ERROR_WRITE(write(
connection_fd, "Content-Type: text/html\n", 24));
char content_length_buf[128];
@@ -400,6 +401,7 @@ int main(int argc, char **argv) {
CHECK_ERROR_WRITE(write(
connection_fd, "HTTP/1.1 500 Internal Server Error\n", 35));
CHECK_ERROR_WRITE(write(connection_fd, "Allow: GET\n", 11));
+ CHECK_ERROR_WRITE(write(connection_fd, "Connection: close\n", 18));
CHECK_ERROR_WRITE(write(
connection_fd, "Content-Type: text/html\n", 24));
CHECK_ERROR_WRITE(write(connection_fd, "Content-Length: 35\n", 19));