fix http parser and config

This commit is contained in:
2025-05-08 16:58:42 +02:00
parent 8e880f59be
commit 8ff2bb608c
11 changed files with 50 additions and 35 deletions

View File

@@ -12,18 +12,21 @@ void cws_signal_handler(int signo) { cws_server_run = false; }
int main(int argc, char **argv) {
int ret;
struct sigaction act = {.sa_handler = cws_signal_handler};
ret = sigaction(SIGINT, &act, NULL);
if (!ret) {
CWS_LOG_ERROR("sigaction()");
return 1;
}
cws_config *config = cws_config_init();
if (config == NULL) {
CWS_LOG_ERROR("Unable to read config file");
return 1;
}
struct sigaction act = {.sa_handler = cws_signal_handler};
ret = sigaction(SIGINT, &act, NULL);
CWS_LOG_INFO("Running cws on http://%s:%s...", config->host, config->port);
ret = cws_server_start(config->host, config->port);
CWS_LOG_INFO("Running cws on http://%s:%s...", config->hostname, config->port);
ret = cws_server_start(config);
if (ret < 0) {
CWS_LOG_ERROR("Unable to start web server");
}