implement GetOSName, start working on HttpsPOST

This commit is contained in:
Lion Kortlepel
2021-06-25 00:42:45 +02:00
parent b1caf5c29a
commit 80432eb718
6 changed files with 125 additions and 33 deletions

View File

@@ -39,6 +39,7 @@ void THeartbeatThread::operator()() {
if (status < 0) {
status = 0;
}
auto Lock = Sentry.CreateExclusiveContext();
Sentry.SetContext("heartbeat",
{ { "response-body", T },
@@ -48,6 +49,7 @@ void THeartbeatThread::operator()() {
Sentry.Log(SentryLevel::Error, "default", Http::Status::ToString(status) + " (" + std::to_string(status) + ")");
};
auto Target = "/heartbeat";
int ResponseCode = -1;
T = Http::POST(Application::GetBackendHostname(), Target, {}, Body, false, &ResponseCode);
@@ -63,6 +65,7 @@ void THeartbeatThread::operator()() {
T = Http::POST(Application::GetBackup2Hostname(), Target, {}, Body, false, &ResponseCode);
if (T.substr(0, 2) != "20" || ResponseCode != 200) {
warn("Backend system refused server! Server will not show in the public server list.");
isAuth = false;
SentryReportError(Application::GetBackup2Hostname() + Target, ResponseCode);
}
@@ -127,4 +130,4 @@ std::string THeartbeatThread::GetPlayers() {
return Return;
}
/*THeartbeatThread::~THeartbeatThread() {
}*/
}*/