From ddf6f8812fe44decd84a78a6404abeb3fe40f4b4 Mon Sep 17 00:00:00 2001 From: Nayan <33187059+GShadow5@users.noreply.github.com> Date: Thu, 8 May 2025 17:13:03 -0400 Subject: [PATCH] fix argument mismatches between header and c files --- http_stuff.c | 2 +- http_stuff.h | 2 +- request_handler.c | 2 +- response_builder.c | 2 +- response_builder.h | 7 ++++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/http_stuff.c b/http_stuff.c index 44c2d78..6f3665f 100644 --- a/http_stuff.c +++ b/http_stuff.c @@ -115,7 +115,7 @@ void print_http_response(http_response* res) { printf("Body:\n%s\n", (res->body == NULL) ? "" : res->body); } -char* reponse_to_string(http_response* res) { +char* response_to_string(http_response* res) { // Define lengths int total_length = 0; int len_newline = strlen("\r\n"); diff --git a/http_stuff.h b/http_stuff.h index 022f3b5..600be75 100644 --- a/http_stuff.h +++ b/http_stuff.h @@ -137,7 +137,7 @@ void print_http_response(http_response* res); * * @return A pointer to the string representation of the response */ -char* reponse_to_string(http_response* res); +char* response_to_string(http_response* res); /** * Finds the value associated with a given key in an http_request's headers. diff --git a/request_handler.c b/request_handler.c index 95c5647..5f25650 100644 --- a/request_handler.c +++ b/request_handler.c @@ -54,7 +54,7 @@ void handle_request(char* request, int length, char* response, // Create response - // Create reponse string + // Create response string // char* ptr_temp = response; // char* temp = // "HTTP/1.1 200 OK\r\nContent-Type: text/html \r\nContent-Length: " diff --git a/response_builder.c b/response_builder.c index 51613fb..c508baa 100644 --- a/response_builder.c +++ b/response_builder.c @@ -61,7 +61,7 @@ void response_build_static_file(char* file_path, content_type content_type, fseek(file, 0, SEEK_SET); // Read file into buffer - unsigned char* file_buffer = (char*)malloc(file_size); + char* file_buffer = (char*)malloc(file_size); if (file_buffer == NULL) { printf("malloc failed\n"); serve_500(res); diff --git a/response_builder.h b/response_builder.h index 37ba448..11d7391 100644 --- a/response_builder.h +++ b/response_builder.h @@ -24,10 +24,11 @@ typedef enum { void response_handle_get(http_request* req, http_response* res); -char* response_to_string(http_response* res); +void response_build_static_file(char* file_path, content_type content_type, + status_code status_code, http_response* res); -void response_build_static_file(http_request* req, http_response* res); +void serve_404(http_response* res); -void serve_404(http_request* req, http_response* res); +void serve_500(http_response* res); #endif \ No newline at end of file