aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/simple/http_client.cpp
diff options
context:
space:
mode:
authorjolex007 <jolex007@yandex-team.com>2025-01-31 19:00:13 +0300
committerjolex007 <jolex007@yandex-team.com>2025-01-31 19:25:40 +0300
commit16981ec67a23463ba2532710940a7fe4eb28f812 (patch)
treeed19d4b6a2485b1da7ce001911d31d60fa4b9e2f /library/cpp/http/simple/http_client.cpp
parent0a45708aff069610623744298139fae0d1ae2651 (diff)
downloadydb-16981ec67a23463ba2532710940a7fe4eb28f812.tar.gz
Fix using port in universal_fetcher
commit_hash:fa0dfc03d76b5e40181e589078cdfff0c13ae51d
Diffstat (limited to 'library/cpp/http/simple/http_client.cpp')
-rw-r--r--library/cpp/http/simple/http_client.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/library/cpp/http/simple/http_client.cpp b/library/cpp/http/simple/http_client.cpp
index 00145c804f..bac6bdc39e 100644
--- a/library/cpp/http/simple/http_client.cpp
+++ b/library/cpp/http/simple/http_client.cpp
@@ -327,9 +327,18 @@ void TRedirectableHttpClient::ProcessResponse(const TStringBuf relativeUrl, THtt
TStringBuf schemeHostPort = GetSchemeHostAndPort(i->Value());
TStringBuf scheme("http://");
TStringBuf host("unknown");
- ui16 port = 80;
+ ui16 port = 0;
GetSchemeHostAndPort(schemeHostPort, scheme, host, port);
TStringBuf body = GetPathAndQuery(i->Value(), false);
+ if (port == 0) {
+ if (scheme.StartsWith("https")) {
+ port = 443;
+ } else if (scheme.StartsWith("http")) {
+ port = 80;
+ } else {
+ port = 80;
+ }
+ }
auto opts = Opts;
opts.Host(TString(scheme) + TString(host));