* `basic_parser` now uses pure virtual member functions instead
of the curiously recurring template pattern.
Actions Required:
* Change uses of the `basic_parser` type to omit the `Derived`
template parameter
* Classes derived from `basic_parser` no longer need to friend
the base.
* Virtual functions in the derived class may be marked `override`.
fix#38
This improves the behavior when encountering a short read:
* Any stream error encountered during a read is converting into
`http::error::partial_message` if some data was received but
the message is incomplete.
* Examples squelch SSL short read errors from the logs.
This changes the interface used to apply a decorator to the HTTP
request or response messages used to perform the WebSocket handshake
as follows:
* Add the `stream_base::decorator` option object
* Add `stream::set_option` overload to set the decorator from
the option
* The decorator applies to all client and server handshakes
performed on the stream after the option is set.
* Overloads of the following functions which accept a Decorator
are deprecated:
- accept, accept_ex
- handshake, handshake_ex
- async_accept, async_accept_ex
- async_handshake, async_handshake_ex
Actions Required:
* Code which passes decorator to any `websocket::stream` member
function should call `stream::set_option` instead with a newly
constructed `stream_base::decorator` object containing the
decorator. Alternatively, the macro `BOOST_BEAST_ALLOW_DEPRECATED`
may be defined to 1.
* All functionality of stranded_stream is folded into basic_stream
* tcp_stream is an alias for basic_stream with tcp
* The tests are expanded to produce full coverage
* Timeout implementation is simplified
fix#1435, fix#1438
* Example and test can be built on msvc v141 15.9.6
using /std:c++17 and BOOST_BEAST_USE_STD_STRING_VIEW.
* changed string_view.to_string() to std:string(string_view),
awaiting availability of Library Fundamentals TS here.
* Reactivated relevant tests to param_list. #ifdef 0 test
exhibited same assertion failed error in debug mode.
Now fixed in DEBUG on msvc v141 15.9.6 with
BOOST_BEAST_USE_STD_STRING_VIEW and /std:c++17.
* Looked up http paramters (transfer-encoding, etc.)
and changed tests as well as fixing comment to
match specs.
- Call the completion handler with the correct signature
- Replicate ASIO socket behavior of async operation completions
- Fix a data race between read_op and a call to stream::nread()
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
* is_completion_handler is deprecated
* type_traits.hpp is a deprecated include
These items will be removed in the next version
* Include the new header file for the types needed:
- stream_traits.hpp
- file_base.hpp
* Use std::is_invocable instead of is_completion_handler
These metafunctions are moved from type_traits.hpp
to stream_traits.hpp:
- has_get_executor
- is_sync_stream
- is_sync_read_stream
- is_sync_write_stream
- is_async_stream
- is_async_read_stream
- is_async_write_stream
Actions Required:
* Include the file stream_traits.hpp as needed
fix#1416
* Calls to buffer_copy are qualified as net::buffer_copy
* Calls to buffer_size are made unqualified, permitting
argument dependent lookup to take effect.
* Optimize hash calculation and equality for field strings
Experiments show the digest and equality functions taking the
most time. Optimizing L1 cache usage did not show significant
improvements.
This algorithm allows a socket-like object to be closed in
a generic context. The customization point enables user-defined
types to define the close algorithm to use with `close_socket`.
fix#1417
* New get_lowest_layer free function works for any object
* New lowest_layer_type trait works for any object
* New examples and documentation on layered streams
API Changes:
* The member function lowest_layer is removed from all
types provided by the library:
Actions Required:
* Call the free function get_lowest_layer instead of
member lowest_layer.
The nested function lowest_layer and nested type lowest_layer_type
are removed from all stream layers.
Actions Required:
* Remove lowest_layer and lowest_layer_type from user-defined streams.
* Use the get_lowest_layer free function and the lowest_layer_type trait
as needed.
This I/O object wraps an ordinary socket and provides a built-in
timeout and optional bandwidth rate-limiting facility.
Added class template basic_stream_socket
* Meets the requirements of AsyncReadStream and AsyncWriteStream
* Partially supports P1322R0:
"Networking TS enhancement to enable custom I/O executors"
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1322r0.html
A strand or other io_context-compatible executor may be
chosen to use for all asynchronous stream operations.
* Supports independent timeouts on logical operations:
connect, read, write, or both read and write.
* Provides an option for a configurable rate limit
limit on the maximum rates of reading or writing.
* The previous experimental implementation,
`timeout_socket` and related types, is removed.
* stream_socket is an alias for basic_stream_socket which
uses `net::ip::tcp` as its protocol.
fix#1365
To reduce instantiations, the list of template parameters
to the bind and bind_front handler wrappers are decayed before
naming the class template.
* Tidying
* Increase test coverage
* Fix file_mode::append_existing
API Changes:
* file_mode::append_new is removed, as it makes no sense
Actions Required:
* Replace file_mode::append_new with file_mode::append
or file_mode::append_existing instead of file_mode::append_new
* The function buffers is deprecated, use the new
function make_printable as the replacement.
Actions Required:
* Replace call sites to use make_printable instead of buffers,
and also include make_printable.hpp instead of ostream.hpp.
* Improved tests
* Refactor some declaration material
* basic_multi_buffer::clear is public
and
* Fix flat_buffer::reserve
* flat_buffer::clear is public
This resolves an issue where the ostream could try to
exceeed the configured maximum size of a dynamic buffer
when the maximum is set to a very low number.
When BOOST_BEAST_TESTS is not defined, violations of
buffers_cat preconditions will assert instead of throwing
exceptions. This reduces the size of the emitted code
and improves performance.
Elements of zero size are correctly skipped during iteration.
* Tidy up tests
* Increase code coverage
* Remove move special members
* Correct behavior for default constructed iterators
* Tidy up tests
* Increase code coverage
* Remove move special members
* Correct behavior for default constructed iterators
API Changes:
* buffers_adaptor is renamed (was buffers_adapter)
Actions Required:
* Replace buffers_adapter.hpp with buffers_adaptor.hpp, and
replace buffers_adapter with buffers_adaptor. Or, define
BOOST_BEAST_ALLOW_DEPRECATED
This tidies up small corner cases and bugs with
the bind_handler and bind_front_handler wrappers:
* Legacy allocation hooks are deleted
* Fixes for bind_front_handler specializations
* Decay bound arguments first, to reduce template instantiations
* Proper moving and forwarding of bound arguments and call parameters
* Tidy up and comment asserts
* `pausation` is renamed to saved_handler
* A work guard on the handler's associated executor
is maintained for the lifetime of the store handler.
* Revise documentation
* Specify exception safety
* Mark more functions noexcept
API Changes:
* flat_static_buffer::reset is deprecated
Actions Required:
* Replace calls to flat_static_buffer::reset with
flat_static_buffer::clear
fix#1356
* File functions return errc::bad_file_descriptor
instead of errc::invalid_argument.
Actions Required:
* Callers checking for errc::invalid_argument from calls to
file APIs should check for errc::bad_file_descriptor instead.
* Revise stream algorithm javadocs
* HTTP stream algorithms now use beast::read and
beast::async_read with a custom completion condition.
API Changes:
* HTTP stream algorithms return the number of bytes transferred
from the stream. Previously, they returned the number of bytes
consumed by the parser.
Actions Required:
* Callers depending on the return value of http::read or
http::async_read overloads should adjust the usage of
the returned value as needed.
Replace aligned_union in handler_ptr with the built-in one to reduce
the number of template instantiations and remove the reinterpret_casts
that were required.
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
fix#1305
Applies to:
flat_buffer
flat_static_buffer
multi_buffer
static_buffer
Changes:
* Revised all javadocs
* Move construction does not invalidate in some cases
* non-const data() returns a mutable buffer sequence
* Add cdata() to also return constant readable bytes
* Eligible member functions are declared noexcept
fix#1279, close#1319
This enables users to improve compilation performance by explicitly
instantiating the stream template in another TU.
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
close#1322
async initiating functions must return init.result.get(). Returning the
result of post caused a compilation failure for custom completion tokens.
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
fix#1290
* BOOST_ASIO_NO_DEPRECATED=1 is now set
* Fix various warnings from the Boost regression test matrix
* Fix a bug in advanced servers when checking for a timeout
Provides a subset of std::tuple functionality, for internal use
to reduce the resources required during compilation.
Does not support reference-like semantics on assignment.
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This works similarly to bind_handler, and can help with reducing
template instantiations and compiler memory usage (since it does
not need to support placeholders).
A specialization for the most common case `void(error_code, size_t)`
is provided to minimize instantiation cost.
Fixes a compilation error that occurred when using
BOOST_ASIO_SEPARATE_COMPILATION.
Resolves: #1286
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
fix#1270
basic_fields::value_type uses base hooks instead of member hooks,
otherwise MSVC can sometimes produce undefined behavior when
attempting to recover the base class from a data member in
certain build configurations.
fix#1133, fix#1241
When the macro BOOST_BEAST_USE_STD_STRING_VIEW is defined,
Beast will use std::string_view instead of boost::string_view.
The name boost::beast::string_view is a type alias for the
chosen view type.
fix#1245, fix#1249
The value used to fill the incomplete code point buffer is
changed to a character which no longer causes
utf8_checker::valid() to incorrectly return false.
fix#1202
Replace them by their cousins from std::allocator_traits;
otherwise, heaps of deprecation warnings will fall onto
humble users when compiling with MSVC 15 in C++17 mode.
Signed-off-by: Daniela Engert <dani@ngrt.de>
This resolves a medium vulnerability described in the
Beast Hybrid Assessment Report by Bishop Fox, where masks generated
for use with outgoing WebSocket client frames use an insufficient
source of entropy and a non-cryptographically secure pseudo-random
number generator.
By default, all newly constructed WebSocket streams will use a
uniquely seeded secure PRNG (ChaCha20 in counter mode). As this may
result in increased CPU resource consumption, the function
websocket::stream::secure_prng() may be used to select a faster but
less secure PRNG, for the case where the caller knows that the secure
generator is not necessary.
On some systems, std::random_device may produce insufficient entropy
to securely seed the PRNG. As this condition cannot be detected by
Beast, callers may use the function websocket::seed_prng() called
once at startup to provide at least 256 bits of entropy which will
be used to uniquely seed all subsequent PRNGs.