From 2ef8197a75c3d7605279b6c41c2eb3e1643d5374 Mon Sep 17 00:00:00 2001 From: cflip Date: Mon, 19 Sep 2022 13:47:51 -0600 Subject: Refactor the CGIScript class a bit This allows the user of the class to set environment variables before opening the pipe to the script. --- src/CGIScript.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/CGIScript.h') diff --git a/src/CGIScript.h b/src/CGIScript.h index a64c55a..622206d 100644 --- a/src/CGIScript.h +++ b/src/CGIScript.h @@ -4,19 +4,18 @@ #include #include -#include "HttpRequest.h" - class CGIScript { public: - CGIScript(const std::string& path, const HttpRequest&); + CGIScript(const std::string& script_path); ~CGIScript(); void set_environment(const char* key, const char* value); - bool is_open() const { return m_is_open; } + bool open(); std::string read_output(); private: FILE* m_pipe; + const std::string& m_script_path; bool m_is_open{false}; std::vector m_environment_variables; -- cgit v1.2.3