aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspl3g <spleefer6@yandex.ru>2025-03-22 11:15:56 +0300
committerspl3g <spleefer6@yandex.ru>2025-03-22 11:18:20 +0300
commit30f20deb48f690767d7a1222b362d415835150a1 (patch)
tree42fce4824f831fce3c260c29cfc63a3dc06910c0
parent4e34793b58c1bbb1ecf1687672601dc12cbfcac2 (diff)
Simplify the check_handler function
-rw-r--r--lib/http.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/http.c b/lib/http.c
index 06a25e8..57e2199 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -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;