From: Hans Leidekker <hans@codeweavers.com> --- dlls/winhttp/request.c | 6 ++++++ dlls/winhttp/tests/winhttp.c | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 3a191cb1a70..df55f90bd01 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3176,6 +3176,12 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); return FALSE; } + if (request->state < REQUEST_RESPONSE_STATE_RESPONSE_RECEIVED) + { + release_object( &request->hdr ); + SetLastError( ERROR_WINHTTP_INCORRECT_HANDLE_STATE ); + return FALSE; + } if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block, 1 )) { diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 00e2c7be649..f2e802c51b7 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -3239,13 +3239,10 @@ static void test_no_content(int port) size = 12345; SetLastError(0xdeadbeef); ret = WinHttpQueryDataAvailable(req, &size); - todo_wine { ok(!ret, "expected error\n"); ok(GetLastError() == ERROR_WINHTTP_INCORRECT_HANDLE_STATE, "expected ERROR_WINHTTP_INCORRECT_HANDLE_STATE, got %lu\n", GetLastError()); - ok(size == 12345 || broken(size == 0) /* Win <= 2003 */, - "expected 12345, got %lu\n", size); - } + ok(size == 12345, "expected 12345, got %lu\n", size); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); ok(ret, "expected success\n"); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10346