Merge pull request #3432 from brianclinkenbeard/update-httplib

Update httplib to 0.5.5
This commit is contained in:
bunnei 2020-02-19 21:15:06 -05:00 committed by GitHub
commit 2342c0d50e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1758 additions and 693 deletions

View file

@ -1,4 +1,4 @@
From https://github.com/yhirose/cpp-httplib/commit/d9479bc0b12e8a1e8bce2d34da4feeef488581f3 From https://github.com/yhirose/cpp-httplib/tree/fce8e6fefdab4ad48bc5b25c98e5ebfda4f3cf53
MIT License MIT License

File diff suppressed because it is too large Load diff

View file

@ -200,7 +200,8 @@ private:
DownloadResult DownloadInternal(const std::string& resolved_path, u32 timeout_seconds, DownloadResult DownloadInternal(const std::string& resolved_path, u32 timeout_seconds,
const std::string& content_type_name) { const std::string& content_type_name) {
if (client == nullptr) { if (client == nullptr) {
client = std::make_unique<httplib::SSLClient>(BOXCAT_HOSTNAME, PORT, timeout_seconds); client = std::make_unique<httplib::SSLClient>(BOXCAT_HOSTNAME, PORT);
client->set_timeout_sec(timeout_seconds);
} }
httplib::Headers headers{ httplib::Headers headers{
@ -448,8 +449,8 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
Boxcat::StatusResult Boxcat::GetStatus(std::optional<std::string>& global, Boxcat::StatusResult Boxcat::GetStatus(std::optional<std::string>& global,
std::map<std::string, EventStatus>& games) { std::map<std::string, EventStatus>& games) {
httplib::SSLClient client{BOXCAT_HOSTNAME, static_cast<int>(PORT), httplib::SSLClient client{BOXCAT_HOSTNAME, static_cast<int>(PORT)};
static_cast<int>(TIMEOUT_SECONDS)}; client.set_timeout_sec(static_cast<int>(TIMEOUT_SECONDS));
httplib::Headers headers{ httplib::Headers headers{
{std::string("Game-Assets-API-Version"), std::string(BOXCAT_API_VERSION)}, {std::string("Game-Assets-API-Version"), std::string(BOXCAT_API_VERSION)},

View file

@ -73,14 +73,12 @@ struct Client::Impl {
if (!parsedUrl.GetPort(&port)) { if (!parsedUrl.GetPort(&port)) {
port = HTTP_PORT; port = HTTP_PORT;
} }
cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port, cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port);
TIMEOUT_SECONDS);
} else if (parsedUrl.m_Scheme == "https") { } else if (parsedUrl.m_Scheme == "https") {
if (!parsedUrl.GetPort(&port)) { if (!parsedUrl.GetPort(&port)) {
port = HTTPS_PORT; port = HTTPS_PORT;
} }
cli = std::make_unique<httplib::SSLClient>(parsedUrl.m_Host.c_str(), port, cli = std::make_unique<httplib::SSLClient>(parsedUrl.m_Host.c_str(), port);
TIMEOUT_SECONDS);
} else { } else {
LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme); LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme);
return Common::WebResult{Common::WebResult::Code::InvalidURL, "Bad URL scheme"}; return Common::WebResult{Common::WebResult::Code::InvalidURL, "Bad URL scheme"};
@ -90,6 +88,7 @@ struct Client::Impl {
LOG_ERROR(WebService, "Invalid URL {}", host + path); LOG_ERROR(WebService, "Invalid URL {}", host + path);
return Common::WebResult{Common::WebResult::Code::InvalidURL, "Invalid URL"}; return Common::WebResult{Common::WebResult::Code::InvalidURL, "Invalid URL"};
} }
cli->set_timeout_sec(TIMEOUT_SECONDS);
httplib::Headers params; httplib::Headers params;
if (!jwt.empty()) { if (!jwt.empty()) {