Commit 9d55252d authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

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

parent 2f99450c
...@@ -181,9 +181,13 @@ BOOL WININET_Release( LPWININETHANDLEHEADER info ) ...@@ -181,9 +181,13 @@ BOOL WININET_Release( LPWININETHANDLEHEADER info )
TRACE( "closing connection %p\n", info); TRACE( "closing connection %p\n", info);
info->vtbl->CloseConnection( info ); info->vtbl->CloseConnection( info );
} }
INTERNET_SendCallback(info, info->dwContext, /* Don't send a callback if this is a session handle created with InternetOpenUrl */
INTERNET_STATUS_HANDLE_CLOSING, &info->hInternet, if (info->htype != WH_HHTTPSESSION || !(info->dwInternalFlags & INET_OPENURL))
sizeof(HINTERNET)); {
INTERNET_SendCallback(info, info->dwContext,
INTERNET_STATUS_HANDLE_CLOSING, &info->hInternet,
sizeof(HINTERNET));
}
TRACE( "destroying object %p\n", info); TRACE( "destroying object %p\n", info);
if ( info->htype != WH_HINIT ) if ( info->htype != WH_HINIT )
list_remove( &info->entry ); list_remove( &info->entry );
......
...@@ -1809,18 +1809,25 @@ struct context ...@@ -1809,18 +1809,25 @@ struct context
static void WINAPI cb(HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID info, DWORD size) 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); trace("%p 0x%08lx %u %p 0x%08x\n", handle, context, status, info, size);
if (status == INTERNET_STATUS_REQUEST_COMPLETE) 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); trace("request handle: 0x%08lx\n", result->dwResult);
ctx->req = (HINTERNET)result->dwResult; ctx->req = (HINTERNET)result->dwResult;
SetEvent(ctx->event); 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) static void test_open_url_async(void)
...@@ -1857,9 +1864,12 @@ 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(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "HttpQueryInfo failed\n");
ok(size > 0, "expected size > 0\n"); ok(size > 0, "expected size > 0\n");
CloseHandle(ctx.event); ResetEvent(ctx.event);
InternetCloseHandle(ctx.req); InternetCloseHandle(ctx.req);
WaitForSingleObject(ctx.event, INFINITE);
InternetCloseHandle(ses); InternetCloseHandle(ses);
CloseHandle(ctx.event);
} }
#define STATUS_STRING(status) \ #define STATUS_STRING(status) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment