fix#941, fix#1016
`get_lowest_layer` is now a type alias for the
lowest layer instead of a struct with a nested type.
Actions required:
* Replace instances of `typename get_lowest_layer<T>::type`
with `get_lowest_layer<T>`.
fix#949
* New error codes are introduced for WebSocket failures
* More verbose messages for error codes
* Error codes are mapped to conditions for ease of testing
* error::failed and error::handshake_failed are deprecated (don't use)
Actions Required:
* Code which explicitly compares error_code values against the
constant `websocket::error::handshake_failed` should compare
against `websocket::condition::handshake_failed` instead.
* Code which explicitly compares error_code values against the
constant `websocket::error::failed` should compare
against `websocket::condition::protocol_violation` instead.
fix#849
This adds an additional `bool` template parameter to
`websocket::stream`:
* When deflateSupported is `true`, the stream will be capable
of negotiating the permessage-deflate websocket extension per
the configured run-time settings.
* When deflateSupported is `false`, the stream will never negotiate
the permessage-deflate websocket extension. Furthermore, all of the
code necessary for implementing the permessage-deflate extension
will be excluded from function instantiations. The resulting emitted
object code should be smaller.
fix#884
* BodyReader and BodyWriter constructors now require the header and
body elements to be passed as distinct header and value_type objects.
This enables the composition of body types, for example:
http::response<compressed_body<http::string_body>> res;
* The previous single-argument constructors are deprecated and will be
removed in a subsequent version.
Actions Required:
* Change user-defined instances of BodyReader or BodyWriter constructor
signatures to the two-argument form.
OR
* Define the macro BOOST_BEAST_ALLOW_DEPRECATED in the project (which
will accept both the new and the deprecated signatures).
Body::reader and Body::writer meanings are reversed, for
consistency with the names of the stream operations:
* Body::reader is used for read, read_some, async_read, async_read_some
* Body::writer is used for write, write_some, async_write, async_write_some
Actions Required:
* Swap the reader and writer names for user defined Body types
* Swap use of is_body_reader and is_body_writer
* Fields::writer replaces Fields::reader
* The FieldsWriter concept is renamed from FieldsReader
Actions Required:
* Rename reader to writer for user defined Fields
* The function has_content_length_impl is added to the
requirements of Fields.
Actions Required:
* Implement has_content_length_impl for user-defined Fields
fix#769
The following classes are removed:
* handler_type
* async_result
* async_completion
* is_dynamic_buffer
* is_const_buffer_sequence
* is_mutable_buffer_sequence
* handler_alloc
Actions Required:
* Use BOOST_ASIO_HANDLER_TYPE instead of handler_type
* Use BOOST_ASIO_INITFN_RESULT_TYPE instead of async_result
* Use boost::asio::async_completion
* Use boost::asio::is_dynamic_buffer
* Use boost::asio::is_const_buffer_sequence
* Use boost::asio::is_mutable_buffer_sequence
* boost::asio::associated_allocator_t replaces handler_alloc
fix#773
* buffer_cat is renamed to buffers_cat
* buffer_cat_view is renamed to buffers_cat_view
Actions Required:
* Use buffers_cat instead of buffer_cat
* Use buffers_cat_view instead of buffer_cat_view
fix#773
* buffer_prefix is renamed to buffers_prefix
* buffer_prefix_view is renamed to buffers_prefix_view
Actions Required:
* Use buffers_prefix instead of buffer_prefix
* Use buffers_prefix_view instead of buffer_prefix_view
fix#778
* The version data member is replaced with accessor
member functions.
Actions Required:
* Call member function message::version instead of accessing
the version member at call sites.
* HTTP read and write operations now return the
number of bytes transferred to or from the stream.
Actions Required:
* Modify HTTP read and/or write completion handlers to receive
the extra std::size_t bytes_transferred parameter.
fix#575, fix#604, fix#608, fix#634, fix#712
All examples are rewritten:
* Using Best Practices
* Mostly self-contained
* New examples to complete the feature matrix
* The server-framework example is removed
* teardown_tag is replaced with teardown_role, a client/server
flag used to determine whether the shutdown is performed
before or after reading the EOF. This is in accordance with
RFC6455 7.1.1:
https://tools.ietf.org/html/rfc6455#section-7.1.1
Actions Required:
* Modify signatures of teardown and async_teardown to use
teardown_role instead of teardown_tag
* Change calls to teardown and async_teardown to pass the
correct role: client or server depending on context.
* The drain_buffer dynamic buffer is no longer a public interface.
Actions Required:
* Replace code which uses drain_buffer. For websocket::stream,
it is no longer necessary to manually drain the connection
after closing.
The websocket stream is optimized to contain a small
circular static buffer, reducing the number of I/O calls when
reading data. The size of the buffer is tuned for maximum
performance with TCP/IP and no long needs configuration:
* read_some replaces read_frame
* write_some replaces write_Frame
* async_read_some replaces async_read_frame
* async_write_some replaces async_write_frame
* websocket::stream::read_buffer_size is removed
Actions Required:
* Remove calls websocket::stream::read_buffer_size
* Use read_some and write_some instead of read_frame and write_frame
* static_buffer is added
Note this is the same name from two versions ago, when
static_buffer was renamed to flat_static_buffer for
consistency and to clear the name for a circular static
buffer.
Actions Required:
* Callers who depend on static_buffer returning sequences of
exactly length one should switch to flat_static_buffer.
* parser now has a callback feature for intercepting chunk headers
and chunk bodies
* The names for basic_parser derived class callbacks have been
refactored
* basic_parser offers an additional callback for distinguishing
chunk body data.
Actions Required:
* Adjust signatures for required members of user-defined
subclasses of basic_parser
* Use the new basic_parser chunk callbacks for accessing
chunk extensions and chunk bodies.
New buffer sequence classes are provided to allow full
control over the serialization of chunk-encoded message
payloads:
* chunk_header
A ConstBufferSequence representing the chunk header.
It includes a hexadecimal-encoded size, an optional
set of chunk extensions, and the trailing CRLF
required to denote the end of the chunk header.
This allows the caller to manually serialize the chunk
body in one or more calls to a stream output function.
The caller must also output an object of type `chunk_crlf`
to the stream to indicate the end of the chunk body.
* chunk_crlf
A small ConstBufferSequence that simply represents
the two character sequence "\r\n" (CRLF). This is needed
for the case where the caller wants to output a chunk
body as a series of buffers (i.e. "chunking a chunk").
* chunk_body
A ConstBufferSequence representing a complete chunk.
This includes the size, an optional set of chunk extensions,
a caller provided buffer containing the body, and the
required CRLF that follows.
* chunk_final
A ConstBufferSequence representing a final chunk. It
includes an optional set of caller-provided field trailers
* chunk_extensions
A container for building a set of chunk extensions to use
during serialization. The use of the container is optional,
callers may provide their own buffer containing a correctly
formatted set of chunk extensions, or they may use their
own convenience container which meets the requirements.
The basic_fields container is modified to allow construction
outside the context of a message. The container can be used
to provide trailers to `chunk_final`.
Actions Required:
* Remove references to ChunkDecorators. Use the new chunk-encoding
buffer sequences to manually produce a chunked payload body in
the case where control over the chunk-extensions and/or trailers
is required.
These types now perform error-based initialization in
a separate init() functions instead of in the constructor.
Actions Required:
* Modify instances of user-defined BodyReader and BodyWriter
types to perfrom two-phase initialization, as per the
updated documented type requirements.
`put` returns the number of bytes actually transferred
from the input buffers.
Actions Required:
* Return the number of bytes actually transferred from the
input buffers in user defined `Body::writer::put` functions.
fix#550
* default body limits are now 1MB/8MB
* default header limit is 8KB
Actions Required:
* Call body_limit and/or header_limit as needed to adjust the
limits to suitable values if the defaults are insufficient.
The is_deferred nested type is removed from the BodyReader
requirements.
Performance for sending messages with `file_body` was cut
almost in half with is_deferred as `std::true_type` since
it caused double the number of socket writes. If the
deferred behavior is absolutely necessary, callers can get
the same effect by manually sending the headers first.
Actions Required:
* Callers who need the behavior of is_deferred as `std::true_type`
should manually construct a serializer and serialize the header
first, followed by the body.
fix#322
The new callback is informed of all frame types including close.
Actions Required:
* Change calls to websocket::stream::ping_callback to use
websocket::stream::control_callback
* Change user defined ping callbacks to have the new
signature and adjust the callback definition appropriately.
Actions Required:
* Change calls to msg.prepare to msg.prepare_payload. For messages
with a user-defined Fields, provide the function prepare_payload_impl
in the fields type according to the Fields requirements.
* FieldsReader now requires chunked() and keep_alive()
* serializer logic calls into the reader to calculate
the message metadata
* Removed some of the previous requirements of FieldsReader
Actions Required:
* Implement chunked() and keep_alive() for user defined FieldsReader types.
fix#497
This changes the function signature to accept the `value_type`
instead of the entire message.
Actions Required:
* For any user-defined models of Body, change the function signature
to accept `value_type const&` and modify the function definition
accordingly.
* detail::read_size_helper is removed
* public function read_size helps determine the optimum
size for calls to a DynamicBuffer's prepare function.
* special case for Asio types which don't conform to
the concept but have their own helper function.
fix#446
* The ping_callback option struct is removed.
Actions Required:
* Change call sites which use ping_callback with set_option to
call stream::ping_callback instead.
fix#446
* The write_buffer_size option struct is removed.
Actions Required:
* Change call sites which use write_buffer_size with set_option to
call stream::write_buffer_size instead.
fix#446
* The read_message_max option struct is removed.
Actions Required:
* Change call sites which use read_message_max with set_option to
call stream::read_message_max instead.
fix#446
* The read_buffer_size option struct is removed
Actions Required:
* Change call sites which use read_buffer_size with set_option to
call stream::read_buffer_size instead.
fix#446
* message_type is removed
Actions Required:
* Change call sites which use message_type with set_option
to call stream::binary or stream::text instead.
fix#374, fix#446
* auto_fragment option struct is removed
Actions Required:
* Change call sites which use auto_fragment with set_option
to call stream::auto_fragment instead.
* header::result is a family of functions to replace header::status
* header interface now uses status enum and also ints
* reason-phrase is no longer stored unless the user explicitly
requests it.
* When serializing, the standard reason is used for the
corresponding status code unless the user has changed it.
The verb interfaces now use verb::unknown instead of
boost::optional<verb> == boost::none to indicate that
the request-method is an unrecognized string.
The http::header interface is modified to focus more on the
verb enum rather than the string. For recognized verbs, the
implementation stores an integer instead of the string.
Unknown verbs are still stored as strings.
* header::method now returns a verb
* header::method_string returns the method text