winhttp: Do not reference request from socket.

This commit is contained in:
Paul Gofman 2022-11-15 15:26:10 -06:00 committed by Alexandre Julliard
parent 50bea867d2
commit 289d21a5d2
3 changed files with 5 additions and 8 deletions

View file

@ -3191,7 +3191,6 @@ static void socket_destroy( struct object_header *hdr )
stop_queue( &socket->recv_q );
netconn_release( socket->netconn );
release_object( &socket->request->hdr );
free( socket->read_buffer );
free( socket->send_frame_buffer );
free( socket );
@ -3286,9 +3285,6 @@ HINTERNET WINAPI WinHttpWebSocketCompleteUpgrade( HINTERNET hrequest, DWORD_PTR
netconn_addref( request->netconn );
socket->netconn = request->netconn;
addref_object( &request->hdr );
socket->request = request;
netconn_set_timeout( socket->netconn, FALSE, socket->keepalive_interval );
if ((hsocket = alloc_handle( &socket->hdr )))

View file

@ -671,7 +671,8 @@ static const struct notification websocket_test[] =
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, NF_SIGNAL },
{ winhttp_websocket_complete_upgrade, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, NF_SIGNAL },
{ winhttp_websocket_complete_upgrade, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
{ winhttp_websocket_complete_upgrade, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, NF_SIGNAL },
{ winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_MAIN_THREAD | NF_SIGNAL },
{ winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_MAIN_THREAD | NF_SIGNAL },
{ winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_MAIN_THREAD | NF_SIGNAL },
@ -680,7 +681,6 @@ static const struct notification websocket_test[] =
{ winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SAVE_BUFFER | NF_SIGNAL },
{ winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SAVE_BUFFER | NF_SIGNAL },
{ winhttp_websocket_close, WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE, NF_SIGNAL },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, NF_SIGNAL },
};
@ -911,6 +911,9 @@ static void test_websocket(BOOL secure)
err = GetLastError();
ok( socket != NULL, "got %lu\n", err );
ok( err == ERROR_SUCCESS, "got %lu\n", err );
WinHttpCloseHandle( request );
WaitForSingleObject( info.wait, INFINITE );
/* The send is executed synchronously (even if sending a reasonably big buffer exceeding SSL buffer size).
@ -1029,7 +1032,6 @@ static void test_websocket(BOOL secure)
setup_test( &info, winhttp_close_handle, __LINE__ );
WinHttpCloseHandle( socket );
WinHttpCloseHandle( request );
WaitForSingleObject( info.wait, INFINITE );
end_test( &info, __LINE__ );

View file

@ -256,7 +256,6 @@ enum fragment_type
struct socket
{
struct object_header hdr;
struct request *request;
struct netconn *netconn;
int keepalive_interval;
unsigned int send_buffer_size;