Initialize wxWinHTTP when wxWebSessionFactoryWinHTTP is created
This commit is contained in:
@@ -136,6 +136,8 @@ public:
|
||||
|
||||
~wxWebSessionWinHTTP();
|
||||
|
||||
static bool Initialize();
|
||||
|
||||
wxWebRequestImplPtr
|
||||
CreateRequest(wxWebSession& session,
|
||||
wxEvtHandler* handler,
|
||||
@@ -163,7 +165,14 @@ class wxWebSessionFactoryWinHTTP : public wxWebSessionFactory
|
||||
{
|
||||
public:
|
||||
wxWebSessionImpl* Create() wxOVERRIDE
|
||||
{ return new wxWebSessionWinHTTP(); }
|
||||
{
|
||||
return new wxWebSessionWinHTTP();
|
||||
}
|
||||
|
||||
bool Initialize() wxOVERRIDE
|
||||
{
|
||||
return wxWebSessionWinHTTP::Initialize();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_WEBREQUEST_WINHTTP_H
|
||||
|
@@ -212,6 +212,8 @@ class wxWebSessionFactory
|
||||
public:
|
||||
virtual wxWebSessionImpl* Create() = 0;
|
||||
|
||||
virtual bool Initialize() { return true; }
|
||||
|
||||
virtual ~wxWebSessionFactory() { }
|
||||
};
|
||||
|
||||
|
@@ -942,6 +942,13 @@ void
|
||||
wxWebSession::RegisterFactory(const wxString& backend,
|
||||
wxWebSessionFactory* factory)
|
||||
{
|
||||
if ( !factory->Initialize() )
|
||||
{
|
||||
delete factory;
|
||||
factory = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
// Note that we don't have to check here that there is no registered
|
||||
// backend with the same name yet because we're only called from
|
||||
// InitFactoryMap() below. If this function becomes public, we'd need to
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include "wx/log.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/translation.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
||||
// Helper class used to dynamically load the required symbols from winhttp.dll
|
||||
@@ -114,23 +113,6 @@ wxWinHTTP::WinHttpQueryAuthSchemes_t wxWinHTTP::WinHttpQueryAuthSchemes;
|
||||
wxWinHTTP::WinHttpSetCredentials_t wxWinHTTP::WinHttpSetCredentials;
|
||||
wxWinHTTP::WinHttpOpen_t wxWinHTTP::WinHttpOpen;
|
||||
|
||||
class wxWinHTTPModule : public wxModule
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit() wxOVERRIDE
|
||||
{
|
||||
return wxWinHTTP::LoadLibrary();
|
||||
}
|
||||
|
||||
virtual void OnExit() wxOVERRIDE
|
||||
{
|
||||
}
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxWinHTTPModule);
|
||||
};
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxWinHTTPModule, wxModule);
|
||||
|
||||
|
||||
// Define constants potentially missing in old SDKs
|
||||
#ifndef WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY
|
||||
@@ -676,6 +658,11 @@ wxWebSessionWinHTTP::~wxWebSessionWinHTTP()
|
||||
wxWinHTTPCloseHandle(m_handle);
|
||||
}
|
||||
|
||||
bool wxWebSessionWinHTTP::Initialize()
|
||||
{
|
||||
return wxWinHTTP::LoadLibrary();
|
||||
}
|
||||
|
||||
bool wxWebSessionWinHTTP::Open()
|
||||
{
|
||||
DWORD accessType;
|
||||
|
Reference in New Issue
Block a user