Commit Graph
219 Commits
Author SHA1 Message Date
Mohammad Nejati bcd65c828e Fix unused parameter warnings in tests 2024-03-31 18:59:36 +03:30
Mohammad Nejati e0a9da265f buffers_adaptor::subrange conforms to concept
Fixes #2459
2024-02-07 00:11:14 +03:30
Mohammad Nejati a1784e3093 Add missing headers to file_test.hpp 2024-01-18 19:17:07 +03:30
Mohammad Nejati 9e16754dd5 Add non-allocating overload for error category message function
Fixes #2646
2024-01-03 18:21:52 +03:30
Mohammad 0d1e2d64f8 Replace beast::bind_front_handler uses with asio::prepend 2023-12-30 08:47:32 +03:30
Klemens Morgenstern 3996cae768 allocate & invoke hooks are removed. 2023-10-26 12:33:24 +03:30
Mohammad 45d4f7f306 Replace BOOST_ASIO_INITFN_RESULT_TYPE with BOOST_ASIO_INITFN_AUTO_RESULT_TYPE
asio::deferred doesn't work with BOOST_ASIO_INITFN_RESULT_TYPE
Fixes #2727.
2023-09-05 08:54:08 +03:30
Edward NolanandEdward Nolan 8dc6daa507 Address bind_handler ambiguous overload error when boost/bind/std_placeholders.hpp is included (#2638)
* Address bind_handler ambiguous overload error when boost/bind/std_placeholders.hpp is included

Previously, the implementation of bind_handler made the assumption
that the trait boost::is_placeholder would be false for types
corresponding to values in the std::placeholders namespace.

However, boost/bind commit c85b31e3d200dda2a73cf0027a82c6d8e29066f8,
`Support use of standard placeholders with boost::bind`, added a new
header, boost/bind/std_placeholders.hpp, which adds specializations to
 boost::is_placeholder for std::placeholders types.

When this header is included before a use of boost::bind_handler, it
results in compiler errors like the following, due to an internal
helper function having overloads for
enable_if<boost::is_placeholder...> and
enable_if<std::is_placeholder...>, which were previously assumed to be
mutually exclusive, but for which both conditions now are true:

../../../boost/beast/core/detail/bind_handler.hpp:126:18: error: call of overloaded 'extract(std::_Placeholder<1>, boost::beast::detail::tuple<int&&>)' is ambiguous
  126 |         h(extract(detail::get<S>(std::move(args)),
      |           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  127 |             std::forward<ValsTuple>(vals))...);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This header is included in boost/bind/bind.hpp, and is transitively
included by headers in many boost libraries including:

algorithm
asio
atomic
graph
msm
multi_index
property_tree
ptr_container
python
signals2
test
thread

Making it possible that an include from one of these libraries will
randomly cause bind_handler to fail to compile.

This change addresses the issue by eliminating one of the ambiguous
overloads and ensuring that boost/bind/std_placeholders.hpp is
included in the bind_handler implementation file, so that the
enable_if<boost::is_placeholder...> overload can handle both
boost::placeholders and std::placeholders values. It also explicitly
adds a boost/bind/std_placeholders.hpp include to the bind_handler
unit test to prevent this issue from regressing.

* Address boost/bind/std_placeholders.hpp feature guards

boost/bind/std_placeholders.hpp has the following feature guards:

if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)

If this check fails, it will not detect std::placeholders values as
placeholders, making the previous solution fail.

This update restores the std::is_placeholder overload and adjusts the
SFINAE for the boost::is_placeholder overload so that it triggers only
if std::is_placeholder is false, making bind_handler work regardless
of whether std_placeholders.hpp's feature guard applies.

---------

Co-authored-by: Edward Nolan <enolan@maystreet.com>
2023-02-17 13:50:04 +08:00
Klemens 334b9871be Fixed timer usage inside basic_stream.
Closes #2602.
2022-12-24 09:40:08 +08:00
Klemens Morgenstern 48f82ac817 Switched self-posting to the io-object's executor.
This is a conceptual change in the recent asio version that is reflected in any_completion_handler.
2022-12-20 14:45:26 +08:00
Christopher Kohlhoff 19f91bcb32 Tests adopting asio code changes for asio 1.25.0. 2022-11-01 14:45:54 +08:00
Klemens Morgenstern 1fc340713c beast support default completion & rebind.
buffers_generator uses default_completion.
websocket::stream has a rebinding constructor.
ssl_stream has a rebind_executor member.
basic_stream has rebinding constructor.
2022-10-30 00:13:54 +08:00
Klemens 3ebff60b1a beast support per-op cancellation
- websocket supports cancellation.
 - Iterating test for ws cancellation.
 - Only terminal cancellation is forwarded by default.
 - basic_stream supports cancellation.
 - supported cancellation is documented.
 - http cancellation additions.
 - Added cancellation_slot tests to http, utils and saved_handler.
 - Added post to write.cpp, to avoid SIGSEV in test.
 - Refresher describes cancellation in more detail.
2022-10-27 22:56:19 +08:00
Klemens 3869d472ec buffer_adaptors uses the correct begin function. 2022-10-14 17:20:15 +08:00
Klemens 9d680df683 buffer_ref allows using beast buffers with asio. 2022-10-14 17:20:15 +08:00
sehe 740879a995 Add http::message_generator 2022-05-21 22:12:13 -07:00
sehe 84e689c447 Add buffers_generator 2022-05-21 22:12:13 -07:00
Vinnie Falco 6c9e9ea243 Tests are fat binaries 2022-05-21 22:12:13 -07:00
Glen Fernandes 95d9587ea7 Use span from Boost.Core 2022-04-23 00:28:26 -04:00
Glen Fernandes 24275ac0c6 Use static_string from Boost.StaticString 2022-04-17 12:30:52 -04:00
Richard Hodges cf29ecdb63 Fix open append mode for file_win32 2021-12-10 17:22:50 +01:00
Richard Hodges 88d5deec0f Add tests for file open in append/append_existing mode 2021-12-10 17:15:13 +01:00
Richard Hodges 355dcfe502 Add individual tests to CMake workflow
close #2350
2021-12-09 14:27:18 +01:00
sdarwin a9a09952a2 Update GitHub Actions CI file
closes #2301
2021-09-03 21:02:09 +02:00
Richard Hodges 8913a3cd21 Add executor rebind to test::stream
closes #2139
2020-12-16 21:11:29 +01:00
Richard Hodges 7e30dd7d76 Fix C++20 tests for basic_stream
fixes #2029
2020-11-04 15:22:05 +01:00
Giovanni Mascellani 9ce16bccbd Fix typo in copyright headers.
closes #2102
2020-10-26 16:56:18 +01:00
Richard Hodges 7811f4c52f Fix assert when basic_stream used as underlying of ssl::stream with 0-length write
Fixes #2065
Closes #2078
2020-09-03 16:12:40 +02:00
Richard Hodges de1e63c597 Fix style errors 2020-07-04 08:12:10 +02:00
Richard Hodges 060f59685c Support BOOST_ASIO_NO_TS_EXECUTORS 2020-07-04 07:35:14 +02:00
Richard Hodges 5f1adfbc6d Refactor get_io_context 2020-07-04 07:35:06 +02:00
Christopher Kohlhoff 107b01ad24 Update bind_handler test to use standard executor form 2020-07-04 07:35:01 +02:00
Christopher Kohlhoff ca95101a88 Don't test deprecated hooks 2020-07-04 07:34:54 +02:00
Christopher Kohlhoff 06a0b18b1d Use strand<> rather than legacy executor io_context::strand 2020-07-04 07:34:45 +02:00
Christopher Kohlhoff 55302a3f8f New name for polymorphic executor. Trait for detecting new executors 2020-07-04 07:34:34 +02:00
Richard Hodges 14c3d50b57 Deprecate string_param (API Change):
API Changes:

`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 required 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 #1956
2020-06-12 17:33:20 +02:00
Richard Hodges 0fa658f644 Remove buffers_adapter.hpp (API Change):
API Changes:

The file `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`.

refs #1934
2020-06-03 12:59:56 +02:00
Richard Hodges 4be7c5aec3 Fix async_connect documentation
resolves #1903
2020-05-04 18:47:03 +02:00
Richard Hodges 638e2d1244 Fix compilation errors with msvc /std:c++latest
fixes #1916
fixes #1925
2020-05-01 07:08:31 +02:00
Richard Hodges d016ff52af Fix all async initiating functions with use_awaitable:
Add trait:
    is_completion_token_for

Fixes for
    buffered_read_stream

Add tests for
    basic_stream
    buffered_read_stream
    flat_stream
    http (all)
    websocket (all)

resolves #1920
2020-04-28 20:48:00 +02:00
Richard Hodges 24cc4a7aee Fix async_detect_ssl with use_awaitable
fixes #1918
2020-04-28 20:45:13 +02:00
Vinnie Falco b2f3598313 Tidy up warnings 2020-04-20 08:09:11 -07:00
Vinnie Falco 483b00d20f Fix msvc ICE in test 2020-03-29 13:22:34 -07:00
Cristian Morales Vega 75da7a522e Fix ostream flush:
fix #1853, close #1859, close #1866

After calling the DynamicBuffer commit() function the
buffer returned from prepare() can be invalidated but
the ostream kept using it.
2020-02-29 10:43:20 -08:00
Richard Hodges ea078cfcdb Refactor flat_static_buffer 2020-02-29 10:43:00 -08:00
Richard Hodges 69ef525d5c Refactor buffers_adaptor 2020-02-29 10:43:00 -08:00
Richard Hodges eebf5773ed Rename to DynamicBuffer_v0:
The Beast variation of Asio's DynamicBuffer_v1
is now named DynamicBuffer_v0.
2020-02-29 10:42:32 -08:00
Vinnie Falco c340697171 Refactor multi_buffer 2020-02-29 10:42:30 -08:00
Richard Hodges 7701bf8738 moved-from container with unequal allocator will not be modified:
Affects:
- flat_buffer
- multi_buffer
- http::fields

fixes #1832
closes #1834
2020-02-04 18:36:53 +01:00
Mika Fischer dfb44236e9 file_stdio supports unicode paths:
fix #793, close #1791, close #1793
2019-12-29 08:58:13 -08:00