refactor: remove some prints

This commit is contained in:
2026-01-16 03:33:15 +01:00
parent 4a042315b0
commit 1a478196bc
3 changed files with 8 additions and 5 deletions

View File

@@ -55,7 +55,11 @@ static cws_return worker_handle_client_data(int epfd, int client_fd) {
} }
/* Configure handler */ /* 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 */ /* Handle request and generate response */
cws_response_s *response = cws_handler_static_file(request, &config); 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 */ /* Cleanup */
cws_http_free(request); cws_http_free(request);
/* TODO: check Connection: keep-alive */
worker_close_client(epfd, client_fd); worker_close_client(epfd, client_fd);
return CWS_OK; return CWS_OK;

View File

@@ -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); string_s *filepath = resolve_file_path(string_cstr(request->path), config);
const char *path = string_cstr(filepath); const char *path = string_cstr(filepath);
cws_log_debug("Resolved path: %s", path);
if (!file_exists(path)) { if (!file_exists(path)) {
string_free(filepath); string_free(filepath);
return cws_handler_not_found(request); return cws_handler_not_found(request);

View File

@@ -14,7 +14,7 @@ void cws_signal_handler(int signo) {
int main(void) { int main(void) {
cws_log_init(); cws_log_init();
cws_log_info("Running cws..."); cws_log_debug("Starting cws");
if (signal(SIGINT, cws_signal_handler) == SIG_ERR) { if (signal(SIGINT, cws_signal_handler) == SIG_ERR) {
cws_log_error("signal()"); cws_log_error("signal()");
@@ -23,7 +23,6 @@ int main(void) {
cws_config_s *config = cws_config_init(); cws_config_s *config = cws_config_init();
if (!config) { if (!config) {
cws_log_error("Unable to read config file");
cws_log_shutdown(); cws_log_shutdown();
return EXIT_FAILURE; return EXIT_FAILURE;
} }