fix argument mismatches between header and c files

This commit is contained in:
Nayan
2025-05-08 17:13:03 -04:00
parent 451df18af9
commit ddf6f8812f
5 changed files with 8 additions and 7 deletions

View File

@@ -115,7 +115,7 @@ void print_http_response(http_response* res) {
printf("Body:\n%s\n", (res->body == NULL) ? "" : res->body); 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 // Define lengths
int total_length = 0; int total_length = 0;
int len_newline = strlen("\r\n"); int len_newline = strlen("\r\n");

View File

@@ -137,7 +137,7 @@ void print_http_response(http_response* res);
* *
* @return A pointer to the string representation of the response * @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. * Finds the value associated with a given key in an http_request's headers.

View File

@@ -54,7 +54,7 @@ void handle_request(char* request, int length, char* response,
// Create response // Create response
// Create reponse string // Create response string
// char* ptr_temp = response; // char* ptr_temp = response;
// char* temp = // char* temp =
// "HTTP/1.1 200 OK\r\nContent-Type: text/html \r\nContent-Length: " // "HTTP/1.1 200 OK\r\nContent-Type: text/html \r\nContent-Length: "

View File

@@ -61,7 +61,7 @@ void response_build_static_file(char* file_path, content_type content_type,
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
// Read file into buffer // Read file into buffer
unsigned char* file_buffer = (char*)malloc(file_size); char* file_buffer = (char*)malloc(file_size);
if (file_buffer == NULL) { if (file_buffer == NULL) {
printf("malloc failed\n"); printf("malloc failed\n");
serve_500(res); serve_500(res);

View File

@@ -24,10 +24,11 @@ typedef enum {
void response_handle_get(http_request* req, http_response* res); 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 #endif