accept websocket close code 1014 (bad gateway)

This commit is contained in:
sahvx655-wq
2026-06-14 22:55:02 +05:30
committed by Mohammad Nejati
parent c0562a75fc
commit d8316541cf
3 changed files with 6 additions and 7 deletions
@@ -106,13 +106,13 @@ is_valid_close_code(std::uint16_t v)
case close_code::internal_error: // 1011
case close_code::service_restart: // 1012
case close_code::try_again_later: // 1013
case close_code::bad_gateway: // 1014
return true;
// explicitly reserved
case close_code::reserved1: // 1004
case close_code::no_status: // 1005
case close_code::abnormal: // 1006
case close_code::reserved2: // 1014
case close_code::reserved3: // 1015
return false;
}
+3 -6
View File
@@ -107,6 +107,9 @@ enum close_code : std::uint16_t
/// The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients.
try_again_later = 1013,
/// The endpoint, acting as a gateway or proxy, received an invalid response from an upstream server, analogous to HTTP status 502.
bad_gateway = 1014,
//----
//
// The following are illegal on the wire
@@ -137,13 +140,7 @@ enum close_code : std::uint16_t
abnormal = 1006,
/** Reserved for future use by the WebSocket standard.
This code is reserved and may not be sent.
*/
reserved2 = 1014,
/** Reserved for future use by the WebSocket standard.
This code is reserved and may not be sent.
*/
reserved3 = 1015
+2
View File
@@ -27,11 +27,13 @@ public:
BEAST_EXPECT(! is_valid_close_code(1004));
BEAST_EXPECT(! is_valid_close_code(1005));
BEAST_EXPECT(! is_valid_close_code(1006));
BEAST_EXPECT(! is_valid_close_code(1015));
BEAST_EXPECT(! is_valid_close_code(1016));
BEAST_EXPECT(! is_valid_close_code(2000));
BEAST_EXPECT(! is_valid_close_code(2999));
BEAST_EXPECT(is_valid_close_code(1000));
BEAST_EXPECT(is_valid_close_code(1002));
BEAST_EXPECT(is_valid_close_code(1014));
BEAST_EXPECT(is_valid_close_code(3000));
BEAST_EXPECT(is_valid_close_code(4000));
BEAST_EXPECT(is_valid_close_code(5000));