refactor(worker): change func signatures

This commit is contained in:
2025-09-12 21:44:38 +02:00
parent 15a0f0290b
commit 1b574da06e
7 changed files with 42 additions and 39 deletions

View File

@@ -35,8 +35,8 @@ static int cws_http_parse_method(cws_http_s *request, const char *method) {
return -1;
}
cws_http_s *cws_http_parse(string_s *request_str, int sockfd, cws_config_s *config) {
if (!request_str || !config) {
cws_http_s *cws_http_parse(string_s *request_str, int sockfd) {
if (!request_str) {
return NULL;
}
@@ -47,9 +47,6 @@ cws_http_s *cws_http_parse(string_s *request_str, int sockfd, cws_config_s *conf
}
request->sockfd = sockfd;
/* Prepare the virtual_host struct */
// TODO: cws_virtual_host vhost;
char *request_str_cpy = strdup(string_cstr(request_str));
if (!request_str_cpy) {
free(request);
@@ -61,6 +58,7 @@ cws_http_s *cws_http_parse(string_s *request_str, int sockfd, cws_config_s *conf
char *pch = NULL;
/* Parse HTTP method */
// TODO: fix strtok_r
pch = strtok_r(request_str_cpy, " ", &saveptr);
if (pch == NULL) {
cws_http_free(request);