aboutsummaryrefslogtreecommitdiff
path: root/zenutil
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-04-24 15:48:55 +0200
committerGitHub <[email protected]>2023-04-24 15:48:55 +0200
commit1a345a720f728438d0884c3ade4aa37d5c994701 (patch)
tree8c06d8142b9774913c5de8a661080c25e1e74b6c /zenutil
parent0.2.5-pre4 (diff)
downloadzen-1a345a720f728438d0884c3ade4aa37d5c994701.tar.xz
zen-1a345a720f728438d0884c3ade4aa37d5c994701.zip
fixed dashboard file serving bug (#255)
a recent change which introduced support for specifying accept: implicitly via the file extension in the URI caused fallout in the dashboard which would fail to serve any content because the extension was stripped from the RelativeUri accessor. This change fixes that by retaining a copy of the Uri string view which includes the suffix additionally, in order to test this change with both asio/http.sys paths I made the path used for all tests configurable in zenserver-test which involved pulling in a change from sb/proto which makes testing configuration a bit more flexible
Diffstat (limited to 'zenutil')
-rw-r--r--zenutil/include/zenutil/zenserverprocess.h14
-rw-r--r--zenutil/zenserverprocess.cpp24
2 files changed, 31 insertions, 7 deletions
diff --git a/zenutil/include/zenutil/zenserverprocess.h b/zenutil/include/zenutil/zenserverprocess.h
index 3ec4b19b0..1c204c144 100644
--- a/zenutil/include/zenutil/zenserverprocess.h
+++ b/zenutil/include/zenutil/zenserverprocess.h
@@ -20,19 +20,21 @@ public:
~ZenServerEnvironment();
void Initialize(std::filesystem::path ProgramBaseDir);
- void InitializeForTest(std::filesystem::path ProgramBaseDir, std::filesystem::path TestBaseDir);
+ void InitializeForTest(std::filesystem::path ProgramBaseDir, std::filesystem::path TestBaseDir, std::string_view ServerClass = "");
- std::filesystem::path CreateNewTestDir();
- std::filesystem::path ProgramBaseDir() const { return m_ProgramBaseDir; }
- std::filesystem::path GetTestRootDir(std::string_view Path);
- inline bool IsInitialized() const { return m_IsInitialized; }
- inline bool IsTestEnvironment() const { return m_IsTestInstance; }
+ std::filesystem::path CreateNewTestDir();
+ std::filesystem::path ProgramBaseDir() const { return m_ProgramBaseDir; }
+ std::filesystem::path GetTestRootDir(std::string_view Path);
+ inline bool IsInitialized() const { return m_IsInitialized; }
+ inline bool IsTestEnvironment() const { return m_IsTestInstance; }
+ inline std::string_view GetServerClass() const { return m_ServerClass; }
private:
std::filesystem::path m_ProgramBaseDir;
std::filesystem::path m_TestBaseDir;
bool m_IsInitialized = false;
bool m_IsTestInstance = false;
+ std::string m_ServerClass;
};
struct ZenServerInstance
diff --git a/zenutil/zenserverprocess.cpp b/zenutil/zenserverprocess.cpp
index 659eb665b..5ecde343b 100644
--- a/zenutil/zenserverprocess.cpp
+++ b/zenutil/zenserverprocess.cpp
@@ -397,8 +397,12 @@ ZenServerEnvironment::Initialize(std::filesystem::path ProgramBaseDir)
}
void
-ZenServerEnvironment::InitializeForTest(std::filesystem::path ProgramBaseDir, std::filesystem::path TestBaseDir)
+ZenServerEnvironment::InitializeForTest(std::filesystem::path ProgramBaseDir,
+ std::filesystem::path TestBaseDir,
+ std::string_view ServerClass)
{
+ using namespace std::literals;
+
m_ProgramBaseDir = ProgramBaseDir;
m_TestBaseDir = TestBaseDir;
@@ -408,6 +412,19 @@ ZenServerEnvironment::InitializeForTest(std::filesystem::path ProgramBaseDir, st
m_IsTestInstance = true;
m_IsInitialized = true;
+
+ if (ServerClass.empty())
+ {
+#if ZEN_WITH_HTTPSYS
+ m_ServerClass = "httpsys"sv;
+#else
+ m_ServerClass = "asio"sv;
+#endif
+ }
+ else
+ {
+ m_ServerClass = ServerClass;
+ }
}
std::filesystem::path
@@ -516,6 +533,11 @@ ZenServerInstance::SpawnServer(int BasePort, std::string_view AdditionalServerAr
CommandLine << " --child-id " << ChildEventName;
+ if (std::string_view ServerClass = m_Env.GetServerClass(); ServerClass.empty() == false)
+ {
+ CommandLine << " --http " << ServerClass;
+ }
+
if (BasePort)
{
CommandLine << " --port " << BasePort;