summaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-19 15:59:07 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-19 15:59:07 +0200
commit40735bb1229ae0369e7d763964ffbe543334b7c9 (patch)
treebc85b49852549edcc3f45f976ce56f65f077a3e3 /plugins
parentb8f80db4ec3a5e586903834f29ec50a265c0c1fa (diff)
Fix CGI i/o
Diffstat (limited to 'plugins')
-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;