mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-16 18:56:52 +02:00
provide a default client context even if no Application instance is available
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SSLManager.cpp
|
// SSLManager.cpp
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id: //poco/1.7/NetSSL_Win/src/SSLManager.cpp#2 $
|
||||||
//
|
//
|
||||||
// Library: NetSSL_Win
|
// Library: NetSSL_Win
|
||||||
// Package: SSLCore
|
// Package: SSLCore
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "Poco/Net/Context.h"
|
#include "Poco/Net/Context.h"
|
||||||
#include "Poco/Net/Utility.h"
|
#include "Poco/Net/Utility.h"
|
||||||
#include "Poco/Net/PrivateKeyPassphraseHandler.h"
|
#include "Poco/Net/PrivateKeyPassphraseHandler.h"
|
||||||
|
#include "Poco/Net/RejectCertificateHandler.h"
|
||||||
#include "Poco/SingletonHolder.h"
|
#include "Poco/SingletonHolder.h"
|
||||||
#include "Poco/Delegate.h"
|
#include "Poco/Delegate.h"
|
||||||
#include "Poco/Util/Application.h"
|
#include "Poco/Util/Application.h"
|
||||||
@@ -120,7 +121,17 @@ Context::Ptr SSLManager::defaultClientContext()
|
|||||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
if (!_ptrDefaultClientContext)
|
if (!_ptrDefaultClientContext)
|
||||||
initDefaultContext(false);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
initDefaultContext(false);
|
||||||
|
}
|
||||||
|
catch (Poco::IllegalStateException&)
|
||||||
|
{
|
||||||
|
_ptrClientCertificateHandler = new RejectCertificateHandler(false);
|
||||||
|
_ptrDefaultClientContext = new Context(Context::CLIENT_USE, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return _ptrDefaultClientContext;
|
return _ptrDefaultClientContext;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user