mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 23:46:59 +00:00
add --skip-ssl-verify cli option
This commit is contained in:
parent
2d43e11e96
commit
18e1b7a2bb
@ -17,4 +17,5 @@ public:
|
|||||||
static void StartProxy();
|
static void StartProxy();
|
||||||
public:
|
public:
|
||||||
static bool isDownload;
|
static bool isDownload;
|
||||||
};
|
static inline bool SkipSslVerify = false;
|
||||||
|
};
|
||||||
|
@ -69,6 +69,10 @@ std::string HTTP::Get(const std::string& IP) {
|
|||||||
httplib::Client cli(IP.substr(0, pos).c_str());
|
httplib::Client cli(IP.substr(0, pos).c_str());
|
||||||
cli.set_connection_timeout(std::chrono::seconds(10));
|
cli.set_connection_timeout(std::chrono::seconds(10));
|
||||||
cli.set_follow_location(true);
|
cli.set_follow_location(true);
|
||||||
|
if (SkipSslVerify) {
|
||||||
|
debug("Skipping SSL server validation via --skip-ssl-verify");
|
||||||
|
cli.enable_server_certificate_verification(false);
|
||||||
|
}
|
||||||
auto res = cli.Get(IP.substr(pos).c_str(), ProgressBar);
|
auto res = cli.Get(IP.substr(pos).c_str(), ProgressBar);
|
||||||
std::string Ret;
|
std::string Ret;
|
||||||
|
|
||||||
@ -98,6 +102,10 @@ std::string HTTP::Post(const std::string& IP, const std::string& Fields) {
|
|||||||
|
|
||||||
httplib::Client cli(IP.substr(0, pos).c_str());
|
httplib::Client cli(IP.substr(0, pos).c_str());
|
||||||
cli.set_connection_timeout(std::chrono::seconds(10));
|
cli.set_connection_timeout(std::chrono::seconds(10));
|
||||||
|
if (SkipSslVerify) {
|
||||||
|
debug("Skipping SSL server validation via --skip-ssl-verify");
|
||||||
|
cli.enable_server_certificate_verification(false);
|
||||||
|
}
|
||||||
std::string Ret;
|
std::string Ret;
|
||||||
|
|
||||||
if (!Fields.empty()) {
|
if (!Fields.empty()) {
|
||||||
|
@ -28,6 +28,13 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
GetEP(argv[0]);
|
GetEP(argv[0]);
|
||||||
|
|
||||||
|
for (int i = 0; i < argc; ++i) {
|
||||||
|
if (std::string_view(argv[i]) == "--skip-ssl-verify") {
|
||||||
|
info("SSL verification skip enabled");
|
||||||
|
HTTP::SkipSslVerify = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InitLauncher(argc, argv);
|
InitLauncher(argc, argv);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user