feat: declared http functions that will be available later and fixed a header typo inside logs.c
This commit is contained in:
parent
5e609624a0
commit
ce61a21dad
3 changed files with 41 additions and 1 deletions
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "http.h"
|
||||||
|
|
||||||
|
struct http_request *parse_request(struct string *req)
|
||||||
|
{}
|
||||||
|
|
||||||
|
struct http_response *generate_response(struct http_request *req)
|
||||||
|
{}
|
||||||
|
|
||||||
|
struct string *format_response(struct http_response *resp)
|
||||||
|
{}
|
||||||
|
|
@ -45,5 +45,35 @@ struct http_response
|
||||||
struct http_header *headers; // Headers linked list
|
struct http_header *headers; // Headers linked list
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// === Functions
|
||||||
|
|
||||||
|
/* @brief Parses the HTTP request and splits it into a request structure
|
||||||
|
*
|
||||||
|
* @params req
|
||||||
|
*
|
||||||
|
* @return A pointer to the structure containing the request infos on success,
|
||||||
|
* NULL otherwise
|
||||||
|
*/
|
||||||
|
struct http_request* parse_request(struct string* req);
|
||||||
|
|
||||||
|
/* @brief Generates a response to the given request
|
||||||
|
*
|
||||||
|
* @params req
|
||||||
|
*
|
||||||
|
* @return A pointer to the generated response struct on success,
|
||||||
|
* NULL otherwise
|
||||||
|
*/
|
||||||
|
struct http_response* generate_response(struct http_request* req);
|
||||||
|
|
||||||
|
/* @brief Formats the given response structure into a valid HTTP response
|
||||||
|
* string
|
||||||
|
*
|
||||||
|
* @params resp
|
||||||
|
*
|
||||||
|
* @return A pointer to the string containing the response on success,
|
||||||
|
* NULL otherwise
|
||||||
|
*/
|
||||||
|
struct string* format_response(struct http_response* resp);
|
||||||
|
|
||||||
|
|
||||||
#endif // ! HTTP_H
|
#endif // ! HTTP_H
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "../utils/fmt_time/fmt_time.h"
|
#include "../utils/time/fmt_time.h"
|
||||||
|
|
||||||
// === Static variables
|
// === Static variables
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue