Hans Leidekker : winhttp: Return an error from WinHttpReceiveResponse if there's no connection.
Alexandre Julliard
julliard at winehq.org
Thu Nov 22 17:00:31 CST 2018
Module: wine
Branch: master
Commit: bcf885bda20bc8445397fa5312668c2c3a5a9207
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bcf885bda20bc8445397fa5312668c2c3a5a9207
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Nov 22 21:15:57 2018 +0100
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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winhttp/request.c | 6 ++++++
dlls/winhttp/tests/winhttp.c | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 54173f1..27628c3 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -2736,6 +2736,12 @@ static BOOL receive_response( struct request *request, BOOL async )
BOOL ret;
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 );
for (;;)
{
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 4779cfd..3f91251 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -2086,6 +2086,11 @@ static void test_resolve_timeout(void)
ok(GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED,
"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(con);
WinHttpCloseHandle(ses);
More information about the wine-cvs
mailing list