Removed the middleware stack from Request.

This commit is contained in:
Relintai 2022-01-08 12:27:42 +01:00
parent ec2eabacc1
commit 15b9bb17e5
2 changed files with 0 additions and 22 deletions

View File

@ -79,21 +79,6 @@ void Request::compile_and_send_body() {
send(); 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() { void Request::send() {
// if (connection_closed) { // if (connection_closed) {
// RequestPool::return_request(this); // RequestPool::return_request(this);
@ -114,8 +99,6 @@ void Request::send_error(int error_code) {
void Request::reset() { void Request::reset() {
session = nullptr; session = nullptr;
server = nullptr; server = nullptr;
current_middleware_index = 0;
middleware_stack = nullptr;
_path_stack.clear(); _path_stack.clear();
_path_stack_pointer = 0; _path_stack_pointer = 0;
file_size = 0; file_size = 0;

View File

@ -23,10 +23,6 @@ class Request {
public: public:
WebServer *server; WebServer *server;
uint32_t current_middleware_index;
HandlerInstance handler_instance;
std::vector<HandlerInstance> *middleware_stack;
String head; String head;
String body; String body;
String footer; 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 send_redirect(const String &location, const HTTPStatusCode status_code = HTTP_STATUS_CODE_302_FOUND);
virtual void compile_body(); virtual void compile_body();
virtual void compile_and_send_body(); virtual void compile_and_send_body();
virtual void next_stage();
virtual void send(); virtual void send();
virtual void send_file(const String &p_file_path); virtual void send_file(const String &p_file_path);
virtual void send_error(int error_code); virtual void send_error(int error_code);