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);