From 8fe7242434a4797bb1222483d37ba08314e9cc49 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Mon, 22 Jul 2024 15:43:29 +0800 Subject: [PATCH] [coro_http_client][update]Default port (#724) --- CMakeLists.txt | 2 +- .../standalone/cinatra/coro_http_client.hpp | 19 ++++++++++--------- include/ylt/standalone/cinatra/uri.hpp | 4 ++-- include/ylt/standalone/cinatra/version.hpp | 2 +- include/ylt/version.hpp | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0e42ab5d..97b692367 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.15) project(yaLanTingLibs - VERSION 0.3.5 + VERSION 0.3.6 DESCRIPTION "yaLanTingLibs" HOMEPAGE_URL "https://github.com/alibaba/yalantinglibs" LANGUAGES CXX diff --git a/include/ylt/standalone/cinatra/coro_http_client.hpp b/include/ylt/standalone/cinatra/coro_http_client.hpp index 063ccb687..2a84efabf 100644 --- a/include/ylt/standalone/cinatra/coro_http_client.hpp +++ b/include/ylt/standalone/cinatra/coro_http_client.hpp @@ -1546,20 +1546,21 @@ class coro_http_client : public std::enable_shared_from_this { if (!proxy_host_.empty() && !proxy_port_.empty()) { if (!proxy_request_uri_.empty()) proxy_request_uri_.clear(); - if (u.get_port() == "http") { - proxy_request_uri_ += "http://" + u.get_host() + ":"; - proxy_request_uri_ += "80"; + if (u.get_port() == "80") { + proxy_request_uri_.append("http://").append(u.get_host()).append(":80"); } - else if (u.get_port() == "https") { - proxy_request_uri_ += "https://" + u.get_host() + ":"; - proxy_request_uri_ += "443"; + else if (u.get_port() == "443") { + proxy_request_uri_.append("https://") + .append(u.get_host()) + .append(":443"); } else { // all be http - proxy_request_uri_ += "http://" + u.get_host() + ":"; - proxy_request_uri_ += u.get_port(); + proxy_request_uri_.append("http://") + .append(u.get_host()) + .append(u.get_port()); } - proxy_request_uri_ += u.get_path(); + proxy_request_uri_.append(u.get_path()); u.path = std::string_view(proxy_request_uri_); } } diff --git a/include/ylt/standalone/cinatra/uri.hpp b/include/ylt/standalone/cinatra/uri.hpp index 4c1aedaa7..089ce4b3a 100644 --- a/include/ylt/standalone/cinatra/uri.hpp +++ b/include/ylt/standalone/cinatra/uri.hpp @@ -232,7 +232,7 @@ class uri_t { std::string port_str; if (is_ssl) { if (port.empty()) { - port_str = "https"; + port_str = "443"; } else { port_str = std::string(port); @@ -240,7 +240,7 @@ class uri_t { } else { if (port.empty()) { - port_str = "http"; + port_str = "80"; } else { port_str = std::string(port); diff --git a/include/ylt/standalone/cinatra/version.hpp b/include/ylt/standalone/cinatra/version.hpp index 4ba2c29f0..57eddccd6 100644 --- a/include/ylt/standalone/cinatra/version.hpp +++ b/include/ylt/standalone/cinatra/version.hpp @@ -5,4 +5,4 @@ // CINATRA_VERSION % 100 is the sub-minor version // CINATRA_VERSION / 100 % 1000 is the minor version // CINATRA_VERSION / 100000 is the major version -#define CINATRA_VERSION 901 // 0.9.1 \ No newline at end of file +#define CINATRA_VERSION 902 // 0.9.2 \ No newline at end of file diff --git a/include/ylt/version.hpp b/include/ylt/version.hpp index e8b97a70d..ad649d376 100644 --- a/include/ylt/version.hpp +++ b/include/ylt/version.hpp @@ -20,4 +20,4 @@ // YLT_VERSION % 100 is the sub-minor version // YLT_VERSION / 100 % 1000 is the minor version // YLT_VERSION / 100000 is the major version -#define YLT_VERSION 305 // 0.3.5 \ No newline at end of file +#define YLT_VERSION 306 // 0.3.6 \ No newline at end of file