WebSocket ping, fixes, coverage:

* Improve test coverage
* tests for invokable in composed ops

* Update documentation
* Add License badge to README
* Target Windows 7 SDK and later
* Make role_type private
* Remove extra unused masking functions
* Allow stream reuse / reconnect after failure
* Restructure logic of composed operations
* Allow 0 for read_message_max meaning no limit
* Respect keep alive when building HTTP responses
* Check version in upgrade request
* Response with 426 status on unsupported WebSocket version
* Remove unnecessary Sec-WebSocket-Key in HTTP responses
* Rename to mask_buffer_size

* Remove maybe_throw
* Add ping, async_ping, async_on_pong
* Add ping_op
* Add pong_op
* Fix crash in accept_op
* Fix suspend in close_op
* Fix read_frame_op logic
* Fix crash in read_op
* Fix races in echo sync and async echo servers
This commit is contained in:
Vinnie Falco
2016-05-15 16:22:25 -04:00
parent bfb840fe8e
commit 039244cda4
40 changed files with 2757 additions and 1365 deletions

View File

@@ -60,6 +60,13 @@ enum
protocol_error = 1002,
unknown_data = 1003,
/// Indicates a received close frame has no close code
//no_code = 1005, // TODO
/// Indicates the connection was closed without receiving a close frame
no_close = 1006,
bad_payload = 1007,
policy_error = 1008,
too_big = 1009,
@@ -80,12 +87,11 @@ enum
} // close_code
#endif
#if ! GENERATING_DOCS
using reason_string_type =
static_string<123, char>;
using ping_payload_type =
static_string<125, char>;
#endif
/// The type representing the reason string in a close frame.
using reason_string = static_string<123, char>;
/// The type representing the payload of ping and pong messages.
using ping_data = static_string<125, char>;
/** Description of the close reason.
@@ -98,7 +104,7 @@ struct close_reason
close_code::value code = close_code::none;
/// The optional utf8-encoded reason string.
reason_string_type reason;
reason_string reason;
/** Default constructor.
@@ -114,17 +120,17 @@ struct close_reason
}
/// Construct from a reason. code is close_code::normal.
template<class CharT>
close_reason(CharT const* reason_)
template<std::size_t N>
close_reason(char const (&reason_)[N])
: code(close_code::normal)
, reason(reason_)
{
}
/// Construct from a code and reason.
template<class CharT>
template<std::size_t N>
close_reason(close_code::value code_,
CharT const* reason_)
char const (&reason_)[N])
: code(code_)
, reason(reason_)
{
@@ -137,20 +143,6 @@ struct close_reason
}
};
#if ! GENERATING_DOCS
/// Identifies the role of a WebSockets stream.
enum class role_type
{
/// Stream is operating as a client.
client,
/// Stream is operating as a server.
server
};
#endif
} // websocket
} // beast