wininet: InternetReadFileExA should check INTERNET_FLAG_ASYNC.

Dan Hipschman dsh at linux.ucla.edu
Thu Mar 27 15:52:24 CDT 2008


Like the comment says...  This doesn't get tested very easily just by grabbing
the /about page of winehq.org, but I tested it against a CGI script that
trickles back data, something like:

#!/bin/bash
sleep 1
echo Content-type: text/plain
sleep 1
echo
sleep 5
echo Hi
sleep 5
echo Bye
sleep 5

and then you can see the IO_PENDING path getting executed.  This passes on both
Wine and Windows, but, by the way, several other tests fail in both
environments with the above script; so it seems some of the existing tests are
incorrect.  Here are a few Windows failures:

http.c:584: Test failed: expected status 10 (INTERNET_STATUS_RESOLVING_NAME) 0 times, received 1 times
http.c:585: Test failed: expected status 11 (INTERNET_STATUS_NAME_RESOLVED) 0 times, received 1 times
http.c:587: Test failed: expected status 30 (INTERNET_STATUS_SENDING_REQUEST) 2 times, received 1 times
http.c:588: Test failed: expected status 31 (INTERNET_STATUS_REQUEST_SENT) 2 times, received 1 times
http.c:589: Test failed: expected status 40 (INTERNET_STATUS_RECEIVING_RESPONSE) 2 times, received 1 times
http.c:590: Test failed: expected status 41 (INTERNET_STATUS_RESPONSE_RECEIVED) 2 times, received 1 times
http.c:591: Test failed: expected status 110 (INTERNET_STATUS_REDIRECT) 1 times, received 0 times

I'll file a bug for that.

---
 dlls/wininet/http.c       |    4 +---
 dlls/wininet/tests/http.c |    2 ++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index fc458d4..3980e9a 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -1733,9 +1733,7 @@ static DWORD HTTPREQ_ReadFileExA(WININETHANDLEHEADER *hdr, INTERNET_BUFFERSA *bu
 
     INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
 
-    /* FIXME: IRF_ASYNC may not be the right thing to test here;
-     * hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC is probably better */
-    if (flags & IRF_ASYNC) {
+    if (hdr->dwFlags & INTERNET_FLAG_ASYNC) {
         DWORD available = 0;
 
         NETCON_query_data_available(&req->netConnection, &available);
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index fb561c4..5d42077 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -659,6 +659,8 @@ static void InternetReadFileExA_test(int flags)
             if (GetLastError() == ERROR_IO_PENDING)
             {
                 trace("InternetReadFileEx -> PENDING\n");
+                ok(flags & INTERNET_FLAG_ASYNC,
+                   "Should not get ERROR_IO_PENDING without INTERNET_FLAG_ASYNC\n");
                 CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
                 WaitForSingleObject(hCompleteEvent, INFINITE);
                 CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);



More information about the wine-patches mailing list