Hans Leidekker : wininet: Don' t send a handle closing callback for session handles created with InternetOpenUrl .

Alexandre Julliard julliard at winehq.org
Mon Jun 2 07:24:24 CDT 2008


Module: wine
Branch: master
Commit: 9d55252d41f2c6b578c76716c1d113588d700c0e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9d55252d41f2c6b578c76716c1d113588d700c0e

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Sat May 31 21:46:34 2008 +0200

wininet: Don't send a handle closing callback for session handles created with InternetOpenUrl.

---

 dlls/wininet/internet.c   |   10 +++++++---
 dlls/wininet/tests/http.c |   20 +++++++++++++++-----
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index d4734a4..a7a28c1 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -181,9 +181,13 @@ BOOL WININET_Release( LPWININETHANDLEHEADER info )
             TRACE( "closing connection %p\n", info);
             info->vtbl->CloseConnection( info );
         }
-        INTERNET_SendCallback(info, info->dwContext,
-                              INTERNET_STATUS_HANDLE_CLOSING, &info->hInternet,
-                              sizeof(HINTERNET));
+        /* Don't send a callback if this is a session handle created with InternetOpenUrl */
+        if (info->htype != WH_HHTTPSESSION || !(info->dwInternalFlags & INET_OPENURL))
+        {
+            INTERNET_SendCallback(info, info->dwContext,
+                                  INTERNET_STATUS_HANDLE_CLOSING, &info->hInternet,
+                                  sizeof(HINTERNET));
+        }
         TRACE( "destroying object %p\n", info);
         if ( info->htype != WH_HINIT )
             list_remove( &info->entry );
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index ccaf324..cd2aba2 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1809,18 +1809,25 @@ struct context
 
 static void WINAPI cb(HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID info, DWORD size)
 {
+    INTERNET_ASYNC_RESULT *result = info;
+    struct context *ctx = (struct context *)context;
+
     trace("%p 0x%08lx %u %p 0x%08x\n", handle, context, status, info, size);
 
     if (status == INTERNET_STATUS_REQUEST_COMPLETE)
     {
-        INTERNET_ASYNC_RESULT *result = info;
-        struct context *ctx = (struct context *)context;
-
         trace("request handle: 0x%08lx\n", result->dwResult);
-
         ctx->req = (HINTERNET)result->dwResult;
         SetEvent(ctx->event);
     }
+    if (status == INTERNET_STATUS_HANDLE_CLOSING)
+    {
+        DWORD type = INTERNET_HANDLE_TYPE_CONNECT_HTTP, size = sizeof(type);
+
+        if (InternetQueryOption(handle, INTERNET_OPTION_HANDLE_TYPE, &type, &size))
+            ok(type != INTERNET_HANDLE_TYPE_CONNECT_HTTP, "unexpected callback\n");
+        SetEvent(ctx->event);
+    }
 }
 
 static void test_open_url_async(void)
@@ -1857,9 +1864,12 @@ static void test_open_url_async(void)
     ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "HttpQueryInfo failed\n");
     ok(size > 0, "expected size > 0\n");
 
-    CloseHandle(ctx.event);
+    ResetEvent(ctx.event);
     InternetCloseHandle(ctx.req);
+    WaitForSingleObject(ctx.event, INFINITE);
+
     InternetCloseHandle(ses);
+    CloseHandle(ctx.event);
 }
 
 #define STATUS_STRING(status) \




More information about the wine-cvs mailing list