diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 907ee538f54..f215b984f6e 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3554,7 +3554,7 @@ DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, D release_object( &socket->hdr ); return ERROR_WINHTTP_INCORRECT_HANDLE_TYPE; } - if (socket->state != SOCKET_STATE_OPEN) + if (socket->state > SOCKET_STATE_SHUTDOWN) { release_object( &socket->hdr ); return ERROR_WINHTTP_INCORRECT_HANDLE_STATE; diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index ce585087370..6b0e11023da 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -659,9 +659,9 @@ static const struct notification websocket_test[] = { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, NF_SIGNAL }, { winhttp_websocket_complete_upgrade, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, NF_SIGNAL }, { winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_SIGNAL }, - { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }, - { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }, { winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NF_SIGNAL }, + { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }, + { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, 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_CLOSING_CONNECTION, NF_WINE_ALLOW }, @@ -793,6 +793,11 @@ static void test_websocket(BOOL secure) ok( err == ERROR_SUCCESS, "got %u\n", err ); WaitForSingleObject( info.wait, INFINITE ); + setup_test( &info, winhttp_websocket_shutdown, __LINE__ ); + err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") ); + ok( err == ERROR_SUCCESS, "got %u\n", err ); + WaitForSingleObject( info.wait, INFINITE ); + setup_test( &info, winhttp_websocket_receive, __LINE__ ); buffer[0] = 0; size = 0xdeadbeef; @@ -815,11 +820,6 @@ static void test_websocket(BOOL secure) ok( type == 0xdeadbeef, "got %u\n", type ); ok( buffer[0] == 'h', "unexpected data\n" ); - setup_test( &info, winhttp_websocket_shutdown, __LINE__ ); - err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") ); - ok( err == ERROR_SUCCESS, "got %u\n", err ); - WaitForSingleObject( info.wait, INFINITE ); - setup_test( &info, winhttp_websocket_close, __LINE__ ); ret = pWinHttpWebSocketClose( socket, 1000, (void *)"success", sizeof("success") ); ok( err == ERROR_SUCCESS, "got %u\n", err );