aboutsummaryrefslogtreecommitdiff
path: root/src/routing.c
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-08-08 00:37:44 -0400
committerfrosty <gabriel@bwaaa.monster>2026-08-08 00:37:44 -0400
commitb6951c18912c82e7863ebd6c6c77b891ad9aea0c (patch)
tree7e7e067b93b4df878f000ec4a272334a81aba85f /src/routing.c
parent42fe6caf63acdd25e5674d91c13a9ab15f948b7f (diff)
downloadbeaker-b6951c18912c82e7863ebd6c6c77b891ad9aea0c.tar.gz
fix: centralise empty HTTP status responses
Diffstat (limited to 'src/routing.c')
-rw-r--r--src/routing.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/routing.c b/src/routing.c
index 55a6599..00886c8 100644
--- a/src/routing.c
+++ b/src/routing.c
@@ -265,9 +265,7 @@ bool serve_static_file_with_mime(const char *request_path_relative_to_static, co
request_path_relative_to_static[0] == '/') {
fprintf(stderr, "[SECURITY] Attempted directory traversal: %s\n",
request_path_relative_to_static);
- const char *forbidden_response =
- "HTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\n\r\n";
- send(current_client_socket, forbidden_response, strlen(forbidden_response), 0);
+ send_status("403 Forbidden");
return true;
}
@@ -289,9 +287,7 @@ bool serve_static_file_with_mime(const char *request_path_relative_to_static, co
fprintf(stderr, "[ERROR] serve_static_file_with_mime: fstat failed for '%s'.\n",
full_static_path);
fclose(fp);
- const char *server_error_response =
- "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n";
- send(current_client_socket, server_error_response, strlen(server_error_response), 0);
+ send_status("500 Internal Server Error");
return true;
}