/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Route.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/19 14:59:41 by adjoly #+# #+# */ /* Updated: 2025/03/21 11:09:38 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #pragma once #include "cppeleven.hpp" #include "log.hpp" #include "node/ANode.hpp" #include "node/Array.hpp" #include #include #include #include #include #include #include #include namespace webserv { namespace config { int32_t parseSize(std::string size) { if (size[size.size()] == 'M') return std::atoi(size.c_str()) * 1024 * 1024; if (size[size.size()] == 'K') return std::atoi(size.c_str()) * 1024; if (isalpha(size[size.size()])) return std::atoi(size.c_str()); return -1; } class Route { public: Route(std::map *node) { if (node == not_nullptr) throw std::runtime_error("location table does not exist"); } ~Route(void) {} protected: private: bool _dirlist; bool _cookies; bool _uploads; bool _redirect; int32_t _max_body; std::string _root; std::string _upRoot; std::map *_cgi; Logger *_log; bool _methods[3]; // 1: GET, 2: POST, 3: DELETE std::map *_err_pages; }; } // namespace config } // namespace webserv