From 15b9bb17e55bef918b2242ee61acf8916fc509f3 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 8 Jan 2022 12:27:42 +0100 Subject: [PATCH] Removed the middleware stack from Request. --- core/http/request.cpp | 17 ----------------- core/http/request.h | 5 ----- 2 files changed, 22 deletions(-) diff --git a/core/http/request.cpp b/core/http/request.cpp index 97635ad..678466d 100644 --- a/core/http/request.cpp +++ b/core/http/request.cpp @@ -79,21 +79,6 @@ void Request::compile_and_send_body() { send(); } -void Request::next_stage() { - // if (middleware_stack == nullptr) { - // printf("Error Request::next_stage-> middleware_stack == nullptr\n"); - // } - - if (current_middleware_index == (*middleware_stack).size()) { - handler_instance.handler_func(handler_instance.instance, this); - return; - } - - const HandlerInstance &hi = (*middleware_stack)[current_middleware_index++]; - - hi.handler_func(hi.instance, this); -} - void Request::send() { // if (connection_closed) { // RequestPool::return_request(this); @@ -114,8 +99,6 @@ void Request::send_error(int error_code) { void Request::reset() { session = nullptr; server = nullptr; - current_middleware_index = 0; - middleware_stack = nullptr; _path_stack.clear(); _path_stack_pointer = 0; file_size = 0; diff --git a/core/http/request.h b/core/http/request.h index 6edae9f..32d508a 100644 --- a/core/http/request.h +++ b/core/http/request.h @@ -23,10 +23,6 @@ class Request { public: WebServer *server; - uint32_t current_middleware_index; - HandlerInstance handler_instance; - std::vector *middleware_stack; - String head; String body; String footer; @@ -60,7 +56,6 @@ public: virtual void send_redirect(const String &location, const HTTPStatusCode status_code = HTTP_STATUS_CODE_302_FOUND); virtual void compile_body(); virtual void compile_and_send_body(); - virtual void next_stage(); virtual void send(); virtual void send_file(const String &p_file_path); virtual void send_error(int error_code);