feat: basic http routing

This commit is contained in:
Jef Roosens 2023-05-27 16:42:15 +02:00
parent 8250a5b8b0
commit 7ece0eb4e5
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
4 changed files with 75 additions and 31 deletions

View file

@ -16,15 +16,15 @@ typedef struct http_route {
http_route_type type;
char *path;
regex_t *regex;
size_t step_count;
void (**steps)(event_loop_conn *);
bool (*steps[5])(event_loop_conn *);
} http_route;
/*
* Global context passed to every connection using the same pointer
*/
typedef struct http_loop_gctx {
http_route **routes;
http_route *routes;
size_t route_count;
Trie *trie;
} http_loop_gctx;
@ -58,6 +58,8 @@ void http_loop_ctx_free(http_loop_ctx *ctx);
*/
bool http_loop_handle_request(event_loop_conn *conn);
bool http_loop_route_request(event_loop_conn *conn);
void http_loop_process_request(event_loop_conn *conn);
/**