fix(HTTPSClientSession): There is no way to resolve host in advance and connect to HTTPS server with SNI. #4395 (#4751)

This commit is contained in:
Aleksandar Fabijanic
2024-11-05 13:46:42 -06:00
committed by GitHub
parent ca63bf0db9
commit c156f0b357
6 changed files with 53 additions and 4 deletions

View File

@@ -39,11 +39,12 @@ HTTPSClientSession::HTTPSClientSession():
}
HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket):
HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket, const std::string& host, Poco::UInt16 port):
HTTPClientSession(socket),
_pContext(socket.context())
{
setPort(HTTPS_PORT);
setHost(host);
setPort(port);
}

View File

@@ -60,6 +60,13 @@ SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::
}
SecureStreamSocket::SecureStreamSocket(const std::string& hostName):
StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
{
static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
}
SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext):
StreamSocket(new SecureStreamSocketImpl(pContext))
{
@@ -83,6 +90,13 @@ SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::
}
SecureStreamSocket::SecureStreamSocket(const std::string& hostName, Context::Ptr pContext):
StreamSocket(new SecureStreamSocketImpl(pContext))
{
static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
}
SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext, Session::Ptr pSession):
StreamSocket(new SecureStreamSocketImpl(pContext))
{