Skip to content

Commit

Permalink
assign default port for http and https clients
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Aug 17, 2024
1 parent a1dc85c commit 8d2b4de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contrib/epee/src/abstract_http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ namespace http
http::url_content parsed{};
const bool r = parse_url(address, parsed);
CHECK_AND_ASSERT_MES(r, false, "failed to parse url: " << address);
if (parsed.port == 0 && (parsed.schema == "http" || parsed.schema == "https"))
{
struct servent *serv = getservbyname(parsed.schema.c_str(), "tcp");
parsed.port = ntohs(serv->s_port);
}
set_server(std::move(parsed.host), std::to_string(parsed.port), std::move(user), std::move(ssl_options));
return true;
}
Expand Down

0 comments on commit 8d2b4de

Please sign in to comment.