summaryrefslogtreecommitdiffhomepage
path: root/tests/test-webserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-webserver.cpp')
-rw-r--r--tests/test-webserver.cpp91
1 files changed, 90 insertions, 1 deletions
diff --git a/tests/test-webserver.cpp b/tests/test-webserver.cpp
index bd89aab..5353c6a 100644
--- a/tests/test-webserver.cpp
+++ b/tests/test-webserver.cpp
@@ -18,6 +18,7 @@
#include <boost/asio/buffers_iterator.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/local/stream_protocol.hpp>
#include <boost/asio/ssl/error.hpp>
#include <boost/asio/ssl/stream.hpp>
#include <boost/property_tree/ptree.hpp>
@@ -48,7 +49,8 @@
#include "webserver.h"
#include "response.h"
-#include "fastcgiprocess.h"
+#include "plugins/fcgi/fastcgiprocess.h"
+
#include "helper.h"
#include "webserverprocess.h"
#include "websocketserverprocess.h"
@@ -694,3 +696,90 @@ BOOST_FIXTURE_TEST_CASE(http_fcgi_ip6, Fixture)
BOOST_CHECK_EQUAL(result.second, "returning data of : ");
}
+BOOST_FIXTURE_TEST_CASE(http_fcgi_unix_socket, Fixture)
+{
+ std::string webserver_config{R"CONFIG(<webserver>
+ <user>www-data</user>
+ <group>www-data</group>
+ <threads>10</threads>
+ <statisticspath>stats.db</statisticspath>
+ <plugin-directory>../plugins</plugin-directory>
+ <sites>
+ <site>
+ <name>localhost</name>
+ <host>localhost</host>
+ <host>[::1]</host>
+ <path requested="/fcgi">
+ <plugin>fcgi</plugin>
+ <target>fcgi-socket</target>
+ </path>
+ </site>
+ </sites>
+ <sockets>
+ <socket>
+ <address>::1</address>
+ <port>8080</port>
+ <protocol>http</protocol>
+ <site>localhost</site>
+ </socket>
+ </sockets>
+</webserver>)CONFIG"};
+ WebserverProcess serverProcess{webserver_config};
+ BOOST_REQUIRE(serverProcess.is_running());
+
+ FastCGIProcess fcgiProcess("./fcgi1", "fcgi-socket");
+ BOOST_REQUIRE(fcgiProcess.is_running());
+
+ auto result {HTTP("/fcgi/abc")};
+ BOOST_CHECK_EQUAL(result.first, fmt::format(
+"HTTP/1.1 200 OK\r\n"
+"Server: Reichwein.IT Webserver {}\r\n"
+"Content-Type: text/plain\r\n"
+"Content-Length: {}\r\n"
+"\r\n"
+ , VERSION, result.second.size()));
+ BOOST_CHECK_EQUAL(result.second, "returning data of : ");
+}
+
+BOOST_FIXTURE_TEST_CASE(http_fcgi_executable, Fixture)
+{
+ std::string webserver_config{R"CONFIG(<webserver>
+ <user>www-data</user>
+ <group>www-data</group>
+ <threads>10</threads>
+ <statisticspath>stats.db</statisticspath>
+ <plugin-directory>../plugins</plugin-directory>
+ <sites>
+ <site>
+ <name>localhost</name>
+ <host>localhost</host>
+ <host>[::1]</host>
+ <path requested="/fcgi">
+ <plugin>fcgi</plugin>
+ <target>fcgi1</target>
+ </path>
+ </site>
+ </sites>
+ <sockets>
+ <socket>
+ <address>::1</address>
+ <port>8080</port>
+ <protocol>http</protocol>
+ <site>localhost</site>
+ </socket>
+ </sockets>
+</webserver>)CONFIG"};
+ WebserverProcess serverProcess{webserver_config};
+ BOOST_REQUIRE(serverProcess.is_running());
+
+ auto result {HTTP("/fcgi/abc")};
+ BOOST_CHECK_EQUAL(result.first, fmt::format(
+"HTTP/1.1 200 OK\r\n"
+"Server: Reichwein.IT Webserver {}\r\n"
+"Content-Type: text/plain\r\n"
+"Content-Length: {}\r\n"
+"\r\n"
+ , VERSION, result.second.size()));
+ BOOST_CHECK_EQUAL(result.second, "returning data of : ");
+}
+