diff --git a/NetSSL_OpenSSL/src/HTTPSClientSession.cpp b/NetSSL_OpenSSL/src/HTTPSClientSession.cpp index d338981d1..567e256bf 100644 --- a/NetSSL_OpenSSL/src/HTTPSClientSession.cpp +++ b/NetSSL_OpenSSL/src/HTTPSClientSession.cpp @@ -64,8 +64,6 @@ HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 por { setHost(host); setPort(port); - SecureStreamSocket sss(socket()); - sss.setPeerHostName(host); } @@ -90,8 +88,6 @@ HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 por { setHost(host); setPort(port); - SecureStreamSocket sss(socket()); - sss.setPeerHostName(host); } @@ -102,8 +98,6 @@ HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 por { setHost(host); setPort(port); - SecureStreamSocket sss(socket()); - sss.setPeerHostName(host); } @@ -148,6 +142,10 @@ void HTTPSClientSession::connect(const SocketAddress& address) if (getProxyHost().empty() || bypassProxy()) { SecureStreamSocket sss(socket()); + if (sss.getPeerHostName().empty()) + { + sss.setPeerHostName(getHost()); + } if (_pContext->sessionCacheEnabled()) { sss.useSession(_pSession);