diff --git a/dlls/winhttp/handle.c b/dlls/winhttp/handle.c index 9c77d5166ad..08052b91ee3 100644 --- a/dlls/winhttp/handle.c +++ b/dlls/winhttp/handle.c @@ -79,7 +79,6 @@ void release_object( struct object_header *hdr ) send_callback( hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, &hdr->handle, sizeof(HINTERNET) ); TRACE("destroying object %p\n", hdr); - if (hdr->type != WINHTTP_HANDLE_TYPE_SESSION) list_remove( &hdr->entry ); hdr->vtbl->destroy( hdr ); } } @@ -89,7 +88,6 @@ HINTERNET alloc_handle( struct object_header *hdr ) struct object_header **p; ULONG_PTR handle, num; - list_init( &hdr->children ); hdr->handle = NULL; EnterCriticalSection( &handle_cs ); @@ -123,7 +121,7 @@ BOOL free_handle( HINTERNET hinternet ) { BOOL ret = FALSE; ULONG_PTR handle = (ULONG_PTR)hinternet; - struct object_header *hdr = NULL, *child, *next; + struct object_header *hdr = NULL; EnterCriticalSection( &handle_cs ); @@ -141,15 +139,7 @@ BOOL free_handle( HINTERNET hinternet ) LeaveCriticalSection( &handle_cs ); - if (hdr) - { - LIST_FOR_EACH_ENTRY_SAFE( child, next, &hdr->children, struct object_header, entry ) - { - TRACE("freeing child handle %p for parent handle 0x%lx\n", child->handle, handle + 1); - free_handle( child->handle ); - } - release_object( hdr ); - } + if (hdr) release_object( hdr ); EnterCriticalSection( &handle_cs ); if (next_handle > handle && !handles[handle]) next_handle = handle; diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 0511dd44eec..08e9d7584ed 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3102,11 +3102,9 @@ HINTERNET WINAPI WinHttpWebSocketCompleteUpgrade( HINTERNET hrequest, DWORD_PTR socket->hdr.vtbl = &socket_vtbl; socket->hdr.refs = 1; socket->hdr.context = context; - list_init( &socket->hdr.children ); addref_object( &request->hdr ); socket->request = request; - list_add_head( &request->hdr.children, &socket->hdr.entry ); if ((hsocket = alloc_handle( &socket->hdr ))) socket->hdr.handle = hsocket; diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 87974ffbd8e..13d228d8513 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -246,7 +246,6 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST session->hdr.flags = flags; session->hdr.refs = 1; session->hdr.redirect_policy = WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP; - list_init( &session->hdr.children ); session->resolve_timeout = DEFAULT_RESOLVE_TIMEOUT; session->connect_timeout = DEFAULT_CONNECT_TIMEOUT; session->send_timeout = DEFAULT_SEND_TIMEOUT; @@ -552,11 +551,9 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO connect->hdr.notify_mask = session->hdr.notify_mask; connect->hdr.context = session->hdr.context; connect->hdr.redirect_policy = session->hdr.redirect_policy; - list_init( &connect->hdr.children ); addref_object( &session->hdr ); connect->session = session; - list_add_head( &session->hdr.children, &connect->hdr.entry ); if (!(connect->hostname = strdupW( server ))) goto end; connect->hostport = port; @@ -1121,12 +1118,10 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o request->hdr.notify_mask = connect->hdr.notify_mask; request->hdr.context = connect->hdr.context; request->hdr.redirect_policy = connect->hdr.redirect_policy; - list_init( &request->hdr.children ); list_init( &request->task_queue ); addref_object( &connect->hdr ); request->connect = connect; - list_add_head( &connect->hdr.children, &request->hdr.entry ); request->resolve_timeout = connect->session->resolve_timeout; request->connect_timeout = connect->session->connect_timeout; diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 8083c4825b2..be02bbe2502 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -3099,6 +3099,7 @@ static void test_websocket(int port) { HINTERNET session, connection, request, socket; DWORD size, len, count, status, index, error; + DWORD_PTR ctx; WCHAR header[32]; char buf[128]; BOOL ret; @@ -3244,10 +3245,28 @@ static void test_websocket(int port) /* Send/Receive on websock */ - WinHttpCloseHandle(request); - WinHttpCloseHandle(socket); - WinHttpCloseHandle(connection); - WinHttpCloseHandle(session); + ret = WinHttpCloseHandle(connection); + ok(ret, "got %u\n", GetLastError()); + + /* request handle is still valid */ + size = sizeof(ctx); + ret = WinHttpQueryOption(request, WINHTTP_OPTION_CONTEXT_VALUE, &ctx, &size); + ok(ret, "got %u\n", GetLastError()); + + ret = WinHttpCloseHandle(socket); + ok(ret, "got %u\n", GetLastError()); + + ret = WinHttpQueryOption(request, WINHTTP_OPTION_CONTEXT_VALUE, &ctx, &size); + ok(ret, "got %u\n", GetLastError()); + + ret = WinHttpCloseHandle(session); + ok(ret, "got %u\n", GetLastError()); + + ret = WinHttpQueryOption(request, WINHTTP_OPTION_CONTEXT_VALUE, &ctx, &size); + ok(ret, "got %u\n", GetLastError()); + + ret = WinHttpCloseHandle(request); + ok(ret, "got %u\n", GetLastError()); } static void test_not_modified(int port) diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index af695f86c3e..9b07b64b090 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -51,7 +51,6 @@ struct object_header WINHTTP_STATUS_CALLBACK callback; DWORD notify_mask; struct list entry; - struct list children; }; struct hostdata