Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/boost/beast/websocket/detail/frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 3 additions & 6 deletions include/boost/beast/websocket/rfc6455.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/beast/websocket/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ class frame_test
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));
Expand Down
Loading