76 Commits

Author SHA1 Message Date
19c38c308a Replace detail/work_guard.hpp with net::executor_work_guard
In newer versions of Asio, `executor_work_guard<>` can be used even when
`ASIO_NO_TS_EXECUTORS` is defined.
2025-04-27 16:08:05 +03:30
e55670d0d0 Remove Boost.Scope dependency from examples 2024-11-26 16:51:00 +03:30
827ecf5e93 Organize source files in CMakeLists with source_group 2024-11-25 11:41:40 +03:30
75e45287fb Refactor CMakeLists
Closes #2471
Closes #1816
2024-11-25 11:41:40 +03:30
3ddcf4ed38 Jamfile cleanup 2024-09-04 22:37:14 +03:30
2bda7870fe Add support for modular build structure. (#2905)
* Use beast exclusive valgrind feature.

* Make the library modular usable.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add Beast root dir for includes. As some tests refer to files relative to that.

* Replace relative docca refs with project based.

* Avoid mtuliple openssl configurations.

* Always declare openssl. If it's empty and duplicate it will be ignored.

* Add missing import-search for cconfig/predef checks.

* Add requires-b2 check to top-level build file.

* Bump B2 require to 5.2

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Update build deps.

* Update build deps.

* The http/client/body example uses the source header from json instead of the linked library.
2024-09-01 11:26:02 +03:30
375b0b5ee8 server-flex-awaitable: connections get their own strand 2024-07-08 12:13:16 +03:30
ff5672ec07 awaitable examples are simplified
No need for `rebind_executor` as `asio::deferred` is now the default completion token.
2024-07-07 14:58:49 +03:30
03b792faac net::ssl::stream is canonical in examples
We no longer need to use beast::ssl_stream to improve write performance, as
Asio now linearizes scatter/gather I/O in ssl::stream:
17637a48cc
2024-05-31 16:45:52 +03:30
5998feda44 Fix write loop in advanced server examples
Fixes #2739
2024-01-02 21:28:58 +03:30
ba25a117a7 server-flex-awaitable example resets parser.
Closes #2715.
2023-08-18 11:40:20 +08:00
bfd5e55093 advanced_server_flex_awaitable doesn't rely on transitive include. 2023-01-04 08:44:00 +08:00
09bfca1fa1 awaitable examples.
Closes #2104.
2022-10-30 00:13:54 +08:00
87ddb16151 Examples use http::message_generator 2022-05-21 22:12:13 -07:00
b07edea9d7 Fix logic error in advance_server_flex
fixes #2063
	closes #2064
2020-08-28 13:26:22 +02:00
a21c1b7298 Fix examples to dispatch to strand
fix #1852
2020-03-17 16:04:21 +01:00
363d5c36d3 Don't pessimize-move 2019-05-20 15:34:21 +02:00
9b10f08692 detect_ssl uses bool
close #1568
2019-04-15 08:21:46 -07:00
4e90183bda Check defined(BOOST_MSVC) 2019-03-29 20:42:44 -07:00
61fcd9ef6f Refactor Jamfiles to work with release layout 2019-03-24 09:18:02 -07:00
b38901887b cmake: Use static libs to speed up builds 2019-03-23 17:50:38 -07:00
222dcf7b18 Jamfile cleanup:
- Don't set the global link settings (`<link>`) to avoid dependency
ordering issues in the future.
- Allow the user to decide on the link settings for dependencies
(filesystem/coroutine).
- Make dependencies in examples explicit.
- Remove dependency of examples on Boost.Filesystem (was not used there).
- Deduplicate build settings.
- Speed up test compilation by avoiding rebuilding of main test file.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-21 17:23:49 +01:00
05f3f8a5ce Remove the need for OpenSSL in examples that don't use it
close #1524

It is now possible to compile examples without OpenSSL. Examples that
do require OpenSSL will be omitted.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-19 06:59:55 -07:00
8869ec5681 Use secure TLS/SSL versions:
TLS1.2 can be used instead, it is available in all currently
supported versions of OpenSSL.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-14 09:56:50 -07:00
b51c4bb49a Tidy up examples 2019-03-06 05:40:49 -08:00
fca4b3ae10 make_strand is in net:: 2019-03-02 07:33:57 -08:00
bf2523b190 Tidy up an unused function 2019-03-01 11:02:52 -08:00
8eb15148d7 Advanced servers use HTTP parser interfaces for reading 2019-02-28 10:04:52 -08:00
16280f9991 Remove extraneous error check in advanced-server-flex
fix #1484
2019-02-28 07:54:20 -08:00
8f9eed1faf stream_base::timeout::suggested is a nested function 2019-02-27 06:52:45 -08:00
0647c902ac role_type is in boost/beast/core/role.hpp (API Change):
This enumeration is now part of the library core and
not specific to websocket.
2019-02-26 07:20:46 -08:00
6331e03a3a OpenSSL is required for tests and examples 2019-02-23 11:15:59 -08:00
094f5ec5cb Better treatment of SSL short reads:
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.
2019-02-23 08:56:59 -08:00
90b783cb62 detect_ssl, async_detect_ssl are public interfaces 2019-02-22 15:39:34 -08:00
6ada618c12 Check BOOST_NO_CXX11_THREAD_LOCAL 2019-02-21 11:09:02 -08:00
c3c3777661 Pass strand to async_accept 2019-02-20 15:30:03 -08:00
6baa607295 Fixes to support Asio changes (API Change):
This adjusts Beast's interfaces and implementation to match
the changes in Boost.Asio.
2019-02-19 16:23:30 -08:00
3f50efa138 WebSocket Decorator is a socket option (API Change):
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.
2019-02-19 16:23:30 -08:00
fc7b47fc5d Use suggested timeouts in Websocket examples 2019-02-18 12:18:27 -08:00
ca1b620527 Use std::bind for control_callback 2019-02-16 15:09:34 -08:00
18447553ca Examples use bind_front_handler 2019-02-14 17:28:54 -08:00
45d722874f Use tcp_stream, HTTP timeouts in advanced servers 2019-02-10 11:43:15 -08:00
cd28598e5b Fixes to rfc7230:
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.
2019-02-07 17:37:18 -08:00
6a658b5c3a Remove lowest_layer, add get_lowest_layer (API Change):
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.
2019-02-01 04:31:13 -08:00
b337abe076 examples use flat_buffer
fix #1401
2019-01-15 11:42:05 -08:00
f995fd41a3 net is a namespace alias for boost::asio:
The namespace alias beast::net replaces boost::asio in all code
and documentation.
2018-12-02 17:51:43 -08:00
5bff4ed8ab Tidy up warnings and deprecated usage:
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
2018-11-26 15:30:48 -08:00
c18f3f0ef1 Rename to _experimental directory 2018-11-12 06:52:39 -08:00
04bac8dce9 Remove extraneous strand from example
fix #1288
2018-11-03 19:30:16 -07:00
2b977f2770 Fix timer on websocket upgrade in examples
fix #1091, fix #1240, fix #1253
2018-10-07 10:38:36 -07:00