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

This commit is contained in:
Hans Leidekker 2008-05-31 21:46:34 +02:00 committed by Alexandre Julliard
parent 2f99450c49
commit 9d55252d41
2 changed files with 22 additions and 8 deletions

View File

@ -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 );

View File

@ -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) \