2023-05-25 12:01:20 +02:00
|
|
|
#ifndef HTTP
|
|
|
|
#define HTTP
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2023-05-25 22:58:00 +02:00
|
|
|
#include "picohttpparser.h"
|
|
|
|
|
|
|
|
#include "event_loop.h"
|
|
|
|
#include "http_req.h"
|
|
|
|
|
2023-05-25 12:01:20 +02:00
|
|
|
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_parse_error {
|
|
|
|
http_parse_error_ok = 0,
|
|
|
|
http_parse_error_incomplete = 1,
|
|
|
|
http_parse_error_invalid = 2,
|
|
|
|
} http_parse_error;
|
|
|
|
|
2023-05-25 14:28:53 +02:00
|
|
|
http_parse_error http_parse_request(http_request *req, const char *path,
|
|
|
|
size_t path_len);
|
2023-05-25 12:01:20 +02:00
|
|
|
|
2023-05-25 22:58:00 +02:00
|
|
|
void http_route(event_loop_conn *conn);
|
|
|
|
|
2023-05-25 12:01:20 +02:00
|
|
|
#endif
|