web_backend: fix a regression introduced in 39c8d18
* A regression was in 39c8d18
and token verification function was
broken.
* The reason being `httplib` now requires OpenSSL 1.1+ API while
LibreSSL 2.x provided OpenSSL 1.0 compatible API.
* The bundled LibreSSL has been updated to 3.2.2 so it now provides
OpenSSL 1.1 compatible API now.
* Also the path hint has been added so that it will find the correct
path to the CA certs on *nix systems.
* An option is provided so that *nix system distributions/providers can
use their own SSL implementations when compiling Yuzu/Citra to
(hopefully) complies with their maintenance guidelines.
* LURLParse is also removed since `httplib` can handle
`scheme:host:port` string itself now.
This commit is contained in:
parent
cd92a94965
commit
8e673cbb08
9 changed files with 19 additions and 402 deletions
|
@ -7,7 +7,6 @@
|
|||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include <LUrlParser.h>
|
||||
#include <fmt/format.h>
|
||||
#include <httplib.h>
|
||||
|
||||
|
@ -19,9 +18,6 @@ namespace WebService {
|
|||
|
||||
constexpr std::array<const char, 1> API_VERSION{'1'};
|
||||
|
||||
constexpr int HTTP_PORT = 80;
|
||||
constexpr int HTTPS_PORT = 443;
|
||||
|
||||
constexpr std::size_t TIMEOUT_SECONDS = 30;
|
||||
|
||||
struct Client::Impl {
|
||||
|
@ -67,21 +63,7 @@ struct Client::Impl {
|
|||
const std::string& jwt = "", const std::string& username = "",
|
||||
const std::string& token = "") {
|
||||
if (cli == nullptr) {
|
||||
const auto parsedUrl = LUrlParser::clParseURL::ParseURL(host);
|
||||
int port{};
|
||||
if (parsedUrl.m_Scheme == "http") {
|
||||
if (!parsedUrl.GetPort(&port)) {
|
||||
port = HTTP_PORT;
|
||||
}
|
||||
} else if (parsedUrl.m_Scheme == "https") {
|
||||
if (!parsedUrl.GetPort(&port)) {
|
||||
port = HTTPS_PORT;
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme);
|
||||
return WebResult{WebResult::Code::InvalidURL, "Bad URL scheme", ""};
|
||||
}
|
||||
cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port);
|
||||
cli = std::make_unique<httplib::Client>(host.c_str());
|
||||
}
|
||||
cli->set_connection_timeout(TIMEOUT_SECONDS);
|
||||
cli->set_read_timeout(TIMEOUT_SECONDS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue