From 1a478196bc2ca3050828a31e666245068ce0246f Mon Sep 17 00:00:00 2001 From: Francesco Date: Fri, 16 Jan 2026 03:33:15 +0100 Subject: [PATCH] refactor: remove some prints --- src/core/worker.c | 8 +++++++- src/http/handler.c | 2 -- src/main.c | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/worker.c b/src/core/worker.c index 9a16eec..963a96b 100644 --- a/src/core/worker.c +++ b/src/core/worker.c @@ -55,7 +55,11 @@ static cws_return worker_handle_client_data(int epfd, int client_fd) { } /* Configure handler */ - cws_handler_config_s config = {.root_dir = "www", .index_file = "index.html"}; + /* TODO: use vhosts */ + cws_handler_config_s config = { + .root_dir = "www", + .index_file = "index.html", + }; /* Handle request and generate response */ cws_response_s *response = cws_handler_static_file(request, &config); @@ -68,6 +72,8 @@ static cws_return worker_handle_client_data(int epfd, int client_fd) { /* Cleanup */ cws_http_free(request); + + /* TODO: check Connection: keep-alive */ worker_close_client(epfd, client_fd); return CWS_OK; diff --git a/src/http/handler.c b/src/http/handler.c index 11d653d..136cca5 100644 --- a/src/http/handler.c +++ b/src/http/handler.c @@ -36,8 +36,6 @@ cws_response_s *cws_handler_static_file(cws_request_s *request, cws_handler_conf string_s *filepath = resolve_file_path(string_cstr(request->path), config); const char *path = string_cstr(filepath); - cws_log_debug("Resolved path: %s", path); - if (!file_exists(path)) { string_free(filepath); return cws_handler_not_found(request); diff --git a/src/main.c b/src/main.c index d3b7d6d..31b4fea 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ void cws_signal_handler(int signo) { int main(void) { cws_log_init(); - cws_log_info("Running cws..."); + cws_log_debug("Starting cws"); if (signal(SIGINT, cws_signal_handler) == SIG_ERR) { cws_log_error("signal()"); @@ -23,7 +23,6 @@ int main(void) { cws_config_s *config = cws_config_init(); if (!config) { - cws_log_error("Unable to read config file"); cws_log_shutdown(); return EXIT_FAILURE; }