Merge branch 'webrequest-build-fixes' of https://github.com/MaartenBent/wxWidgets

wxWebRequest-related build fixes for MinGW.

See https://github.com/wxWidgets/wxWidgets/pull/2283
This commit is contained in:
Vadim Zeitlin
2021-03-23 14:16:07 +01:00
13 changed files with 149 additions and 57 deletions

View File

@@ -691,11 +691,7 @@
#cmakedefine01 wxUSE_GRAPHICS_DIRECT2D #cmakedefine01 wxUSE_GRAPHICS_DIRECT2D
#endif #endif
#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) #cmakedefine01 wxUSE_WEBREQUEST_WINHTTP
#cmakedefine01 wxUSE_WEBREQUEST_WINHTTP
#else
#cmakedefine01 wxUSE_WEBREQUEST_WINHTTP
#endif
#cmakedefine01 wxUSE_OLE #cmakedefine01 wxUSE_OLE

View File

@@ -1650,11 +1650,7 @@
// //
// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, // Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1,
// otherwise wxWebRequest won't be available at all. // otherwise wxWebRequest won't be available at all.
#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) #define wxUSE_WEBREQUEST_WINHTTP 1
#define wxUSE_WEBREQUEST_WINHTTP 1
#else
#define wxUSE_WEBREQUEST_WINHTTP 0
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Windows-only settings // Windows-only settings

View File

@@ -235,6 +235,11 @@
# define wxUSE_ACTIVITYINDICATOR 0 # define wxUSE_ACTIVITYINDICATOR 0
#endif /* !wxUSE_ACTIVITYINDICATOR && !_MSC_VER */ #endif /* !wxUSE_ACTIVITYINDICATOR && !_MSC_VER */
/* MinGW-w64 (32 and 64 bit) has winhttp.h available, legacy MinGW does not. */
#if (!defined(_MSC_VER) && !defined(__MINGW64_VERSION_MAJOR)) || !wxUSE_DYNLIB_CLASS
#undef wxUSE_WEBREQUEST_WINHTTP
#define wxUSE_WEBREQUEST_WINHTTP 0
#endif
/* /*
Similarly, turn off wxUSE_WEBREQUEST if we can't enable it because we don't Similarly, turn off wxUSE_WEBREQUEST if we can't enable it because we don't
have any of its backends to allow the library to compile with the default have any of its backends to allow the library to compile with the default

View File

@@ -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

View File

@@ -1650,11 +1650,7 @@
// //
// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, // Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1,
// otherwise wxWebRequest won't be available at all. // otherwise wxWebRequest won't be available at all.
#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) #define wxUSE_WEBREQUEST_WINHTTP 1
#define wxUSE_WEBREQUEST_WINHTTP 1
#else
#define wxUSE_WEBREQUEST_WINHTTP 0
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Windows-only settings // Windows-only settings

View File

@@ -44,11 +44,7 @@
// //
// Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1, // Recommended setting: 1, can be set to 0 if wxUSE_WEBREQUEST_CURL==1,
// otherwise wxWebRequest won't be available at all. // otherwise wxWebRequest won't be available at all.
#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) #define wxUSE_WEBREQUEST_WINHTTP 1
#define wxUSE_WEBREQUEST_WINHTTP 1
#else
#define wxUSE_WEBREQUEST_WINHTTP 0
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Windows-only settings // Windows-only settings

View File

@@ -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() { }
}; };

View File

@@ -10,10 +10,6 @@
// For compilers that support precompilation, includes "wx/wx.h". // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
@@ -29,6 +25,10 @@
#include "../sample.xpm" #include "../sample.xpm"
#endif #endif
#if !wxUSE_WEBREQUEST
#error "wxUSE_WEBREQUEST must be 1 for this sample."
#endif
class WebRequestFrame : public wxFrame class WebRequestFrame : public wxFrame
{ {
public: public:

View File

@@ -691,11 +691,7 @@
#define wxUSE_GRAPHICS_DIRECT2D 0 #define wxUSE_GRAPHICS_DIRECT2D 0
#endif #endif
#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR) #define wxUSE_WEBREQUEST_WINHTTP 0
#define wxUSE_WEBREQUEST_WINHTTP 0
#else
#define wxUSE_WEBREQUEST_WINHTTP 0
#endif
#define wxUSE_OLE 0 #define wxUSE_OLE 0

View File

@@ -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

View File

@@ -12,7 +12,7 @@
#include "wx/webrequest.h" #include "wx/webrequest.h"
#if wxUSE_WEBREQUEST_CURL #if wxUSE_WEBREQUEST && wxUSE_WEBREQUEST_CURL
#include "wx/private/webrequest_curl.h" #include "wx/private/webrequest_curl.h"
@@ -461,7 +461,7 @@ wxDEFINE_EVENT(wxEVT_SOCKET_POLLER_RESULT, wxThreadEvent);
class SocketPollerImpl class SocketPollerImpl
{ {
public: public:
virtual ~SocketPollerImpl(){}; virtual ~SocketPollerImpl(){}
virtual bool StartPolling(wxSOCKET_T, int) = 0; virtual bool StartPolling(wxSOCKET_T, int) = 0;
virtual void StopPolling(wxSOCKET_T) = 0; virtual void StopPolling(wxSOCKET_T) = 0;
virtual void ResumePolling(wxSOCKET_T) = 0; virtual void ResumePolling(wxSOCKET_T) = 0;

View File

@@ -12,9 +12,10 @@
#include "wx/webrequest.h" #include "wx/webrequest.h"
#if wxUSE_WEBREQUEST_WINHTTP #if wxUSE_WEBREQUEST && wxUSE_WEBREQUEST_WINHTTP
#include "wx/mstream.h" #include "wx/mstream.h"
#include "wx/dynlib.h"
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include "wx/msw/private/webrequest_winhttp.h" #include "wx/msw/private/webrequest_winhttp.h"
@@ -24,11 +25,94 @@
#include "wx/translation.h" #include "wx/translation.h"
#endif #endif
// For MSVC we can link in the required library explicitly, for the other // Helper class used to dynamically load the required symbols from winhttp.dll
// compilers (e.g. MinGW) this needs to be done at makefiles level. class wxWinHTTP
#ifdef __VISUALC__ {
#pragma comment(lib, "winhttp") public:
#endif static bool LoadLibrary()
{
bool result = m_winhttp.Load("winhttp.dll", wxDL_VERBATIM | wxDL_QUIET);
if ( !result )
return result;
#define wxLOAD_FUNC(name) \
wxDL_INIT_FUNC(, name, m_winhttp); \
result &= (name != NULL);
wxLOAD_FUNC(WinHttpQueryOption)
wxLOAD_FUNC(WinHttpQueryHeaders)
wxLOAD_FUNC(WinHttpSetOption)
wxLOAD_FUNC(WinHttpWriteData)
wxLOAD_FUNC(WinHttpCloseHandle)
wxLOAD_FUNC(WinHttpReceiveResponse)
wxLOAD_FUNC(WinHttpCrackUrl)
wxLOAD_FUNC(WinHttpConnect)
wxLOAD_FUNC(WinHttpOpenRequest)
wxLOAD_FUNC(WinHttpSetStatusCallback)
wxLOAD_FUNC(WinHttpSendRequest)
wxLOAD_FUNC(WinHttpReadData)
wxLOAD_FUNC(WinHttpQueryAuthSchemes)
wxLOAD_FUNC(WinHttpSetCredentials)
wxLOAD_FUNC(WinHttpOpen)
if ( !result )
m_winhttp.Unload();
return result;
}
typedef BOOL(WINAPI* WinHttpQueryOption_t)(HINTERNET, DWORD, LPVOID, LPDWORD);
static WinHttpQueryOption_t WinHttpQueryOption;
typedef BOOL(WINAPI* WinHttpQueryHeaders_t)(HINTERNET, DWORD, LPCWSTR, LPVOID, LPDWORD, LPDWORD);
static WinHttpQueryHeaders_t WinHttpQueryHeaders;
typedef BOOL(WINAPI* WinHttpSetOption_t)(HINTERNET, DWORD, LPVOID, DWORD);
static WinHttpSetOption_t WinHttpSetOption;
typedef BOOL(WINAPI* WinHttpWriteData_t)(HINTERNET, LPCVOID, DWORD, LPDWORD);
static WinHttpWriteData_t WinHttpWriteData;
typedef BOOL(WINAPI* WinHttpCloseHandle_t)(HINTERNET);
static WinHttpCloseHandle_t WinHttpCloseHandle;
typedef BOOL(WINAPI* WinHttpReceiveResponse_t)(HINTERNET, LPVOID);
static WinHttpReceiveResponse_t WinHttpReceiveResponse;
typedef BOOL(WINAPI* WinHttpCrackUrl_t)(LPCWSTR, DWORD, DWORD, LPURL_COMPONENTS);
static WinHttpCrackUrl_t WinHttpCrackUrl;
typedef HINTERNET(WINAPI* WinHttpConnect_t)(HINTERNET, LPCWSTR, INTERNET_PORT, DWORD);
static WinHttpConnect_t WinHttpConnect;
typedef HINTERNET(WINAPI* WinHttpOpenRequest_t)(HINTERNET, LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR*, DWORD);
static WinHttpOpenRequest_t WinHttpOpenRequest;
typedef WINHTTP_STATUS_CALLBACK(WINAPI* WinHttpSetStatusCallback_t)(HINTERNET, WINHTTP_STATUS_CALLBACK, DWORD, DWORD_PTR);
static WinHttpSetStatusCallback_t WinHttpSetStatusCallback;
typedef BOOL(WINAPI* WinHttpSendRequest_t)(HINTERNET, LPCWSTR, DWORD, LPVOID, DWORD, DWORD, DWORD_PTR);
static WinHttpSendRequest_t WinHttpSendRequest;
typedef BOOL(WINAPI* WinHttpReadData_t)(HINTERNET, LPVOID, DWORD, LPDWORD);
static WinHttpReadData_t WinHttpReadData;
typedef BOOL(WINAPI* WinHttpQueryAuthSchemes_t)(HINTERNET, LPDWORD, LPDWORD, LPDWORD);
static WinHttpQueryAuthSchemes_t WinHttpQueryAuthSchemes;
typedef BOOL(WINAPI* WinHttpSetCredentials_t)(HINTERNET, DWORD, DWORD, LPCWSTR, LPCWSTR, LPVOID);
static WinHttpSetCredentials_t WinHttpSetCredentials;
typedef HINTERNET(WINAPI* WinHttpOpen_t)(LPCWSTR, DWORD, LPCWSTR, LPCWSTR, DWORD);
static WinHttpOpen_t WinHttpOpen;
private:
static wxDynamicLibrary m_winhttp;
};
wxDynamicLibrary wxWinHTTP::m_winhttp;
wxWinHTTP::WinHttpQueryOption_t wxWinHTTP::WinHttpQueryOption;
wxWinHTTP::WinHttpQueryHeaders_t wxWinHTTP::WinHttpQueryHeaders;
wxWinHTTP::WinHttpSetOption_t wxWinHTTP::WinHttpSetOption;
wxWinHTTP::WinHttpWriteData_t wxWinHTTP::WinHttpWriteData;
wxWinHTTP::WinHttpCloseHandle_t wxWinHTTP::WinHttpCloseHandle;
wxWinHTTP::WinHttpReceiveResponse_t wxWinHTTP::WinHttpReceiveResponse;
wxWinHTTP::WinHttpCrackUrl_t wxWinHTTP::WinHttpCrackUrl;
wxWinHTTP::WinHttpConnect_t wxWinHTTP::WinHttpConnect;
wxWinHTTP::WinHttpOpenRequest_t wxWinHTTP::WinHttpOpenRequest;
wxWinHTTP::WinHttpSetStatusCallback_t wxWinHTTP::WinHttpSetStatusCallback;
wxWinHTTP::WinHttpSendRequest_t wxWinHTTP::WinHttpSendRequest;
wxWinHTTP::WinHttpReadData_t wxWinHTTP::WinHttpReadData;
wxWinHTTP::WinHttpQueryAuthSchemes_t wxWinHTTP::WinHttpQueryAuthSchemes;
wxWinHTTP::WinHttpSetCredentials_t wxWinHTTP::WinHttpSetCredentials;
wxWinHTTP::WinHttpOpen_t wxWinHTTP::WinHttpOpen;
// 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
@@ -64,12 +148,12 @@ static wxString wxWinHTTPQueryHeaderString(HINTERNET hRequest, DWORD dwInfoLevel
{ {
wxString result; wxString result;
DWORD bufferLen = 0; DWORD bufferLen = 0;
::WinHttpQueryHeaders(hRequest, dwInfoLevel, pwszName, NULL, &bufferLen, wxWinHTTP::WinHttpQueryHeaders(hRequest, dwInfoLevel, pwszName, NULL, &bufferLen,
WINHTTP_NO_HEADER_INDEX); WINHTTP_NO_HEADER_INDEX);
if ( ::GetLastError() == ERROR_INSUFFICIENT_BUFFER ) if ( ::GetLastError() == ERROR_INSUFFICIENT_BUFFER )
{ {
wxWCharBuffer resBuf(bufferLen); wxWCharBuffer resBuf(bufferLen);
if ( ::WinHttpQueryHeaders(hRequest, dwInfoLevel, pwszName, if ( wxWinHTTP::WinHttpQueryHeaders(hRequest, dwInfoLevel, pwszName,
resBuf.data(), &bufferLen, resBuf.data(), &bufferLen,
WINHTTP_NO_HEADER_INDEX) ) WINHTTP_NO_HEADER_INDEX) )
{ {
@@ -84,11 +168,11 @@ static wxString wxWinHTTPQueryOptionString(HINTERNET hInternet, DWORD dwOption)
{ {
wxString result; wxString result;
DWORD bufferLen = 0; DWORD bufferLen = 0;
::WinHttpQueryOption(hInternet, dwOption, NULL, &bufferLen); wxWinHTTP::WinHttpQueryOption(hInternet, dwOption, NULL, &bufferLen);
if ( ::GetLastError() == ERROR_INSUFFICIENT_BUFFER ) if ( ::GetLastError() == ERROR_INSUFFICIENT_BUFFER )
{ {
wxWCharBuffer resBuf(bufferLen); wxWCharBuffer resBuf(bufferLen);
if ( ::WinHttpQueryOption(hInternet, dwOption, resBuf.data(), &bufferLen) ) if ( wxWinHTTP::WinHttpQueryOption(hInternet, dwOption, resBuf.data(), &bufferLen) )
result.assign(resBuf); result.assign(resBuf);
} }
@@ -98,13 +182,13 @@ static wxString wxWinHTTPQueryOptionString(HINTERNET hInternet, DWORD dwOption)
static inline static inline
void wxWinHTTPSetOption(HINTERNET hInternet, DWORD dwOption, DWORD dwValue) void wxWinHTTPSetOption(HINTERNET hInternet, DWORD dwOption, DWORD dwValue)
{ {
::WinHttpSetOption(hInternet, dwOption, &dwValue, sizeof(dwValue)); wxWinHTTP::WinHttpSetOption(hInternet, dwOption, &dwValue, sizeof(dwValue));
} }
static static
void wxWinHTTPCloseHandle(HINTERNET hInternet) void wxWinHTTPCloseHandle(HINTERNET hInternet)
{ {
if ( !::WinHttpCloseHandle(hInternet) ) if ( !wxWinHTTP::WinHttpCloseHandle(hInternet) )
{ {
wxLogLastError("WinHttpCloseHandle"); wxLogLastError("WinHttpCloseHandle");
} }
@@ -225,7 +309,7 @@ void wxWebRequestWinHTTP::WriteData()
void* buffer = m_dataWriteBuffer.GetWriteBuf(dataWriteSize); void* buffer = m_dataWriteBuffer.GetWriteBuf(dataWriteSize);
m_dataStream->Read(buffer, dataWriteSize); m_dataStream->Read(buffer, dataWriteSize);
if ( !::WinHttpWriteData if ( !wxWinHTTP::WinHttpWriteData
( (
m_request, m_request,
m_dataWriteBuffer.GetData(), m_dataWriteBuffer.GetData(),
@@ -241,7 +325,7 @@ void wxWebRequestWinHTTP::CreateResponse()
{ {
wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: creating response", this); wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: creating response", this);
if ( !::WinHttpReceiveResponse(m_request, NULL) ) if ( !wxWinHTTP::WinHttpReceiveResponse(m_request, NULL) )
{ {
SetFailedWithLastError("Receiving response"); SetFailedWithLastError("Receiving response");
return; return;
@@ -308,14 +392,14 @@ void wxWebRequestWinHTTP::Start()
urlComps.dwUrlPathLength = urlComps.dwUrlPathLength =
urlComps.dwExtraInfoLength = (DWORD)-1; urlComps.dwExtraInfoLength = (DWORD)-1;
if ( !::WinHttpCrackUrl(m_url.wc_str(), m_url.length(), 0, &urlComps) ) if ( !wxWinHTTP::WinHttpCrackUrl(m_url.wc_str(), m_url.length(), 0, &urlComps) )
{ {
SetFailedWithLastError("Parsing URL"); SetFailedWithLastError("Parsing URL");
return; return;
} }
// Open a connection // Open a connection
m_connect = ::WinHttpConnect m_connect = wxWinHTTP::WinHttpConnect
( (
m_sessionImpl.GetHandle(), m_sessionImpl.GetHandle(),
wxString(urlComps.lpszHostName, urlComps.dwHostNameLength).wc_str(), wxString(urlComps.lpszHostName, urlComps.dwHostNameLength).wc_str(),
@@ -334,7 +418,7 @@ void wxWebRequestWinHTTP::Start()
// Open a request // Open a request
static const wchar_t* acceptedTypes[] = { L"*/*", NULL }; static const wchar_t* acceptedTypes[] = { L"*/*", NULL };
m_request = ::WinHttpOpenRequest m_request = wxWinHTTP::WinHttpOpenRequest
( (
m_connect, m_connect,
method.wc_str(), objectName.wc_str(), method.wc_str(), objectName.wc_str(),
@@ -352,7 +436,7 @@ void wxWebRequestWinHTTP::Start()
} }
// Register callback // Register callback
if ( ::WinHttpSetStatusCallback if ( wxWinHTTP::WinHttpSetStatusCallback
( (
m_request, m_request,
wxRequestStatusCallback, wxRequestStatusCallback,
@@ -397,7 +481,7 @@ void wxWebRequestWinHTTP::SendRequest()
SetState(wxWebRequest::State_Active); SetState(wxWebRequest::State_Active);
// Send request // Send request
if ( !::WinHttpSendRequest if ( !wxWinHTTP::WinHttpSendRequest
( (
m_request, m_request,
allHeaders.wc_str(), allHeaders.length(), allHeaders.wc_str(), allHeaders.length(),
@@ -452,7 +536,7 @@ int wxWebResponseWinHTTP::GetStatus() const
{ {
DWORD status = 0; DWORD status = 0;
DWORD statusSize = sizeof(status); DWORD statusSize = sizeof(status);
if ( !::WinHttpQueryHeaders if ( !wxWinHTTP::WinHttpQueryHeaders
( (
m_requestHandle, m_requestHandle,
WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER,
@@ -477,7 +561,7 @@ bool wxWebResponseWinHTTP::ReadData()
{ {
wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: reading data", &m_request); wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: reading data", &m_request);
return ::WinHttpReadData return wxWinHTTP::WinHttpReadData
( (
m_requestHandle, m_requestHandle,
GetDataBuffer(m_readSize), GetDataBuffer(m_readSize),
@@ -510,7 +594,7 @@ bool wxWebAuthChallengeWinHTTP::Init()
DWORD supportedSchemes; DWORD supportedSchemes;
DWORD firstScheme; DWORD firstScheme;
if ( !::WinHttpQueryAuthSchemes if ( !wxWinHTTP::WinHttpQueryAuthSchemes
( (
m_request.GetHandle(), m_request.GetHandle(),
&supportedSchemes, &supportedSchemes,
@@ -541,7 +625,7 @@ bool wxWebAuthChallengeWinHTTP::Init()
void void
wxWebAuthChallengeWinHTTP::SetCredentials(const wxWebCredentials& cred) wxWebAuthChallengeWinHTTP::SetCredentials(const wxWebCredentials& cred)
{ {
if ( !::WinHttpSetCredentials if ( !wxWinHTTP::WinHttpSetCredentials
( (
m_request.GetHandle(), m_request.GetHandle(),
m_target, m_target,
@@ -574,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;
@@ -582,7 +671,7 @@ bool wxWebSessionWinHTTP::Open()
else else
accessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY; accessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
m_handle = ::WinHttpOpen m_handle = wxWinHTTP::WinHttpOpen
( (
GetHeaders().find("User-Agent")->second.wc_str(), GetHeaders().find("User-Agent")->second.wc_str(),
accessType, accessType,

View File

@@ -12,7 +12,7 @@
#include "wx/webrequest.h" #include "wx/webrequest.h"
#if wxUSE_WEBREQUEST_URLSESSION #if wxUSE_WEBREQUEST && wxUSE_WEBREQUEST_URLSESSION
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>