winhttp: Return an error from WinHttpReceiveResponse if there's no connection.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46175
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2018-11-22 21:15:57 +01:00 committed by Alexandre Julliard
parent 2a4d6273f5
commit bcf885bda2
2 changed files with 11 additions and 0 deletions

View File

@ -2736,6 +2736,12 @@ static BOOL receive_response( struct request *request, BOOL async )
BOOL ret; BOOL ret;
DWORD size, query, status; DWORD size, query, status;
if (!request->netconn)
{
SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_STATE );
return FALSE;
}
netconn_set_timeout( request->netconn, FALSE, request->receive_response_timeout ); netconn_set_timeout( request->netconn, FALSE, request->receive_response_timeout );
for (;;) for (;;)
{ {

View File

@ -2086,6 +2086,11 @@ static void test_resolve_timeout(void)
ok(GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED, ok(GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED,
"expected ERROR_WINHTTP_NAME_NOT_RESOLVED got %u\n", GetLastError()); "expected ERROR_WINHTTP_NAME_NOT_RESOLVED got %u\n", GetLastError());
ret = WinHttpReceiveResponse( req, NULL );
ok( !ret && (GetLastError() == ERROR_WINHTTP_INCORRECT_HANDLE_STATE ||
GetLastError() == ERROR_WINHTTP_OPERATION_CANCELLED /* < win7 */),
"got %u\n", GetLastError() );
WinHttpCloseHandle(req); WinHttpCloseHandle(req);
WinHttpCloseHandle(con); WinHttpCloseHandle(con);
WinHttpCloseHandle(ses); WinHttpCloseHandle(ses);