From b77bb246e366d346b55cc8cfb4f1d0ac83211ae7 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 1 May 2020 11:19:21 +0200 Subject: Added fcgi module (WIP) --- plugins/cgi/cgi.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/cgi') diff --git a/plugins/cgi/cgi.cpp b/plugins/cgi/cgi.cpp index 318dd1f..75e401e 100644 --- a/plugins/cgi/cgi.cpp +++ b/plugins/cgi/cgi.cpp @@ -173,7 +173,7 @@ namespace { env["HTTPS"] = c.GetRequestParam("https"); } - std::string executeFile(const fs::path& filename, CGIContext& context) + std::string executeFile(CGIContext& context) { bp::pipe is_in; bp::ipstream is_out; @@ -181,7 +181,7 @@ namespace { bp::environment env {boost::this_process::environment()}; setCGIEnvironment(env, context); - bp::child child(filename.string(), env, bp::std_out > is_out, bp::std_err > stderr, bp::std_in < is_in); + bp::child child(context.path.string(), env, bp::std_out > is_out, bp::std_err > stderr, bp::std_in < is_in); std::string body{ context.GetRequestParam("body") }; is_in.write(body.data(), body.size()); @@ -311,7 +311,7 @@ std::string cgi_plugin::generate_page( CGIContext context(GetServerParam, GetRequestParam, SetResponseHeader, path, file_path, path_info); try { - return executeFile(path, context); + return executeFile(context); } catch (const std::runtime_error& ex) { return HttpStatus("404", "Not found: "s + GetRequestParam("target"), SetResponseHeader); } catch (const std::exception& ex) { -- cgit v1.2.3