Merge pull request #18647 from ClickHouse/remove-getservbyname

Remove useless support for symbolic port names
This commit is contained in:
alexey-milovidov 2020-12-31 14:46:10 +03:00 committed by GitHub
commit 07411aafd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,13 +80,7 @@ static void splitHostAndPort(const std::string & host_and_port, std::string & ou
out_port = static_cast<UInt16>(port); out_port = static_cast<UInt16>(port);
} }
else else
{ throw Exception("Port must be numeric", ErrorCodes::BAD_ARGUMENTS);
struct servent * se = getservbyname(port_str.c_str(), nullptr);
if (se)
out_port = ntohs(static_cast<UInt16>(se->s_port));
else
throw Exception("Service not found", ErrorCodes::BAD_ARGUMENTS);
}
} }
static DNSResolver::IPAddresses resolveIPAddressImpl(const std::string & host) static DNSResolver::IPAddresses resolveIPAddressImpl(const std::string & host)