...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Features
error_code
s
use source_location
Fixes
Improvements
file_body
support seek
Features
buffers_generator
http::message_generator
buffer_ref
Fixes
Improvements
Miscellaneous
span
from Boost.Core
static_string
from
Boost.StaticString
serializer::is_done
is const
Documentation
Miscellaneous
BOOST_BEAST_USE_STD_STRING_VIEW
core::string_view
no longer supports
the .to_string()
or .clear()
extensions from Utility
.max_size()
returning .size(),
needs to be fixed to use .size()
instead
remove_suffix()
and remove_prefix()
were more lenient than the standard
specs; be sure you don't rely on it clamping the argument to valid
range
BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
no longer suppresses conversions to std::string
Fixes
file_win32
.
file_stdio
.
Miscellaneous
Fixes
Miscellaneous
test::stream
.
Fixes
Miscellaneous
Fixes
Improvements
Miscellaneous
Fixes
detect_ssl
.
advanced_server_flex
example.
basic_stream
when a zero-length write is requested.
nullptr
implicit
cast on fields::set()
.
basic_stream
.
Miscellaneous
BOOST_ASIO_ENABLE_HANDLER_TRACKING
to enable Asio handler tracking in Boost.Beast asynchronous operations.
Please see asio
handler tracking for details.
API Changes
BOOST_ASIO_NO_DEPRECATED
to disallow deprecated invocation and allocation hooks.
BOOST_ASIO_NO_TS_EXECUTORS
to ensure that executors conform to the Standard
Executors proposal.
BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
to select Networking
TS style executors by default. If this macro is not defined,
Asio default executors will be the Standard
Executors implementation.
body_limit
is optional (API Change) Actions Required
basic_parser<>::body_limit(n)
has changed. It now accepts an optional
std::uint64_t
. The caller may indicate
that no body limit is required by calling body_limit(boost::none)
. The default limits remain in place
in order to maintain 'safe by default' behaviour.
BOOST_BEAST_NO_DEPRECATED
will no longer be noticed by Beast. The only way to enable deprecated
functionality is now the macro BOOST_BEAST_ALLOW_DEPRECATED
which is undefined by default. That is, all deprecated behaviour
is disabled by default.
websocket::async_accept_ex
websocket::async_handshake_ex
websocket::accept_ex
websocket::handshake_ex
Programs still
using these names should be refactored to use the decorator
feature and the
remaining handshake and accept functions.
websocket::role_type
has been removed. Users
should use beast::role_type
instead.
handler_ptr
has been
removed. Users should use net::bind_handler
and/or bind_front_handler
instead.
mutable_data_type
should be refactored to use mutable_buffers_type
.
Classes affected are:
buffers_adaptor
flat_buffer
flat_static_buffer
multi_buffer
static_buffer
reset
function
has been removed from flat_static_buffer
.
Use the clear
function
instead.
core/type_traits.hpp
public header has been removed
and along with it the type trait is_completion_handler
.
Beast uses the CompletionHandler correctness checks provided by Asio.
In a c++20 environment, these convert to concept checks.
invalid_code_lenths
(sic) was a synonym of invalid_code_lengths
.
Affected programs should be modified to use invalid_code_lengths
.
core/buffers_adapter.hpp
has been removed along with
the deprecated alias typename buffers_adapter
.
Affected programs should use core/buffers_adapator.hpp
and the type buffers_adaptor
.
string_param
(API Change) Actions Required string_param
,
which was previously the argument type when setting field values has been
replaced by string_view
.
Because of this, it is no longer possible to set message field values directly
as integrals. Users are requied to convert numeric arguments to a string
type prior to calling fields::set
et. al. Beast provides the non-allocating to_static_string()
function for this purpose. To set Content-Length
field manually, call message::content_length
.
Fixes
std::string_view
span_body
buffered_read_stream
with use_awaitable
async_detect_ssl
with use_awaitable
FILE
namespace
qualification
bytes_transferred
basic_stream
expires_after
max
compile
error
iless
and iequal
take part in Heterogeneous Lookup
Miscellaneous
API Changes
mutable_data_type
in Beast dynamic buffers is deprecated. Affected types:
buffers_adaptor
flat_buffer
flat_static_buffer
multi_buffer
static_buffer
Changes Required
mutable_buffers_type
instead of mutable_data_type
,
or define BOOST_BEAST_ALLOW_DEPRECATED
Miscellaneous
Fixes
basic_stream::close
will not throw
flat_buffer::shrink_to_fit
is noexcept
file_body
returns
short_read
on eof during
read
file_body
basic_file_body
file_win32
supports
UTF-8 paths
file_stdio
supports
unicode paths
file_win32
bodies
respect http::serializer::split
buffer_bytes
documentation
File::read
docs
echo-op
test
Examples
Features
Fixes
Improvements
buffers_cat
detect_ssl
uses
bool
instead of tribool
static_string
in HTTP parser
steady_timer
type
static_string
http::string_to_verb
operation_aborted
on partial message
<experimental/unit_test/thread.hpp>
filter_token_list
bind_executor
in basic_stream
static_string
from http::fields
static_string
in websocket
asio::coroutine
in flat_stream
Fixes
allocator_traits::construct
is used for user-defined types
get_executor
const-correctness
async_detect_ssl
handler type
buffers
function
flat_buffer
copy members
buffers_cat
iterator
tests
beast::iequals
in basic_parser.ipp
Documentation
Tip | |
---|---|
The namespace alias |
New Features
net::async_initiate
internally.
tcp_stream
and basic_stream
support:
async_read_some
, async_write_some
complete
with error::timeout
on expiration.
simple
and unlimited
, or a user-defined
RatePolicy.
websocket::stream
supports
ssl_stream
is a public interface
flat_buffer
,
flat_static_buffer
, multi_buffer
, and static_buffer
:
data()
returns a mutable buffer sequence
cdata()
to also return constant readable bytes
noexcept
flat_buffer
,
multi_buffer
clear
, reserve()
,
max_size()
,
shrink_to_fit()
max_size()
bind_front_handler
static_buffer
,
flat_static_buffer
clear()
noexcept
http::string_to_field
clear
operations
perserve capacity.
is_const_buffer_sequence
is_mutable_buffer_sequence
buffers_iterator_type
buffers_type
async_base
,
stable_async_base
allocate_stable
is preferred over handler_ptr
buffer_bytes
replacement
for net::buffer_size
saved_handler
buffers_range_ref
executor_type
get_lowest_layer
,
lowest_layer_type
close_socket
, beast_close_socket
error
, condition
flat_stream
, detect_ssl
, async_detect_ssl
.
Documentation
API Changes
handler_ptr
is deprecated.
Actions Required: Use stable_async_base
and allocate_stable
instead.
http::read
or http::async_read
overloads should adjust
the usage of the returned value as needed.
has_get_executor
,
is_sync_stream
, is_sync_read_stream
, is_sync_write_stream
,
is_async_stream
, is_async_read_stream
, and is_async_write_stream
are in stream_traits.hpp.
Actions Required: Include stream_traits.hpp as needed.
basic_parser
is abstract.
Actions Required
basic_parser
type to omit the Derived
template parameter
basic_parser
no longer need to friend the base.
override
.
is_file
is
in file_base.hpp. Actions Required: Include file_base.hpp
as needed.
flat_static_buffer::reset()
is deprecated. Actions Required:
clear()
instead.
buffers_adapter
is spelled
buffers_adaptor
. Actions
Required:
buffers_adapter
with buffers_adaptor
,
or define BOOST_BEAST_ALLOW_DEPRECATED
.
buffers
is spelled make_printable
. Actions Required:
buffers
with
make_printable
, and
include "make_printable.hpp" instead of "ostream.hpp".
file_mode::append_new
is removed, as it makes no
sense. Actions Required:
file_mode::append_new
with either file_mode::append
or file_mode::append_existing
as needed.
role_type
is moved from
websocket
to beast
buffers_range_ref
is preferred
to std::reference_wrapper
. Actions
Required:
buffers_range_ref
with the buffer, instead of calling buffers_range
with a reference wrapper constructed from the buffer.
lowest_layer
and
lowest_layer_type
are removed.
Actions Required: Use the free function get_lowest_layer
and the type trait
lowest_layer_type
instead.
accept
, accept_ex
handshake
,
handshake_ex
async_accept
,
async_accept_ex
async_handshake
,
async_handshake_ex
basic_parser::content_length
no longer changes as the body of the message is received. Actions
Required: Call basic_parser::content_length_remaining
instead of basic_parser::content_length
in order to determine the remaining number of bytes in the body.
Examples
tcp_stream
with
timeouts (HTTP)
ssl_stream
bind_front_handler
flat_buffer
async_echo
works with move-only
handlers
Fixes
ssl_stream
for Asio changes
websocket::stream
http::message
is not-a boost::empty_value
test::stream
has fewer dependencies
session_alloc
is thread-safe
test::stream
maintains a handler work guard
buffers_cat
correctly skips
empty buffers when iterated
ostream
does not overflow
or exceed the dynamic buffer's maximum size
test::stream::async_read
file_mode::append_existing
works correctly
New Videos
New Features
BOOST_BEAST_USE_STD_STRING_VIEW
Examples
Fixes
boost::empty_value
basic_fields
uses intrusive base
hooks
BOOST_NO_EXCEPTIONS
Experimental
timeout_socket
This version fixes a missing executor work guard in all composed operations used in the implementation. Users who are experiencing crashes related to asynchronous completion handlers are encouraged to upgrade. Also included is an improved mechanism for generating random numbers used to mask outgoing websocket frames when operating in the client mode. This resolves a vulnerability described in the Beast Hybrid Assessment Report from Bishop Fox.
New Features
The include directory <beast/experimental>
contains features which are not part of
the stable public interface but are available anyway. They may change in future
versions.
flat_stream
for working around
an SSL stream performance limitation
http::icy_stream
stream filter allows
parsing ICY HTTP response handshakes
ssl_stream
for better SSL performance and move constructability
test::connect
,
test::error
,
test::fail_count
,
and test::stream
utilities for writing unit tests.
http::is_mutable_body_writer
metafunction
websocket::seed_prng
for manually providing
entropy to the PRNG
websocket::stream::secure_prng
to control whether
the connection uses a secure PRNG
Improvements
buffers_adaptor
handler_ptr::has_value
Fixes
const
and
non-const
overloads for message
based HTTP writes
bind_handler
http::parser
constructor javadoc
buffers_adaptor
iterator value
type
buffers_adaptor::max_size
buffers_prefix
iterator decrement
Breaking Changes
serializer::reader_impl
reader
and writer
ctor signatures
This version fixes significant defects in websocket::stream
which can lead to asserts or
undefined behavior. Users are encouraged to update to the latest Boost release.
New Features
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. Programs which set deflateSupported
to false
when instantiating streams will be smaller.
websocket::error::failed
and websocket::error::handshake_failed
are removed. 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.
Improvements
http::basic_fields
uses less storage
http::basic_fields
exception specifiers
are provided
asio::null_buffers
<boost/beast/websocket/stream_fwd.hpp>
bind_handler
works with boost placeholders
reuse_address(true)
Fixes
ssl_stream
special members
<algorithm>
are protected from macros
http::basic_fields::erase
bind_handler
doc
"ws_.wr_block_ == tok_"
.
API Changes
handler_ptr
.
Actions required: don't call non-public members.
handler_ptr
is a move-only
type, with unique_ptr
semantics.
Actions required: user-defined composed operations using handler_ptr
to manage state can only
be moved, not copied.
handler_ptr
gives the strong
exception guarantee. The constructor signature for managed objects constructed
by handler_ptr
now receives
a const
reference to the handler.
Actions required: Change the constructor signature for state objects used
with handler_ptr
to receive
a const
reference to the handler.
http::basic_fields
does not support
fancy pointers
http::parser
is no longer MoveConstructible
http::serializer::reader_impl
is deprecated and will be
removed in the next release. Actions required: Call http::serializer::writer_impl
instead of serializer::reader_impl
.
http::header
and value_type
objects. This enables the composition of body types. The previous single-argument
constructors are deprecated and will be removed in the next version. Actions
required: Change user-defined instances of BodyReader
or BodyWriter
constructor signatures to the two-argument form. Alternatively. define
the macro BOOST_BEAST_ALLOW_DEPRECATED
in the project (which will cause both the new and the deprecated signatures
to be accepted).
websocket::stream::control_callback
now copies or
moves the function object.
get_lowest_layer
is now a type alias. Actions required: Replace instances of typename get_lowest_layer<T>::type
with get_lowest_layer<T>
.