mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 00:07:59 +02:00
fix openssl session resumption, add quiet shutdown option, support FTPS with hostname (#4103)
This commit is contained in:
@@ -229,6 +229,26 @@ void Context::setSecurityLevel(SecurityLevel level)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Context::ignoreUnexpectedEof(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
#if defined(SSL_OP_IGNORE_UNEXPECTED_EOF)
|
||||
SSL_CTX_set_options(_pSSLContext, SSL_OP_IGNORE_UNEXPECTED_EOF);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(SSL_OP_IGNORE_UNEXPECTED_EOF)
|
||||
SSL_CTX_clear_options(_pSSLContext, SSL_OP_IGNORE_UNEXPECTED_EOF);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Context::setQuietShutdown(bool flag)
|
||||
{
|
||||
SSL_CTX_set_quiet_shutdown(_pSSLContext, flag ? 1 : 0);
|
||||
}
|
||||
|
||||
void Context::useCertificate(const Poco::Crypto::X509Certificate& certificate)
|
||||
{
|
||||
|
@@ -96,7 +96,7 @@ void FTPSClientSession::afterCreateControlSocket()
|
||||
try
|
||||
{
|
||||
if (!_pContext) _pContext = Poco::Net::SSLManager::instance().defaultClientContext();
|
||||
Poco::Net::SecureStreamSocket sss(Poco::Net::SecureStreamSocket::attach(*_pControlSocket, _pContext));
|
||||
Poco::Net::SecureStreamSocket sss(Poco::Net::SecureStreamSocket::attach(*_pControlSocket, getHost(), _pContext));
|
||||
*_pControlSocket = sss;
|
||||
}
|
||||
catch (Poco::Exception&)
|
||||
@@ -125,7 +125,7 @@ StreamSocket FTPSClientSession::establishDataConnection(const std::string& comma
|
||||
Poco::Net::SecureStreamSocketImpl* pSecure = dynamic_cast<Poco::Net::SecureStreamSocketImpl*>(_pControlSocket->impl());
|
||||
if (pSecure != nullptr)
|
||||
{
|
||||
Poco::Net::SecureStreamSocket sss(Poco::Net::SecureStreamSocket::attach(ss, pSecure->context(), pSecure->currentSession()));
|
||||
Poco::Net::SecureStreamSocket sss(Poco::Net::SecureStreamSocket::attach(ss, getHost(), pSecure->context(), pSecure->currentSession()));
|
||||
ss = sss;
|
||||
if (_forceSessionReuse)
|
||||
{
|
||||
|
@@ -103,6 +103,7 @@ void SSLManager::shutdown()
|
||||
ServerVerificationError.clear();
|
||||
_ptrDefaultServerContext = 0;
|
||||
_ptrDefaultClientContext = 0;
|
||||
_socketIndex = _contextIndex = -1;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user