mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 15:26:59 +00:00
@jimkoen This was removed because, as useful and as much work as this was, we can't reasonably take responsibility for this. Instead, a server like this should *always* be localhost only, and if it's not, it should be behind an nginx reverse proxy anyways. We're removing the config options regarding this in one of the next commits.
43 lines
1.0 KiB
C++
43 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <Common.h>
|
|
#include <IThreaded.h>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
#if defined(BEAMMP_LINUX)
|
|
#pragma GCC diagnostic push
|
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
|
#endif
|
|
#include <httplib.h>
|
|
#if defined(BEAMMP_LINUX)
|
|
#pragma GCC diagnostic pop
|
|
#endif
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
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 = {});
|
|
namespace Status {
|
|
std::string ToString(int code);
|
|
}
|
|
const std::string ErrorString = "-1";
|
|
|
|
namespace Server {
|
|
class THttpServerInstance {
|
|
public:
|
|
THttpServerInstance();
|
|
static fs::path KeyFilePath;
|
|
static fs::path CertFilePath;
|
|
|
|
protected:
|
|
void operator()();
|
|
|
|
private:
|
|
std::thread mThread;
|
|
};
|
|
}
|
|
}
|