diff options
author | Lioncash <mathew1800@gmail.com> | 2020-10-13 14:10:50 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-10-13 19:16:49 +0200 |
commit | 39c8d18feba8eafcd43fbb55e73ae150a1947aad (patch) | |
tree | 9565ff464bbb9e5a0aa66e6e310098314e88d019 /src/web_service | |
parent | Merge pull request #3929 from FearlessTobi/ticket-keys (diff) | |
download | yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.tar yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.tar.gz yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.tar.bz2 yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.tar.lz yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.tar.xz yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.tar.zst yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.zip |
Diffstat (limited to 'src/web_service')
-rw-r--r-- | src/web_service/web_backend.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index 74e287045..534960d09 100644 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp @@ -67,28 +67,25 @@ struct Client::Impl { const std::string& jwt = "", const std::string& username = "", const std::string& token = "") { if (cli == nullptr) { - auto parsedUrl = LUrlParser::clParseURL::ParseURL(host); - int port; + const auto parsedUrl = LUrlParser::clParseURL::ParseURL(host); + int port{}; if (parsedUrl.m_Scheme == "http") { if (!parsedUrl.GetPort(&port)) { port = HTTP_PORT; } - cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port); } else if (parsedUrl.m_Scheme == "https") { if (!parsedUrl.GetPort(&port)) { port = HTTPS_PORT; } - cli = std::make_unique<httplib::SSLClient>(parsedUrl.m_Host.c_str(), 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); } - if (cli == nullptr) { - LOG_ERROR(WebService, "Invalid URL {}", host + path); - return WebResult{WebResult::Code::InvalidURL, "Invalid URL", ""}; - } - cli->set_timeout_sec(TIMEOUT_SECONDS); + cli->set_connection_timeout(TIMEOUT_SECONDS); + cli->set_read_timeout(TIMEOUT_SECONDS); + cli->set_write_timeout(TIMEOUT_SECONDS); httplib::Headers params; if (!jwt.empty()) { |