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