From 3c36d76be739b6975fac4e6adee3b91002056db1 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Sun, 9 Jul 2023 15:39:51 -0300 Subject: server.c: a basic multithreaded server to handle connections Signed-off-by: Anna (navi) Figueiredo Gomes --- src/http.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/http.c') diff --git a/src/http.c b/src/http.c index 793f257..99204ec 100644 --- a/src/http.c +++ b/src/http.c @@ -97,10 +97,7 @@ static enum parse_result parse_request(struct request *req, const char *request) line = strtok_r(copy, "\r\n", &saveptr); - path = malloc(strlen(line) + 1); - req->method = malloc(strlen(line) + 1); - - if (sscanf(line, "%s %s HTTP/%s", req->method, path, req->http_version) != 3) { + if (sscanf(line, "%ms %ms HTTP/%s", &req->method, &path, req->http_version) != 3) { free(copy); free(path); free(req->method); -- cgit v1.2.3