/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Cgi.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gadelbes +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/24 13:46:34 by gadelbes #+# #+# */ /* Updated: 2025/05/16 12:26:18 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #pragma once #include "server/AResource.hpp" #include #include #include #include #include namespace webserv { class Cgi : public server::AClientResource { public: Cgi(http::ARequest *, config::Route *); ~Cgi(void); std::string getEnv(std::string &); void setEnv(const std::string, std::string); void process(void); protected: private: void _initEnvp(void); /** * @brief Can be used to convert the _envp to a char** usable in execve * * @return A newly allocated char** with the env from _envp */ char **_genEnv(void); std::string _script_path; // The full path of the script to be executed std::string _cgi_path; std::map _envp; // The envp filled with _initEnvp config::Route *_conf; // The configuration for the route used http::ARequest *_request; // The requests that will be used for the cgi }; }; // namespace webserv