summaryrefslogtreecommitdiffhomepage
path: root/plugins/cgi
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/cgi')
-rw-r--r--plugins/cgi/cgi.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/cgi/cgi.cpp b/plugins/cgi/cgi.cpp
index f5147c1..b8c2470 100644
--- a/plugins/cgi/cgi.cpp
+++ b/plugins/cgi/cgi.cpp
@@ -100,6 +100,8 @@ namespace {
{ "CONTENT-TYPE", [](std::string& v, CGIContext& c){ c.SetResponseHeader("content_type", v); } },
+ { "SET-COOKIE", [](std::string& v, CGIContext& c){ c.SetResponseHeader("set_cookie", v); } },
+
{ "STATUS", [](std::string& v, CGIContext& c) {
std::string status{"500"};
if (v.size() >= 3) {
@@ -170,18 +172,17 @@ namespace {
std::string executeFile(const fs::path& filename, CGIContext& context)
{
- bp::opstream is_in;
+ bp::pipe is_in;
bp::ipstream is_out;
- //std::cout << "Executing " << filename << std::endl;
-
bp::environment env {boost::this_process::environment()};
setCGIEnvironment(env, context);
- bp::child child(filename.string(), env, (bp::std_out & bp::std_err) > is_out, bp::std_in < is_in);
+ bp::child child(filename.string(), env, bp::std_out > is_out, bp::std_err > stderr, bp::std_in < is_in);
- is_in << context.GetRequestParam("body");
- //is_in.close();
+ std::string body{ context.GetRequestParam("body") };
+ is_in.write(body.data(), body.size());
+ is_in.close();
std::string output;
std::string line;