Skip to content

Commit 8b01135

Browse files
committed
Merge pull request #9438
322953e assign default port for http and https clients (woodser)
2 parents 1c1b828 + 322953e commit 8b01135

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

contrib/epee/src/abstract_http_client.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ namespace http
135135
http::url_content parsed{};
136136
const bool r = parse_url(address, parsed);
137137
CHECK_AND_ASSERT_MES(r, false, "failed to parse url: " << address);
138+
if (parsed.port == 0)
139+
{
140+
if (parsed.schema == "http")
141+
parsed.port = 80;
142+
else if (parsed.schema == "https")
143+
parsed.port = 443;
144+
}
138145
set_server(std::move(parsed.host), std::to_string(parsed.port), std::move(user), std::move(ssl_options));
139146
return true;
140147
}

0 commit comments

Comments
 (0)