2
0
mirror of https://github.com/boostorg/beast.git synced 2026-01-19 16:12:10 +00:00

76 Commits

Author SHA1 Message Date
DockedFerret800
a7bf3760a5 Add missing return statements to examples 2025-07-24 21:48:11 +03:30
Mohammad Nejati
e0884660f4 Add examples of Unix domain sockets
Closes #2918
2025-02-28 16:38:36 +03:30
Mohammad Nejati
ee2b5b2ff9 Replace SSL_set1_host with asio::ssl::host_name_verification
`SSL_set1_host` fails when host is an IP address
2025-02-13 20:09:44 +03:30
Mohammad Nejati
ea38d841b0 SSL examples verify peer cert hostname
Fixes #2974
2025-02-11 19:43:58 +03:30
Mohammad Nejati
827ecf5e93 Organize source files in CMakeLists with source_group 2024-11-25 11:41:40 +03:30
Mohammad Nejati
75e45287fb Refactor CMakeLists
Closes #2471
Closes #1816
2024-11-25 11:41:40 +03:30
Mohammad Nejati
3ddcf4ed38 Jamfile cleanup 2024-09-04 22:37:14 +03:30
Mohammad Nejati
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
Mohammad Nejati
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
Mohammad Nejati
bd804b6520 ssl_stream does not use flat_stream
We no longer need to use flat_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
Mohammad Nejati
6dd3cf7ab1 std::bind is superfluous in some examples 2024-05-31 16:45:52 +03:30
Mohammad Nejati
dc154bc0bd Update host string after SSL_set_tlsext_host_name 2024-02-14 20:03:10 +03:30
Anefu
b1779ced98 fix: unhandled connection closing in websocker_server_awaitable 2023-12-24 09:48:50 +03:30
Anefu
f05413912e fix: unhandled connection closing in websocker_server_awaitable 2023-12-24 09:48:50 +03:30
slowriot
fd18cfa242 Remove unused failure reporting code 2023-05-12 18:46:36 +08:00
Klemens
99bceb5bff examples & tests use context instead of coroutine. 2023-02-02 23:27:49 +08:00
Klemens Morgenstern
09bfca1fa1 awaitable examples.
Closes #2104.
2022-10-30 00:13:54 +08:00
sehe
87ddb16151 Examples use http::message_generator 2022-05-21 22:12:13 -07:00
oerol
90e37ae40b return statement to exit reading loop
Merges PR#2414

I used this example to start building my WebSocket application, however, I noticed that upon removing the echoing in the on_read method, the server repeatedly throws errors without exiting the method.

You can recreate this problem by replacing the async_write with do_write and cause any error (i.e. client reloads the page).

Adding a return statement here would make debugging for future changes much easier and it wouldn't harm the existing echoing in any way.
2022-04-26 23:41:25 +02:00
ShuangLiu1992
b16005a456 Fix TLS SNI handling in websocket_client_async_ssl example:
Original commit message
fixed an error in websocket_client_async_ssl

close #2315

in this example host_ string should be updated after SSL_set_tlsext_host_name just like the synced version, otherwise this would cause a handshake error
2021-11-03 19:14:50 +01:00
Richard Hodges
a35cd32005 Update WebSocket examples to set TLS SNI 2020-08-28 13:26:22 +02:00
Richard Hodges
4f913cab63 Fix portability bug in websocket server sync example
fixes #2032
closes #2034
2020-07-24 13:59:46 +02:00
Richard Hodges
060f59685c Support BOOST_ASIO_NO_TS_EXECUTORS 2020-07-04 07:35:14 +02:00
Richard Hodges
c397227eb5 Fix Host header in websocket examples
closes #1633
2020-04-08 15:56:39 +02:00
Vinnie Falco
5521b91d8c Tidy up cmake files and examples 2019-10-06 08:04:22 -07:00
Damian Jarek
3eebf420f0 Add async-ssl-system-executor http client example
This example websocket client application uses the `system_executor` to show
how to use it with the I/O objects in ASIO and Beast.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-10-06 07:52:13 -07:00
Damian Jarek
0f5d1edcd8 Fix data race in websocket examples
When using `websocket::stream`, the user has to take care to initiate
async operations within the associated strand.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-10-06 07:52:13 -07:00
Damian Jarek
8d5bd286d7 Replace uses of net::spawn with asio::spawn
`asio::spawn` is an extension, which is not part of
the Networking TS, so the `net` alias is not appropriate in this case.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:35 +02:00
Damian Jarek
f10dc38ae6 Replace uses of net::coroutine with asio::coroutine
`asio::coroutine` is an extension, which is not part of
the Networking TS, so the `net` alias is not appropriate in this case.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:35 +02:00
Konstantin Podsvirov
56b5f8043f Clean up typo in chat websocket javascript client
It so happened that the code works, because both variables exist,
but the code was not clean.

close #1620
2019-06-01 18:15:25 +02:00
Konstantin Podsvirov
e5bad9cbc2 Make chat websocket javascript client more user friendly
Close #1611
2019-05-19 22:32:44 +02:00
Vinnie Falco
4e90183bda Check defined(BOOST_MSVC) 2019-03-29 20:42:44 -07:00
Vinnie Falco
61fcd9ef6f Refactor Jamfiles to work with release layout 2019-03-24 09:18:02 -07:00
Vinnie Falco
b38901887b cmake: Use static libs to speed up builds 2019-03-23 17:50:38 -07:00
Damian Jarek
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
Damian Jarek
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
Damian Jarek
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
Vinnie Falco
b51c4bb49a Tidy up examples 2019-03-06 05:40:49 -08:00
Vinnie Falco
fca4b3ae10 make_strand is in net:: 2019-03-02 07:33:57 -08:00
Vinnie Falco
272b6f23e4 Examples use flat_buffer
fix #1488
2019-03-01 12:02:28 -08:00
Vinnie Falco
8eb15148d7 Advanced servers use HTTP parser interfaces for reading 2019-02-28 10:04:52 -08:00
Vinnie Falco
8f9eed1faf stream_base::timeout::suggested is a nested function 2019-02-27 06:52:45 -08:00
Vinnie Falco
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
Vinnie Falco
5dd01155e6 Doc work 2019-02-25 08:26:42 -08:00
Vinnie Falco
6331e03a3a OpenSSL is required for tests and examples 2019-02-23 11:15:59 -08:00
Vinnie Falco
6ada618c12 Check BOOST_NO_CXX11_THREAD_LOCAL 2019-02-21 11:09:02 -08:00
Vinnie Falco
c3c3777661 Pass strand to async_accept 2019-02-20 15:30:03 -08:00
Vinnie Falco
c5b655c954 basic_stream connects are members 2019-02-19 16:27:27 -08:00
Vinnie Falco
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
Vinnie Falco
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