rpcrt4: Properly handle async HTTP failures.

This commit is contained in:
Jacek Caban 2012-08-14 13:35:46 +02:00 committed by Alexandre Julliard
parent 9eeedc2723
commit 1de4129b0a
1 changed files with 9 additions and 0 deletions

View File

@ -1844,6 +1844,7 @@ typedef struct _RpcHttpAsyncData
{ {
LONG refs; LONG refs;
HANDLE completion_event; HANDLE completion_event;
WORD async_result;
INTERNET_BUFFERSA inet_buffers; INTERNET_BUFFERSA inet_buffers;
CRITICAL_SECTION cs; CRITICAL_SECTION cs;
} RpcHttpAsyncData; } RpcHttpAsyncData;
@ -1897,6 +1898,11 @@ static RPC_STATUS wait_async_request(RpcHttpAsyncData *async_data, BOOL call_ret
}else { }else {
WaitForSingleObject(async_data->completion_event, INFINITE); WaitForSingleObject(async_data->completion_event, INFINITE);
} }
if(async_data->async_result) {
ERR("Async request failed with error %d\n", async_data->async_result);
return RPC_S_SERVER_UNAVAILABLE;
}
return RPC_S_OK; return RPC_S_OK;
} }
@ -2007,6 +2013,9 @@ static VOID WINAPI rpcrt4_http_internet_callback(
TRACE("INTERNET_STATUS_REQUEST_COMPLETED\n"); TRACE("INTERNET_STATUS_REQUEST_COMPLETED\n");
if (async_data) if (async_data)
{ {
INTERNET_ASYNC_RESULT *async_result = lpvStatusInformation;
async_data->async_result = async_result->dwResult ? ERROR_SUCCESS : async_result->dwError;
SetEvent(async_data->completion_event); SetEvent(async_data->completion_event);
RpcHttpAsyncData_Release(async_data); RpcHttpAsyncData_Release(async_data);
} }