Add shutting down / shutdown states to state keeper

This commit is contained in:
Lion Kortlepel
2021-12-07 14:25:04 +01:00
parent 3ee83904a1
commit cd19ae0836
9 changed files with 54 additions and 1 deletions

View File

@@ -117,6 +117,15 @@ static std::map<size_t, const char*> Map = {
{ 530, "(CDN) 1XXX Internal Error" },
};
static const char Magic[] = {
0x20, 0x2f, 0x5c, 0x5f,
0x2f, 0x5c, 0x0a, 0x28,
0x20, 0x6f, 0x2e, 0x6f,
0x20, 0x29, 0x0a, 0x20,
0x3e, 0x20, 0x5e, 0x20,
0x3c, 0x0a, 0x00
};
std::string Http::Status::ToString(int Code) {
if (Map.find(Code) != Map.end()) {
return Map.at(Code);
@@ -285,6 +294,11 @@ void Http::Server::THttpServerInstance::operator()() {
res.set_content("0", "text/plain");
res.status = 200;
});
// magic endpoint
HttpLibServerInstance->Get({ 0x2f, 0x6b, 0x69, 0x74, 0x74, 0x79 }, [](const httplib::Request&, httplib::Response& res) {
res.set_content(std::string(Magic), "text/plain");
});
Application::SetSubsystemStatus("HTTPServer", Application::Status::Good);
HttpLibServerInstance->listen("0.0.0.0", Application::Settings.HTTPServerPort);
}