Check for errors when calling WinHttpCloseHandle()
Add a trivial wxWinHTTPCloseHandle() wrapper calling wxLogLastError() if closing the handle failed -- this is really not expected to happen, so make sure to at least log it if it does.
This commit is contained in:
@@ -101,6 +101,15 @@ void wxWinHTTPSetOption(HINTERNET hInternet, DWORD dwOption, DWORD dwValue)
|
|||||||
::WinHttpSetOption(hInternet, dwOption, &dwValue, sizeof(dwValue));
|
::WinHttpSetOption(hInternet, dwOption, &dwValue, sizeof(dwValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void wxWinHTTPCloseHandle(HINTERNET hInternet)
|
||||||
|
{
|
||||||
|
if ( !::WinHttpCloseHandle(hInternet) )
|
||||||
|
{
|
||||||
|
wxLogLastError("WinHttpCloseHandle");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void CALLBACK wxRequestStatusCallback(
|
static void CALLBACK wxRequestStatusCallback(
|
||||||
HINTERNET WXUNUSED(hInternet),
|
HINTERNET WXUNUSED(hInternet),
|
||||||
DWORD_PTR dwContext,
|
DWORD_PTR dwContext,
|
||||||
@@ -139,9 +148,9 @@ wxWebRequestWinHTTP::wxWebRequestWinHTTP(wxWebSession& session,
|
|||||||
wxWebRequestWinHTTP::~wxWebRequestWinHTTP()
|
wxWebRequestWinHTTP::~wxWebRequestWinHTTP()
|
||||||
{
|
{
|
||||||
if ( m_request )
|
if ( m_request )
|
||||||
::WinHttpCloseHandle(m_request);
|
wxWinHTTPCloseHandle(m_request);
|
||||||
if ( m_connect )
|
if ( m_connect )
|
||||||
::WinHttpCloseHandle(m_connect);
|
wxWinHTTPCloseHandle(m_connect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -396,7 +405,7 @@ void wxWebRequestWinHTTP::Cancel()
|
|||||||
SetState(wxWebRequest::State_Cancelled);
|
SetState(wxWebRequest::State_Cancelled);
|
||||||
if ( m_request != NULL )
|
if ( m_request != NULL )
|
||||||
{
|
{
|
||||||
::WinHttpCloseHandle(m_request);
|
wxWinHTTPCloseHandle(m_request);
|
||||||
m_request = NULL;
|
m_request = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -555,7 +564,7 @@ wxWebSessionWinHTTP::wxWebSessionWinHTTP():
|
|||||||
wxWebSessionWinHTTP::~wxWebSessionWinHTTP()
|
wxWebSessionWinHTTP::~wxWebSessionWinHTTP()
|
||||||
{
|
{
|
||||||
if ( m_handle )
|
if ( m_handle )
|
||||||
::WinHttpCloseHandle(m_handle);
|
wxWinHTTPCloseHandle(m_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWebSessionWinHTTP::Open()
|
bool wxWebSessionWinHTTP::Open()
|
||||||
|
Reference in New Issue
Block a user