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