Commit Graph
818 Commits
Author SHA1 Message Date
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 1d965752b2 beast file_body & file support seek.
win32 file_body handles seek correctly.
Added seek to win32 file.
file_body_writer handles offsets.
2023-02-05 02:57:41 +08:00
Klemens 99bceb5bff examples & tests use context instead of coroutine. 2023-02-02 23:27:49 +08:00
Klemens 97ece405b8 rebind test uses ignore_unused. 2023-01-04 08:44:00 +08:00
Klemens 334b9871be Fixed timer usage inside basic_stream.
Closes #2602.
2022-12-24 09:40:08 +08:00
Klemens f7079044a7 websocket tests have larger timeouts.
The tests fail on freebsd.
2022-12-20 18:01:12 +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
Klemens 860bfbdeab Added source-location to all ecs.
Closes #2475.
2022-12-20 13:16:39 +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
Klemens 606d776ebb async_read works with dynamic_buffer v2. 2022-10-14 17:20:15 +08:00
Klemens Morgenstern b0c49748a2 Support expect continue in upgrade.
Closes #264.
2022-10-13 09:26:08 +08:00
Klemens 01dd53d665 Empty header values are allowed & documented. 2022-10-10 14:39:46 +08:00
alandefreitas bd69638e9d per-message compression options
fix #226, #227
2022-10-03 09:25:31 +08:00
alandefreitas 5866e50438 Add multiple content length error
fix #2468
2022-10-02 20:04:46 +08:00
Richard Hodges 3f7f2572b0 Workaround TSAN CI bug
fix #2499
2022-08-16 10:29:27 +02:00
sehe 4f3276fd70 Exclude unused zlib sources from build
Recent update zlib-1.2.11->1.2.12 included included a number of source
files in the Bjam/CMake changes that were previously excluded.

This leads to a bunch of C99 violation warnings (implicit function
declarations).

This commit excludes the culprits again, but leaves them actively
commented-out so the same mistake is less likely to happen by accident
in the future.
2022-06-22 15:10:01 -03:00
alandefreitas 0ed09e59d9 Fix zlib warnings
fix #2461
2022-06-22 15:06:23 -03:00
alandefreitas 925043e1e8 Update Beast zlib streams
fix #2439
2022-06-03 17:45:32 -03:00
JackyYin ca824f607c Update zlib from 1.2.11 to 1.2.12
fix #2439

Because there is a CVE issue impact zlib before 1.2.12,
update zlib to avoid any related problems.

Please check the link below for detailed CVE information:
https://access.redhat.com/security/cve/CVE-2018-25032
2022-06-03 17:43:42 -03: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 746c1bb598 silence nodiscard warning in test 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
Martijn Otto 6ff7beae48 Add missing include for file_body test
close #2391
2022-03-09 16:35:24 +01:00
Richard Hodges b5a94db2a5 WebSocket handshake response is deterministic on failure:
Add test for websocket handshake failure HTTP response

fix #2364
close #2365
2021-12-22 12:00:17 +01: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
Richard Hodges f65dc21335 Fix missing includes:
Files:
beast/_experimental/test/detail/stream_state.hpp

refs #2295
2021-09-03 21:02:45 +02:00
sdarwin a9a09952a2 Update GitHub Actions CI file
closes #2301
2021-09-03 21:02:09 +02:00
Richard Hodges 7257d64a21 WebSocket test is deterministic 2021-04-06 19:24:51 +02:00
Richard Hodges c3e83439dd Fix incorrect websocket test ordering 2021-03-29 12:17:23 +02:00
Michael Haubenschild 31a1fb332a Fix missing check for error code after header is parsed:
The missing error check leads to completely ignoring the body limit,
as the body limit is compared to the "Content-Length" header inside
the "finish_header" method.

closes #2201
2021-03-25 15:04:12 +01:00
dmorilha-twilio 8283a7df3f Fix case where inflated content is larger than out buffer
closes #2191
2021-03-25 14:47:10 +01:00
Richard Hodges 523191d228 Add Github Actions CI
closes #2198
2021-03-19 00:40:18 +01:00
Richard Hodges fae4c0e3c2 Parenthesise all uses of min() and max() 2021-03-16 10:02:47 +01:00
Richard Hodges 8913a3cd21 Add executor rebind to test::stream
closes #2139
2020-12-16 21:11:29 +01:00
Richard Hodges 822722c6c3 Revert removal of deprecated lowest_layer from test::stream:
This reverts commit 3fb693eda6.
2020-12-01 17:52:53 +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 bea31bfff6 Fix nullptr implicit cast on fields::set()
fixes #2085
2020-09-13 16:19:27 +02:00
Richard Hodges 91d9457ab9 Add Sec-* HTTP headers
fixes #2080
closes #2082
2020-09-07 17:26:34 +02: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 9e6822773e Fix erroneous error when HTTP body_limit is none
fixes #2070
closes #2073
2020-08-28 13:26:59 +02:00