summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLC <mathew1800@gmail.com>2020-10-27 19:12:27 -0400
committerGitHub <noreply@github.com>2020-10-27 19:12:27 -0400
commit7d27a7a51138aeaa888948f959d565a8dee1b7ad (patch)
treec5249d5875ab849499195d9a51ea306ffd6dd17f /src
parentcd92a94965a726a90032b15dbcc5ead877fac030 (diff)
parenteb84e0f63a28da64d17eea67eb532c3d9256b12f (diff)
Merge pull request #4842 from liushuyu/fix-web-srv
web_backend: fix a regression introduced in 39c8d18
Diffstat (limited to 'src')
-rw-r--r--src/web_service/CMakeLists.txt2
-rw-r--r--src/web_service/web_backend.cpp20
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
)
create_target_directory_groups(web_service)
-target_link_libraries(web_service PRIVATE common nlohmann_json::nlohmann_json httplib lurlparser)
+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 @@
#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);