diff --git a/src/msw/webrequest_winhttp.cpp b/src/msw/webrequest_winhttp.cpp index 49504568aa..46ed71bd7a 100644 --- a/src/msw/webrequest_winhttp.cpp +++ b/src/msw/webrequest_winhttp.cpp @@ -190,7 +190,13 @@ void wxWebRequestWinHTTP::HandleCallback(DWORD dwInternetStatus, case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR: { LPWINHTTP_ASYNC_RESULT asyncResult = reinterpret_cast(lpvStatusInformation); - SetState(wxWebRequest::State_Failed, wxWinHTTPErrorToString(asyncResult->dwError)); + // "Failing" with "cancelled" error is not actually an error if + // we're expecting it, i.e. if our Cancel() had been called. + if ( asyncResult->dwError == ERROR_WINHTTP_OPERATION_CANCELLED && + GetState() == wxWebRequest::State_Cancelled ) + SetState(wxWebRequest::State_Cancelled); + else + SetState(wxWebRequest::State_Failed, wxWinHTTPErrorToString(asyncResult->dwError)); break; } }