diff options
| author | 2020-10-19 18:14:41 -0600 | |
|---|---|---|
| committer | 2020-10-27 02:57:19 -0600 | |
| commit | 8e673cbb08615865044ed546a133259ff2756128 (patch) | |
| tree | 3aaffed58d535f40440a9da69f1a96451b4c3a7b /src/web_service | |
| parent | Merge pull request #4805 from bunnei/update-defaults (diff) | |
| download | yuzu-8e673cbb08615865044ed546a133259ff2756128.tar.gz yuzu-8e673cbb08615865044ed546a133259ff2756128.tar.xz yuzu-8e673cbb08615865044ed546a133259ff2756128.zip | |
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.
Diffstat (limited to 'src/web_service')
| -rw-r--r-- | src/web_service/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/web_service/web_backend.cpp | 20 |
2 files changed, 2 insertions, 20 deletions
diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt index 7e484b906..ae85a72ea 100644 --- a/src/web_service/CMakeLists.txt +++ b/src/web_service/CMakeLists.txt | |||
| @@ -9,4 +9,4 @@ add_library(web_service STATIC | |||
| 9 | ) | 9 | ) |
| 10 | 10 | ||
| 11 | create_target_directory_groups(web_service) | 11 | create_target_directory_groups(web_service) |
| 12 | target_link_libraries(web_service PRIVATE common nlohmann_json::nlohmann_json httplib lurlparser) | 12 | target_link_libraries(web_service PRIVATE common nlohmann_json::nlohmann_json httplib) |
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index 534960d09..c56cd7c71 100644 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <mutex> | 7 | #include <mutex> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | 9 | ||
| 10 | #include <LUrlParser.h> | ||
| 11 | #include <fmt/format.h> | 10 | #include <fmt/format.h> |
| 12 | #include <httplib.h> | 11 | #include <httplib.h> |
| 13 | 12 | ||
| @@ -19,9 +18,6 @@ namespace WebService { | |||
| 19 | 18 | ||
| 20 | constexpr std::array<const char, 1> API_VERSION{'1'}; | 19 | constexpr std::array<const char, 1> API_VERSION{'1'}; |
| 21 | 20 | ||
| 22 | constexpr int HTTP_PORT = 80; | ||
| 23 | constexpr int HTTPS_PORT = 443; | ||
| 24 | |||
| 25 | constexpr std::size_t TIMEOUT_SECONDS = 30; | 21 | constexpr std::size_t TIMEOUT_SECONDS = 30; |
| 26 | 22 | ||
| 27 | struct Client::Impl { | 23 | struct Client::Impl { |
| @@ -67,21 +63,7 @@ struct Client::Impl { | |||
| 67 | const std::string& jwt = "", const std::string& username = "", | 63 | const std::string& jwt = "", const std::string& username = "", |
| 68 | const std::string& token = "") { | 64 | const std::string& token = "") { |
| 69 | if (cli == nullptr) { | 65 | if (cli == nullptr) { |
| 70 | const auto parsedUrl = LUrlParser::clParseURL::ParseURL(host); | 66 | cli = std::make_unique<httplib::Client>(host.c_str()); |
| 71 | int port{}; | ||
| 72 | if (parsedUrl.m_Scheme == "http") { | ||
| 73 | if (!parsedUrl.GetPort(&port)) { | ||
| 74 | port = HTTP_PORT; | ||
| 75 | } | ||
| 76 | } else if (parsedUrl.m_Scheme == "https") { | ||
| 77 | if (!parsedUrl.GetPort(&port)) { | ||
| 78 | port = HTTPS_PORT; | ||
| 79 | } | ||
| 80 | } else { | ||
| 81 | LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme); | ||
| 82 | return WebResult{WebResult::Code::InvalidURL, "Bad URL scheme", ""}; | ||
| 83 | } | ||
| 84 | cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port); | ||
| 85 | } | 67 | } |
| 86 | cli->set_connection_timeout(TIMEOUT_SECONDS); | 68 | cli->set_connection_timeout(TIMEOUT_SECONDS); |
| 87 | cli->set_read_timeout(TIMEOUT_SECONDS); | 69 | cli->set_read_timeout(TIMEOUT_SECONDS); |