switched over to logging

This commit is contained in:
Nayan
2025-05-08 21:23:07 -04:00
parent 6468cc8d55
commit e956ef0681
7 changed files with 68 additions and 91 deletions

View File

@@ -6,8 +6,39 @@
#include <sys/types.h>
#include "http_stuff.h"
#include "logging.h"
#include "response_builder.h"
/**
* Handles a given HTTP request and writes the appropriate response into the
* given http_response struct.
*
* @param request The request to handle
* @param length The length of the request
* @param response The response to write to
*
* @details
* This function will parse the given request into an http_request struct using
* parse_http_request, handle the request using one of the response_handle_*
* functions, and then write the response back into the given http_response
* struct. Finally, it will free the http_request struct.
*/
void handle_request(char* request, int length, http_response* response);
/**
* Parse a given HTTP request into a struct http_request.
*
* @param request The HTTP request to parse
* @param length The length of the request
* @param req The struct to populate with the parsed request
*
* @return void
*
* @details
* This function will parse the given HTTP request into the req struct. This
* includes extracting the request type, URL, headers, and body. It will also
* autofill the content metadata based on the headers.
*/
void parse_http_request(char* request, int length, struct http_request* req);
#endif