feat: start of http part of server
This commit is contained in:
parent
6d45ec59dc
commit
c58e53eb2a
7 changed files with 91 additions and 29 deletions
39
include/http.h
Normal file
39
include/http.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef HTTP
|
||||
#define HTTP
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
extern const char http_404[];
|
||||
extern const size_t http_404_len;
|
||||
extern const char http_500[];
|
||||
extern const size_t http_500_len;
|
||||
|
||||
typedef enum http_request_entity {
|
||||
event_loop_request_type_unknown = 0
|
||||
} http_request_entity;
|
||||
|
||||
typedef enum http_request_method {
|
||||
http_request_method_get = 0,
|
||||
http_request_method_post = 1,
|
||||
http_request_method_put = 2,
|
||||
http_request_method_patch = 3,
|
||||
http_request_method_delete = 4
|
||||
} http_request_method;
|
||||
|
||||
/*
|
||||
* Struct representing the specific type of request
|
||||
*/
|
||||
typedef struct http_request {
|
||||
http_request_method type;
|
||||
http_request_entity entity;
|
||||
} http_request;
|
||||
|
||||
typedef enum http_parse_error {
|
||||
http_parse_error_ok = 0,
|
||||
http_parse_error_incomplete = 1,
|
||||
http_parse_error_invalid = 2,
|
||||
} http_parse_error;
|
||||
|
||||
http_parse_error http_parse_request(http_request *req, const char *path, size_t path_len);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue