From 491e246f65ddb4ec7d0e810f47b7db537be4c382 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 6 Jan 2022 19:06:37 +0100 Subject: Bugfix for CGI: Process read --- debian/changelog | 6 ++++++ plugins/cgi/cgi.cpp | 3 +-- webserver.conf | 8 ++++++++ webserver.cpp | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index ad2e1f2..e755901 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +webserver (1.16~pre1) UNRELEASED; urgency=medium + + * Support CGIT via CGI + + -- Roland Reichwein Thu, 06 Jan 2022 18:51:52 +0100 + webserver (1.15) unstable; urgency=medium * Improve MIME handling diff --git a/plugins/cgi/cgi.cpp b/plugins/cgi/cgi.cpp index 131855e..b2af9fa 100644 --- a/plugins/cgi/cgi.cpp +++ b/plugins/cgi/cgi.cpp @@ -157,7 +157,6 @@ namespace { std::string output; std::string line; - // TODO: C++20 coroutine coro_t::push_type processLine( [&](coro_t::pull_type& in){ std::string line; // read header lines @@ -183,7 +182,7 @@ namespace { throw std::runtime_error("Input missing on processing CGI body"); }); - while (child.running() && std::getline(is_out, line)) { + while (std::getline(is_out, line) && !is_out.eof()) { processLine(line); } diff --git a/webserver.conf b/webserver.conf index 5e97cd2..81da39b 100644 --- a/webserver.conf +++ b/webserver.conf @@ -115,6 +115,14 @@ cgi /home/ernie/code/webserver/cgi-bin + + cgi + /usr/lib/cgit/cgit.cgi + + + static-files + /usr/share/cgit + /home/ernie/code/webserver/cert.pem /home/ernie/code/webserver/key.pem diff --git a/webserver.cpp b/webserver.cpp index c832ec8..e848fd1 100644 --- a/webserver.cpp +++ b/webserver.cpp @@ -15,7 +15,7 @@ void usage() std::cout << " webserver [-c ] - start server with specified configuration\n" " file or default /etc/webserver.conf" << std::endl; std::cout << " webserver -p - encrypt password for basic HTTP AUTH,\n" - " suitable for config file" << std::endl; + " suitable for config file, and exit" << std::endl; } void initlocale() { -- cgit v1.2.3