diff options
Diffstat (limited to 'src/routing.c')
| -rw-r--r-- | src/routing.c | 8 |
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; } |
