From b715de1eb6f937b0a05d91842041a54455946061 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 30 May 2020 22:40:52 +0200 Subject: Bugfixes: write timeout and output size --- plugins/fcgi/fcgi.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'plugins/fcgi') diff --git a/plugins/fcgi/fcgi.cpp b/plugins/fcgi/fcgi.cpp index 22a4d40..0d845a6 100644 --- a/plugins/fcgi/fcgi.cpp +++ b/plugins/fcgi/fcgi.cpp @@ -453,7 +453,6 @@ std::string fcgi_plugin::fcgiQuery(FCGIContext& context) } std::istringstream is_out{output_data}; - std::string output; std::string line; // TODO: C++20 coroutine @@ -469,25 +468,19 @@ std::string fcgi_plugin::fcgiQuery(FCGIContext& context) // read empty line if (!isEmpty(line)) throw std::runtime_error("Missing empty line between CGI header and body"); - if (in) - in(); - // read remainder - while (in) { - line = in.get(); - output += line + '\n'; + if (in) in(); - } - - throw std::runtime_error("Input missing on processing CGI body"); }); do { std::getline(is_out, line); processLine(line); - } while (!is_out.eof()); + } while (!is_out.eof() && !isEmpty(line)); + + std::string r = output_data.substr(is_out.tellg()); - return output; + return r; } std::string fcgi_plugin::name() -- cgit v1.2.3