summaryrefslogtreecommitdiff
path: root/src/http.c
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-07-09 15:39:51 -0300
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-07-09 16:04:33 -0300
commit3c36d76be739b6975fac4e6adee3b91002056db1 (patch)
tree82f26ce27c21cca23367b3b40849e710216ab8b2 /src/http.c
parent7a388dad85152a203033c14fee3c64607301865a (diff)
server.c: a basic multithreaded server to handle connectionsHEADmain
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'src/http.c')
-rw-r--r--src/http.c5
1 files changed, 1 insertions, 4 deletions
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);