From c10c3c82cc0d597b7adeea1b084cbb47fdc9212b Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 26 Nov 2026 21:52:24 -0500 Subject: [PATCH] Drop the 16 MiB WebSocket payload tests that other tests cover MaxPayloadExceeded and MaxPayloadAtLimit pushed messages at the default limit through the echo route. A message over the limit is refused in ServerMaxMessageLength and FailsABadFrameWithACloseStatus, one at the limit is accepted in ServerMaxMessageLength, and LargeMessage covers a payload read in many pieces, so the pair only cost time (about 230 ms locally). --- test/test.cc | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/test/test.cc b/test/test.cc index 41269b4f..3ad1df9e 100644 --- a/test/test.cc +++ b/test/test.cc @@ -29398,41 +29398,6 @@ TEST_F(WebSocketIntegrationTest, ReadTimeoutSetAfterConnect) { EXPECT_TRUE(client.is_open()); } -TEST_F(WebSocketIntegrationTest, MaxPayloadExceeded) { - ws::WebSocketClient client("ws://localhost:" + std::to_string(port_) + - "/ws-echo"); - client.set_read_timeout(5, 0); - ASSERT_TRUE(client.connect()); - - // Send a message exceeding CPPHTTPLIB_WEBSOCKET_MAX_PAYLOAD_LENGTH (16MB). - // The server should reject it and close the connection. - std::string oversized(CPPHTTPLIB_WEBSOCKET_MAX_PAYLOAD_LENGTH + 1, 'A'); - client.send(oversized); - - // The server's read() should have failed due to payload limit, - // so our read() should return false (connection closed). - std::string msg; - EXPECT_FALSE(client.read(msg)); -} - -TEST_F(WebSocketIntegrationTest, MaxPayloadAtLimit) { - ws::WebSocketClient client("ws://localhost:" + std::to_string(port_) + - "/ws-echo"); - client.set_read_timeout(10, 0); - ASSERT_TRUE(client.connect()); - - // Send a message exactly at CPPHTTPLIB_WEBSOCKET_MAX_PAYLOAD_LENGTH (16MB). - // This should succeed. - std::string at_limit(CPPHTTPLIB_WEBSOCKET_MAX_PAYLOAD_LENGTH, 'B'); - ASSERT_TRUE(client.send(at_limit)); - - std::string msg; - ASSERT_TRUE(client.read(msg)); - EXPECT_EQ(at_limit.size(), msg.size()); - - client.close(); -} - TEST_F(WebSocketIntegrationTest, ConnectToInvalidPath) { ws::WebSocketClient client("ws://localhost:" + std::to_string(port_) + "/nonexistent");