fix lifetime of http server, add /version

This commit is contained in:
Lion Kortlepel
2022-05-23 23:16:53 +02:00
parent 48bb1373e1
commit 5598d75fd5
3 changed files with 36 additions and 12 deletions

View File

@@ -17,6 +17,10 @@
namespace fs = std::filesystem;
class TServer;
class TNetwork;
class TResourceManager;
namespace Http {
std::string GET(const std::string& host, int port, const std::string& target, unsigned int* status = nullptr);
std::string POST(const std::string& host, int port, const std::string& target, const std::string& body, const std::string& ContentType, unsigned int* status = nullptr, const httplib::Headers& headers = {});
@@ -28,7 +32,8 @@ const std::string ErrorString = "-1";
namespace Server {
class THttpServerInstance {
public:
THttpServerInstance();
THttpServerInstance(TServer&, TNetwork&, TResourceManager&);
~THttpServerInstance();
static fs::path KeyFilePath;
static fs::path CertFilePath;
@@ -37,6 +42,9 @@ namespace Server {
private:
std::thread mThread;
TServer& mServer;
TNetwork& mNetwork;
TResourceManager& mResourceManager;
};
}
}