diff options
| author | spl3g <spleefer6@yandex.ru> | 2025-03-22 11:15:56 +0300 |
|---|---|---|
| committer | spl3g <spleefer6@yandex.ru> | 2025-03-22 11:18:20 +0300 |
| commit | 30f20deb48f690767d7a1222b362d415835150a1 (patch) | |
| tree | 42fce4824f831fce3c260c29cfc63a3dc06910c0 | |
| parent | 4e34793b58c1bbb1ecf1687672601dc12cbfcac2 (diff) | |
Simplify the check_handler function
| -rw-r--r-- | lib/http.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -437,7 +437,10 @@ int parse_request(arena *arena, size_t inc_fd, struct request *req) { return 0; } -bool check_handler(handler hand, struct request req, arena* arena, context *ctx) { +bool check_handler(handler hand, struct request req) { + arena *arena = req.arena; + context *ctx = req.ctx; + const_string handler_path = hand.path; const_string req_path = req.path; if (!(cs_eq(hand.method, req.method) || @@ -507,7 +510,7 @@ void *process_request(void *args) { if (!resp.sent) { for (size_t i = 0; i < serv.handlers.len; i++) { struct handler handler = serv.handlers.data[i]; - if (check_handler(handler, req, &req_arena, &req_context)) { + if (check_handler(handler, req)) { if (serv.global_middleware != NULL) { g_mid->end->next = handler.middleware; g_mid->end->handler = handler.func; |
