commit c8d13f9ec93bd7bd40c59bff42b17951579eaf74
parent 81d386286ceeaf2f4a031ae4b0fb456bb1cfab5f
Author: Francesco Saccone <francesco@francescosaccone.com>
Date: Mon, 31 Mar 2025 18:19:40 +0200
feat: define normalised_path
Signed-off-by: Francesco Saccone <francesco@francescosaccone.com>
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/main.c b/main.c
@@ -6,6 +6,7 @@
#include <sys/stat.h>
#include <unistd.h>
+#include "file.h"
#include "http.h"
#include "socket.h"
#include "utils.h"
@@ -156,7 +157,8 @@ main(int argc, char *argv[]) {
while (1) {
int client_socket_fd,
buffer_size = 104857600 * sizeof(char); /* i.e. 100 MiB */
- char *buffer = malloc(buffer_size);
+ char *buffer = malloc(buffer_size),
+ *normalised_path;
struct http_request *request;
client_socket_fd = accept_client(server_socket_fd);
@@ -177,6 +179,8 @@ main(int argc, char *argv[]) {
request = parse_http_request(buffer);
+ normalised_path = get_normalised_path(request->path);
+
free(buffer);
close_socket(client_socket_fd);
}