From bcc70585913b51a7b6b6443bbe2a8d1965067abd Mon Sep 17 00:00:00 2001 From: winsdominoes Date: Mon, 3 Jun 2024 16:36:45 +0700 Subject: [PATCH] stuff --- src/server.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/server.c b/src/server.c index 49c7362..08f643e 100644 --- a/src/server.c +++ b/src/server.c @@ -116,10 +116,15 @@ int main() { send_response(client_sock_fd, NOT_FOUND_HEAD, "text/html", NULL, 0); } - - - // int body_size = snprintf(body, 100, "%s\r\n", "hello what up bruh"); - send_response(client_sock_fd, OK_HEAD, "text/html", body, (body_size + 1)); + fseek(file, 0, SEEK_END); + unsigned long file_size = ftell(file); + fseek(file, 0, SEEK_SET); + + printf("Size of File: %ld\n", file_size); + + send_response(client_sock_fd, OK_HEAD, "text/html", file, file_size); + + fclose(file); } close(client_sock_fd);