40 lines
903 B
C
40 lines
903 B
C
|
#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
|