Enable DNS cache for HTTPSClientSession.

This commit is contained in:
Nikolai Kochetov 2022-05-12 15:21:29 +00:00
parent 1d711496c3
commit 77fb1b84ac
2 changed files with 8 additions and 2 deletions

2
contrib/poco vendored

@ -1 +1 @@
Subproject commit 6c1a233744d13414e8e8db396c75177b857b2c22
Subproject commit 5d11f0aa6fd2faad0a7b34aa355cd50c4deb27e6

View File

@ -75,7 +75,13 @@ namespace
{
#if USE_SSL
/// Cannot resolve host in advance, otherwise SNI won't work in Poco.
session = std::make_shared<Poco::Net::HTTPSClientSession>(host, port);
String resolved_host = resolve_host ? DNSResolver::instance().resolveHost(host).toString() : host;
auto https_session = std::make_shared<Poco::Net::HTTPSClientSession>(host, port);
if (resolve_host)
https_session->setResolvedHost(DNSResolver::instance().resolveHost(host).toString());
session = std::move(https_session);
#else
throw Exception("ClickHouse was built without HTTPS support", ErrorCodes::FEATURE_IS_NOT_ENABLED_AT_BUILD_TIME);
#endif