From 6c53f854070a4eebd844f21c29692e938181f8f6 Mon Sep 17 00:00:00 2001 From: R Date: Sat, 7 Nov 2026 08:59:53 -0300 Subject: [PATCH] beast: select shipped Asio backends for portable applications --- .clang-format | 5 + .gitattributes | 6 + AGENTS.md | 6 +- build.jam | 6 +- doc/application-matrix.adoc | 352 +- doc/beast.adoc | 51 +- doc/changelog.adoc | 2 + doc/verification.adoc | 20 + example/applications/adaptations.patch | 202 +- example/applications/backend-migration.json | 1780 ++++++++++ example/applications/browser.patch | 214 +- .../http_client_async_ssl_system_executor.cpp | 16 +- .../async-ssl/http_client_async_ssl.cpp | 10 +- .../http/client/async/http_client_async.cpp | 8 +- .../http_client_awaitable_ssl.cpp | 12 +- .../awaitable/http_client_awaitable.cpp | 10 +- .../browser/http/client/body/json_body.hpp | 8 +- .../browser/http/client/body/json_client.cpp | 6 +- .../browser/http/client/crawl/http_crawl.cpp | 16 +- .../http/client/crawl/urls_large_data.cpp | 2 +- .../http/client/crawl/urls_large_data.hpp | 2 +- .../client/methods/http_client_methods.cpp | 10 +- .../client/sync-ssl/http_client_sync_ssl.cpp | 12 +- .../http/client/sync/http_client_sync.cpp | 10 +- ...ocket_client_async_ssl_system_executor.cpp | 16 +- .../async-ssl/websocket_client_async_ssl.cpp | 10 +- .../client/async/websocket_client_async.cpp | 8 +- .../awaitable/websocket_client_awaitable.cpp | 10 +- .../sync-ssl/websocket_client_sync_ssl.cpp | 12 +- .../client/sync/websocket_client_sync.cpp | 10 +- example/applications/fixture_resolver.hpp | 30 +- .../applications/host-clients/json_body.hpp | 10 +- .../http_client_async_ssl_system_executor.cpp | 16 +- .../async-ssl/http_client_async_ssl.cpp | 10 +- .../http/client/async/http_client_async.cpp | 8 +- .../http_client_awaitable_ssl.cpp | 12 +- .../awaitable/http_client_awaitable.cpp | 10 +- .../http/client/body/json_body.hpp | 8 +- .../http/client/body/json_client.cpp | 6 +- .../http/client/crawl/http_crawl.cpp | 16 +- .../http/client/crawl/urls_large_data.cpp | 2 +- .../http/client/crawl/urls_large_data.hpp | 2 +- .../client/methods/http_client_methods.cpp | 10 +- .../client/sync-ssl/http_client_sync_ssl.cpp | 12 +- .../http/client/sync/http_client_sync.cpp | 10 +- ...ocket_client_async_ssl_system_executor.cpp | 16 +- .../async-ssl/websocket_client_async_ssl.cpp | 10 +- .../client/async/websocket_client_async.cpp | 8 +- .../awaitable/websocket_client_awaitable.cpp | 10 +- .../sync-ssl/websocket_client_sync_ssl.cpp | 12 +- .../client/sync/websocket_client_sync.cpp | 10 +- .../advanced_server_flex_awaitable.cpp | 7 +- .../server-flex/advanced_server_flex.cpp | 18 +- .../advanced/server/advanced_server.cpp | 12 +- .../common/root_certificates.hpp | 6 +- .../common/server_certificate.hpp | 23 +- .../noexcept-native/doc/http_examples.hpp | 22 +- .../noexcept-native/doc/ssl/client.cpp | 5 +- .../noexcept-native/doc/ssl/server.cpp | 5 +- .../noexcept-native/echo-op/echo_op.cpp | 17 +- .../async-local/http_client_async_local.cpp | 6 +- .../http_client_async_ssl_system_executor.cpp | 12 +- .../async-ssl/http_client_async_ssl.cpp | 10 +- .../http/client/async/http_client_async.cpp | 6 +- .../http_client_awaitable_ssl.cpp | 14 +- .../awaitable/http_client_awaitable.cpp | 8 +- .../http/client/body/json_body.hpp | 6 +- .../http/client/body/json_client.cpp | 4 +- .../client/coro-ssl/http_client_coro_ssl.cpp | 12 +- .../http/client/coro/http_client_coro.cpp | 8 +- .../http/client/crawl/http_crawl.cpp | 14 +- .../client/methods/http_client_methods.cpp | 8 +- .../client/sync-ssl/http_client_sync_ssl.cpp | 12 +- .../http/client/sync/http_client_sync.cpp | 8 +- .../async-local/http_server_async_local.cpp | 10 +- .../async-ssl/http_server_async_ssl.cpp | 12 +- .../http/server/async/http_server_async.cpp | 8 +- .../awaitable/http_server_awaitable.cpp | 10 +- .../server/coro-ssl/http_server_coro_ssl.cpp | 44 +- .../http/server/coro/http_server_coro.cpp | 50 +- .../http/server/fast/http_server_fast.cpp | 5 +- .../http/server/flex/http_server_flex.cpp | 12 +- .../http/server/small/http_server_small.cpp | 5 +- .../http_server_stackless_ssl.cpp | 26 +- .../stackless/http_server_stackless.cpp | 22 +- .../server/sync-ssl/http_server_sync_ssl.cpp | 12 +- .../http/server/sync/http_server_sync.cpp | 6 +- .../websocket_client_async_local.cpp | 8 +- ...ocket_client_async_ssl_system_executor.cpp | 14 +- .../async-ssl/websocket_client_async_ssl.cpp | 12 +- .../client/async/websocket_client_async.cpp | 6 +- .../awaitable/websocket_client_awaitable.cpp | 8 +- .../coro-ssl/websocket_client_coro_ssl.cpp | 14 +- .../client/coro/websocket_client_coro.cpp | 34 +- .../sync-ssl/websocket_client_sync_ssl.cpp | 14 +- .../client/sync/websocket_client_sync.cpp | 8 +- .../websocket_server_async_local.cpp | 10 +- .../async-ssl/websocket_server_async_ssl.cpp | 14 +- .../server/async/websocket_server_async.cpp | 8 +- .../awaitable/websocket_server_awaitable.cpp | 10 +- .../websocket/server/chat-multi/main.cpp | 2 +- .../websocket/server/chat-multi/net.hpp | 6 +- .../coro-ssl/websocket_server_coro_ssl.cpp | 46 +- .../server/coro/websocket_server_coro.cpp | 14 +- .../server/fast/websocket_server_fast.cpp | 24 +- .../websocket_server_stackless_ssl.cpp | 28 +- .../stackless/websocket_server_stackless.cpp | 22 +- .../sync-ssl/websocket_server_sync_ssl.cpp | 12 +- .../server/sync/websocket_server_sync.cpp | 6 +- .../advanced_server_flex_awaitable.cpp | 28 +- .../server-flex/advanced_server_flex.cpp | 16 +- .../advanced/server/advanced_server.cpp | 10 +- .../common/root_certificates.hpp | 6 +- .../common/server_certificate.hpp | 23 +- .../noexcept-single/doc/http_examples.hpp | 18 +- .../noexcept-single/doc/ssl/client.cpp | 26 +- .../noexcept-single/doc/ssl/server.cpp | 26 +- .../noexcept-single/echo-op/echo_op.cpp | 38 +- .../async-local/http_client_async_local.cpp | 6 +- .../http_client_async_ssl_system_executor.cpp | 16 +- .../async-ssl/http_client_async_ssl.cpp | 10 +- .../http/client/async/http_client_async.cpp | 6 +- .../http_client_awaitable_ssl.cpp | 14 +- .../awaitable/http_client_awaitable.cpp | 8 +- .../http/client/body/json_body.hpp | 6 +- .../http/client/body/json_client.cpp | 4 +- .../client/coro-ssl/http_client_coro_ssl.cpp | 12 +- .../http/client/coro/http_client_coro.cpp | 8 +- .../http/client/crawl/http_crawl.cpp | 14 +- .../client/methods/http_client_methods.cpp | 8 +- .../client/sync-ssl/http_client_sync_ssl.cpp | 12 +- .../http/client/sync/http_client_sync.cpp | 8 +- .../async-local/http_server_async_local.cpp | 10 +- .../async-ssl/http_server_async_ssl.cpp | 12 +- .../http/server/async/http_server_async.cpp | 8 +- .../awaitable/http_server_awaitable.cpp | 10 +- .../server/coro-ssl/http_server_coro_ssl.cpp | 44 +- .../http/server/coro/http_server_coro.cpp | 50 +- .../http/server/fast/http_server_fast.cpp | 26 +- .../http/server/flex/http_server_flex.cpp | 12 +- .../http/server/small/http_server_small.cpp | 26 +- .../http_server_stackless_ssl.cpp | 26 +- .../stackless/http_server_stackless.cpp | 22 +- .../server/sync-ssl/http_server_sync_ssl.cpp | 12 +- .../http/server/sync/http_server_sync.cpp | 6 +- .../websocket_client_async_local.cpp | 8 +- ...ocket_client_async_ssl_system_executor.cpp | 18 +- .../async-ssl/websocket_client_async_ssl.cpp | 12 +- .../client/async/websocket_client_async.cpp | 6 +- .../awaitable/websocket_client_awaitable.cpp | 8 +- .../coro-ssl/websocket_client_coro_ssl.cpp | 14 +- .../client/coro/websocket_client_coro.cpp | 34 +- .../sync-ssl/websocket_client_sync_ssl.cpp | 14 +- .../client/sync/websocket_client_sync.cpp | 8 +- .../websocket_server_async_local.cpp | 10 +- .../async-ssl/websocket_server_async_ssl.cpp | 14 +- .../server/async/websocket_server_async.cpp | 8 +- .../awaitable/websocket_server_awaitable.cpp | 10 +- .../websocket/server/chat-multi/net.hpp | 27 +- .../coro-ssl/websocket_server_coro_ssl.cpp | 46 +- .../server/coro/websocket_server_coro.cpp | 14 +- .../server/fast/websocket_server_fast.cpp | 24 +- .../websocket_server_stackless_ssl.cpp | 28 +- .../stackless/websocket_server_stackless.cpp | 22 +- .../sync-ssl/websocket_server_sync_ssl.cpp | 12 +- .../server/sync/websocket_server_sync.cpp | 6 +- .../advanced_server_flex_awaitable.cpp | 7 +- .../server-flex/advanced_server_flex.cpp | 18 +- .../port/advanced/server/advanced_server.cpp | 12 +- .../port/common/root_certificates.hpp | 6 +- .../port/common/server_certificate.hpp | 23 +- .../applications/port/doc/http_examples.hpp | 22 +- example/applications/port/doc/ssl/client.cpp | 5 +- example/applications/port/doc/ssl/server.cpp | 5 +- example/applications/port/echo-op/echo_op.cpp | 17 +- .../async-local/http_client_async_local.cpp | 6 +- .../http_client_async_ssl_system_executor.cpp | 12 +- .../async-ssl/http_client_async_ssl.cpp | 10 +- .../http/client/async/http_client_async.cpp | 6 +- .../http_client_awaitable_ssl.cpp | 14 +- .../awaitable/http_client_awaitable.cpp | 8 +- .../port/http/client/body/json_body.hpp | 6 +- .../port/http/client/body/json_client.cpp | 4 +- .../client/coro-ssl/http_client_coro_ssl.cpp | 12 +- .../http/client/coro/http_client_coro.cpp | 8 +- .../port/http/client/crawl/http_crawl.cpp | 14 +- .../client/methods/http_client_methods.cpp | 8 +- .../client/sync-ssl/http_client_sync_ssl.cpp | 12 +- .../http/client/sync/http_client_sync.cpp | 8 +- .../async-local/http_server_async_local.cpp | 10 +- .../async-ssl/http_server_async_ssl.cpp | 12 +- .../http/server/async/http_server_async.cpp | 8 +- .../awaitable/http_server_awaitable.cpp | 10 +- .../server/coro-ssl/http_server_coro_ssl.cpp | 54 +- .../http/server/coro/http_server_coro.cpp | 64 +- .../http/server/fast/http_server_fast.cpp | 5 +- .../http/server/flex/http_server_flex.cpp | 12 +- .../http/server/small/http_server_small.cpp | 5 +- .../http_server_stackless_ssl.cpp | 26 +- .../stackless/http_server_stackless.cpp | 22 +- .../server/sync-ssl/http_server_sync_ssl.cpp | 12 +- .../http/server/sync/http_server_sync.cpp | 6 +- .../websocket_client_async_local.cpp | 8 +- ...ocket_client_async_ssl_system_executor.cpp | 14 +- .../async-ssl/websocket_client_async_ssl.cpp | 12 +- .../client/async/websocket_client_async.cpp | 6 +- .../awaitable/websocket_client_awaitable.cpp | 8 +- .../coro-ssl/websocket_client_coro_ssl.cpp | 14 +- .../client/coro/websocket_client_coro.cpp | 44 +- .../sync-ssl/websocket_client_sync_ssl.cpp | 14 +- .../client/sync/websocket_client_sync.cpp | 8 +- .../websocket_server_async_local.cpp | 10 +- .../async-ssl/websocket_server_async_ssl.cpp | 14 +- .../server/async/websocket_server_async.cpp | 8 +- .../awaitable/websocket_server_awaitable.cpp | 10 +- .../port/websocket/server/chat-multi/main.cpp | 2 +- .../port/websocket/server/chat-multi/net.hpp | 6 +- .../coro-ssl/websocket_server_coro_ssl.cpp | 56 +- .../server/coro/websocket_server_coro.cpp | 14 +- .../server/fast/websocket_server_fast.cpp | 28 +- .../websocket_server_stackless_ssl.cpp | 28 +- .../stackless/websocket_server_stackless.cpp | 22 +- .../sync-ssl/websocket_server_sync_ssl.cpp | 12 +- .../server/sync/websocket_server_sync.cpp | 6 +- .../streams/websocket-channel.hpp | 28 +- .../streams/websocket-client-async-local.cpp | 22 +- .../streams/websocket-server-async-local.cpp | 14 +- example/applications/tools/prepare.py | 306 +- example/applications/tools/prepare_browser.py | 169 +- .../applications/tools/prepare_noexcept.py | 168 +- example/applications/tools/prepare_wasip3.py | 6 +- example/applications/wasip3.patch | 164 +- .../advanced_server_flex_awaitable.cpp | 28 +- .../server-flex/advanced_server_flex.cpp | 16 +- .../advanced/server/advanced_server.cpp | 10 +- .../wasip3/common/root_certificates.hpp | 6 +- .../wasip3/common/server_certificate.hpp | 23 +- .../applications/wasip3/doc/http_examples.hpp | 18 +- .../applications/wasip3/doc/ssl/client.cpp | 26 +- .../applications/wasip3/doc/ssl/server.cpp | 26 +- .../applications/wasip3/echo-op/echo_op.cpp | 38 +- .../async-local/http_client_async_local.cpp | 6 +- .../http_client_async_ssl_system_executor.cpp | 16 +- .../async-ssl/http_client_async_ssl.cpp | 10 +- .../http/client/async/http_client_async.cpp | 6 +- .../http_client_awaitable_ssl.cpp | 14 +- .../awaitable/http_client_awaitable.cpp | 8 +- .../wasip3/http/client/body/json_body.hpp | 6 +- .../wasip3/http/client/body/json_client.cpp | 4 +- .../client/coro-ssl/http_client_coro_ssl.cpp | 12 +- .../http/client/coro/http_client_coro.cpp | 8 +- .../wasip3/http/client/crawl/http_crawl.cpp | 14 +- .../client/methods/http_client_methods.cpp | 8 +- .../client/sync-ssl/http_client_sync_ssl.cpp | 12 +- .../http/client/sync/http_client_sync.cpp | 8 +- .../async-local/http_server_async_local.cpp | 10 +- .../async-ssl/http_server_async_ssl.cpp | 12 +- .../http/server/async/http_server_async.cpp | 8 +- .../awaitable/http_server_awaitable.cpp | 10 +- .../server/coro-ssl/http_server_coro_ssl.cpp | 54 +- .../http/server/coro/http_server_coro.cpp | 64 +- .../http/server/fast/http_server_fast.cpp | 26 +- .../http/server/flex/http_server_flex.cpp | 12 +- .../http/server/small/http_server_small.cpp | 26 +- .../http_server_stackless_ssl.cpp | 26 +- .../stackless/http_server_stackless.cpp | 22 +- .../server/sync-ssl/http_server_sync_ssl.cpp | 12 +- .../http/server/sync/http_server_sync.cpp | 6 +- .../websocket_client_async_local.cpp | 8 +- ...ocket_client_async_ssl_system_executor.cpp | 18 +- .../async-ssl/websocket_client_async_ssl.cpp | 12 +- .../client/async/websocket_client_async.cpp | 6 +- .../awaitable/websocket_client_awaitable.cpp | 8 +- .../coro-ssl/websocket_client_coro_ssl.cpp | 14 +- .../client/coro/websocket_client_coro.cpp | 44 +- .../sync-ssl/websocket_client_sync_ssl.cpp | 14 +- .../client/sync/websocket_client_sync.cpp | 8 +- .../websocket_server_async_local.cpp | 10 +- .../async-ssl/websocket_server_async_ssl.cpp | 14 +- .../server/async/websocket_server_async.cpp | 8 +- .../awaitable/websocket_server_awaitable.cpp | 10 +- .../websocket/server/chat-multi/net.hpp | 27 +- .../coro-ssl/websocket_server_coro_ssl.cpp | 56 +- .../server/coro/websocket_server_coro.cpp | 14 +- .../server/fast/websocket_server_fast.cpp | 28 +- .../websocket_server_stackless_ssl.cpp | 28 +- .../stackless/websocket_server_stackless.cpp | 22 +- .../sync-ssl/websocket_server_sync_ssl.cpp | 12 +- .../server/sync/websocket_server_sync.cpp | 6 +- example/browser/client.cpp | 4 +- .../beast/_experimental/http/icy_stream.hpp | 6 + .../webcpp/beast/_experimental/test/error.hpp | 6 + .../beast/_experimental/test/fail_count.hpp | 6 + .../beast/_experimental/test/handler.hpp | 6 + .../_experimental/test/immediate_executor.hpp | 6 + .../beast/_experimental/test/stream.hpp | 6 + .../webcpp/beast/_experimental/test/tcp.hpp | 6 + .../beast/_experimental/unit_test/amount.hpp | 6 + .../beast/_experimental/unit_test/dstream.hpp | 6 + .../_experimental/unit_test/global_suites.hpp | 6 + .../beast/_experimental/unit_test/match.hpp | 6 + .../_experimental/unit_test/recorder.hpp | 6 + .../_experimental/unit_test/reporter.hpp | 6 + .../beast/_experimental/unit_test/results.hpp | 6 + .../beast/_experimental/unit_test/runner.hpp | 6 + .../beast/_experimental/unit_test/suite.hpp | 6 + .../_experimental/unit_test/suite_info.hpp | 6 + .../_experimental/unit_test/suite_list.hpp | 6 + .../webcpp/beast/browser/detail/imports.hpp | 11 +- .../webcpp/beast/browser/detail/support.hpp | 57 +- include/webcpp/beast/browser/http.hpp | 171 +- .../webcpp/beast/browser/http_byte_stream.hpp | 44 +- include/webcpp/beast/browser/ssl_stream.hpp | 6 +- include/webcpp/beast/browser/tcp_stream.hpp | 21 +- include/webcpp/beast/browser/websocket.hpp | 165 +- include/webcpp/beast/config.hpp | 10 + include/webcpp/beast/core.hpp | 60 +- include/webcpp/beast/core/async_base.hpp | 6 + include/webcpp/beast/core/basic_stream.hpp | 6 + include/webcpp/beast/core/bind_handler.hpp | 6 + include/webcpp/beast/core/buffer_ref.hpp | 6 + include/webcpp/beast/core/buffer_traits.hpp | 6 + .../beast/core/buffered_read_stream.hpp | 6 + include/webcpp/beast/core/buffers_adaptor.hpp | 6 + include/webcpp/beast/core/buffers_cat.hpp | 6 + .../webcpp/beast/core/buffers_generator.hpp | 6 + include/webcpp/beast/core/buffers_prefix.hpp | 6 + include/webcpp/beast/core/buffers_range.hpp | 6 + include/webcpp/beast/core/buffers_suffix.hpp | 6 + .../webcpp/beast/core/buffers_to_string.hpp | 6 + include/webcpp/beast/core/detect_ssl.hpp | 6 + include/webcpp/beast/core/error.hpp | 6 + include/webcpp/beast/core/file.hpp | 6 + include/webcpp/beast/core/file_base.hpp | 6 + include/webcpp/beast/core/file_posix.hpp | 6 + include/webcpp/beast/core/file_stdio.hpp | 6 + include/webcpp/beast/core/file_win32.hpp | 6 + include/webcpp/beast/core/flat_buffer.hpp | 6 + .../webcpp/beast/core/flat_static_buffer.hpp | 6 + include/webcpp/beast/core/flat_stream.hpp | 6 + include/webcpp/beast/core/make_printable.hpp | 6 + include/webcpp/beast/core/multi_buffer.hpp | 6 + include/webcpp/beast/core/ostream.hpp | 6 + include/webcpp/beast/core/rate_policy.hpp | 6 + include/webcpp/beast/core/read_size.hpp | 6 + include/webcpp/beast/core/role.hpp | 6 + include/webcpp/beast/core/saved_handler.hpp | 6 + include/webcpp/beast/core/span.hpp | 6 + include/webcpp/beast/core/static_buffer.hpp | 6 + include/webcpp/beast/core/static_string.hpp | 6 + include/webcpp/beast/core/stream_traits.hpp | 6 + include/webcpp/beast/core/string.hpp | 6 + include/webcpp/beast/core/string_param.hpp | 6 + include/webcpp/beast/core/string_type.hpp | 6 + include/webcpp/beast/core/tcp_stream.hpp | 6 + .../backend/_experimental/http/icy_stream.hpp | 329 ++ .../_experimental/http/impl/icy_stream.hpp | 360 ++ .../test/detail/stream_state.hpp | 138 + .../test/detail/stream_state.ipp | 151 + .../backend/_experimental/test/error.hpp | 40 + .../backend/_experimental/test/fail_count.hpp | 70 + .../backend/_experimental/test/handler.hpp | 199 ++ .../_experimental/test/immediate_executor.hpp | 119 + .../backend/_experimental/test/impl/error.hpp | 40 + .../backend/_experimental/test/impl/error.ipp | 72 + .../_experimental/test/impl/fail_count.ipp | 58 + .../_experimental/test/impl/stream.hpp | 483 +++ .../_experimental/test/impl/stream.ipp | 277 ++ .../backend/_experimental/test/stream.hpp | 622 ++++ .../detail/backend/_experimental/test/tcp.hpp | 77 + .../_experimental/unit_test/amount.hpp | 59 + .../unit_test/detail/const_container.hpp | 95 + .../_experimental/unit_test/dstream.hpp | 131 + .../_experimental/unit_test/global_suites.hpp | 55 + .../backend/_experimental/unit_test/main.ipp | 88 + .../backend/_experimental/unit_test/match.hpp | 176 + .../_experimental/unit_test/recorder.hpp | 93 + .../_experimental/unit_test/reporter.hpp | 292 ++ .../_experimental/unit_test/results.hpp | 246 ++ .../_experimental/unit_test/runner.hpp | 292 ++ .../backend/_experimental/unit_test/suite.hpp | 745 +++++ .../_experimental/unit_test/suite_info.hpp | 126 + .../_experimental/unit_test/suite_list.hpp | 85 + include/webcpp/beast/detail/backend/core.hpp | 52 + .../beast/detail/backend/core/async_base.hpp | 781 +++++ .../detail/backend/core/basic_stream.hpp | 1587 +++++++++ .../detail/backend/core/bind_handler.hpp | 132 + .../beast/detail/backend/core/buffer_ref.hpp | 177 + .../detail/backend/core/buffer_traits.hpp | 164 + .../backend/core/buffered_read_stream.hpp | 363 ++ .../detail/backend/core/buffers_adaptor.hpp | 236 ++ .../beast/detail/backend/core/buffers_cat.hpp | 105 + .../detail/backend/core/buffers_generator.hpp | 200 ++ .../detail/backend/core/buffers_prefix.hpp | 201 ++ .../detail/backend/core/buffers_range.hpp | 127 + .../detail/backend/core/buffers_suffix.hpp | 146 + .../detail/backend/core/buffers_to_string.hpp | 62 + .../detail/backend/core/detail/allocator.hpp | 42 + .../detail/backend/core/detail/async_base.hpp | 60 + .../detail/backend/core/detail/base64.hpp | 88 + .../detail/backend/core/detail/base64.ipp | 202 ++ .../backend/core/detail/bind_continuation.hpp | 110 + .../backend/core/detail/bind_handler.hpp | 321 ++ .../detail/backend/core/detail/buffer.hpp | 84 + .../backend/core/detail/buffer_traits.hpp | 98 + .../backend/core/detail/buffers_pair.hpp | 115 + .../core/detail/buffers_range_adaptor.hpp | 133 + .../backend/core/detail/buffers_ref.hpp | 71 + .../detail/backend/core/detail/chacha.hpp | 126 + .../backend/core/detail/char_buffer.hpp | 78 + .../detail/backend/core/detail/clamp.hpp | 57 + .../detail/backend/core/detail/config.hpp | 119 + .../detail/backend/core/detail/cpu_info.hpp | 100 + .../detail/filtering_cancellation_slot.hpp | 65 + .../backend/core/detail/flat_stream.hpp | 73 + .../backend/core/detail/get_io_context.hpp | 109 + .../detail/backend/core/detail/impl/read.hpp | 256 ++ .../core/detail/impl/temporary_buffer.ipp | 69 + .../backend/core/detail/is_invocable.hpp | 80 + .../detail/backend/core/detail/ostream.hpp | 267 ++ .../beast/detail/backend/core/detail/pcg.hpp | 65 + .../beast/detail/backend/core/detail/read.hpp | 246 ++ .../core/detail/remap_post_to_defer.hpp | 108 + .../backend/core/detail/service_base.hpp | 38 + .../beast/detail/backend/core/detail/sha1.hpp | 75 + .../beast/detail/backend/core/detail/sha1.ipp | 301 ++ .../backend/core/detail/static_const.hpp | 49 + .../backend/core/detail/static_ostream.hpp | 142 + .../backend/core/detail/static_string.hpp | 92 + .../backend/core/detail/stream_base.hpp | 148 + .../backend/core/detail/stream_traits.hpp | 111 + .../detail/backend/core/detail/string.hpp | 44 + .../backend/core/detail/temporary_buffer.hpp | 83 + .../detail/backend/core/detail/tuple.hpp | 116 + .../backend/core/detail/type_traits.hpp | 95 + .../detail/backend/core/detail/variant.hpp | 238 ++ .../detail/backend/core/detail/varint.hpp | 79 + .../core/detail/win32_unicode_path.hpp | 83 + .../beast/detail/backend/core/detect_ssl.hpp | 667 ++++ .../beast/detail/backend/core/error.hpp | 88 + .../webcpp/beast/detail/backend/core/file.hpp | 44 + .../beast/detail/backend/core/file_base.hpp | 164 + .../beast/detail/backend/core/file_posix.hpp | 193 ++ .../beast/detail/backend/core/file_stdio.hpp | 171 + .../beast/detail/backend/core/file_win32.hpp | 190 ++ .../beast/detail/backend/core/flat_buffer.hpp | 530 +++ .../backend/core/flat_static_buffer.hpp | 317 ++ .../beast/detail/backend/core/flat_stream.hpp | 357 ++ .../detail/backend/core/impl/async_base.hpp | 113 + .../detail/backend/core/impl/basic_stream.hpp | 1123 +++++++ .../core/impl/buffered_read_stream.hpp | 251 ++ .../backend/core/impl/buffers_adaptor.hpp | 708 ++++ .../detail/backend/core/impl/buffers_cat.hpp | 465 +++ .../backend/core/impl/buffers_generator.hpp | 173 + .../backend/core/impl/buffers_prefix.hpp | 326 ++ .../backend/core/impl/buffers_suffix.hpp | 225 ++ .../beast/detail/backend/core/impl/error.hpp | 44 + .../beast/detail/backend/core/impl/error.ipp | 117 + .../detail/backend/core/impl/file_posix.ipp | 341 ++ .../detail/backend/core/impl/file_stdio.ipp | 329 ++ .../detail/backend/core/impl/file_win32.ipp | 380 +++ .../detail/backend/core/impl/flat_buffer.hpp | 556 +++ .../backend/core/impl/flat_static_buffer.hpp | 43 + .../backend/core/impl/flat_static_buffer.ipp | 89 + .../detail/backend/core/impl/flat_stream.hpp | 292 ++ .../detail/backend/core/impl/multi_buffer.hpp | 1297 +++++++ .../detail/backend/core/impl/read_size.hpp | 83 + .../backend/core/impl/saved_handler.hpp | 227 ++ .../backend/core/impl/saved_handler.ipp | 78 + .../backend/core/impl/static_buffer.hpp | 45 + .../backend/core/impl/static_buffer.ipp | 129 + .../beast/detail/backend/core/impl/string.ipp | 70 + .../detail/backend/core/impl/string_param.hpp | 108 + .../detail/backend/core/make_printable.hpp | 107 + .../detail/backend/core/multi_buffer.hpp | 594 ++++ .../beast/detail/backend/core/ostream.hpp | 90 + .../beast/detail/backend/core/rate_policy.hpp | 226 ++ .../beast/detail/backend/core/read_size.hpp | 63 + .../webcpp/beast/detail/backend/core/role.hpp | 50 + .../detail/backend/core/saved_handler.hpp | 144 + .../webcpp/beast/detail/backend/core/span.hpp | 25 + .../detail/backend/core/static_buffer.hpp | 293 ++ .../detail/backend/core/static_string.hpp | 36 + .../detail/backend/core/stream_traits.hpp | 544 +++ .../beast/detail/backend/core/string.hpp | 80 + .../detail/backend/core/string_param.hpp | 134 + .../beast/detail/backend/core/string_type.hpp | 37 + .../beast/detail/backend/core/tcp_stream.hpp | 34 + include/webcpp/beast/detail/backend/http.hpp | 41 + .../backend/http/basic_dynamic_body.hpp | 163 + .../backend/http/basic_dynamic_body_fwd.hpp | 24 + .../detail/backend/http/basic_file_body.hpp | 588 ++++ .../backend/http/basic_file_body_fwd.hpp | 24 + .../detail/backend/http/basic_parser.hpp | 731 ++++ .../beast/detail/backend/http/buffer_body.hpp | 232 ++ .../detail/backend/http/buffer_body_fwd.hpp | 23 + .../detail/backend/http/chunk_encode.hpp | 737 ++++ .../backend/http/detail/basic_parsed_list.hpp | 197 ++ .../backend/http/detail/basic_parser.hpp | 202 ++ .../backend/http/detail/basic_parser.ipp | 825 +++++ .../backend/http/detail/chunk_encode.hpp | 224 ++ .../detail/backend/http/detail/rfc7230.hpp | 107 + .../detail/backend/http/detail/rfc7230.ipp | 390 +++ .../backend/http/detail/type_traits.hpp | 194 ++ .../detail/backend/http/dynamic_body.hpp | 34 + .../detail/backend/http/dynamic_body_fwd.hpp | 37 + .../beast/detail/backend/http/empty_body.hpp | 135 + .../detail/backend/http/empty_body_fwd.hpp | 23 + .../beast/detail/backend/http/error.hpp | 185 + .../beast/detail/backend/http/field.hpp | 188 ++ .../beast/detail/backend/http/fields.hpp | 893 +++++ .../beast/detail/backend/http/fields_fwd.hpp | 30 + .../beast/detail/backend/http/file_body.hpp | 38 + .../detail/backend/http/file_body_fwd.hpp | 29 + .../detail/backend/http/impl/basic_parser.hpp | 88 + .../detail/backend/http/impl/basic_parser.ipp | 867 +++++ .../detail/backend/http/impl/chunk_encode.hpp | 706 ++++ .../beast/detail/backend/http/impl/error.hpp | 37 + .../beast/detail/backend/http/impl/error.ipp | 117 + .../beast/detail/backend/http/impl/field.ipp | 338 ++ .../beast/detail/backend/http/impl/fields.hpp | 1267 +++++++ .../beast/detail/backend/http/impl/fields.ipp | 138 + .../backend/http/impl/file_body_win32.hpp | 651 ++++ .../detail/backend/http/impl/message.hpp | 428 +++ .../backend/http/impl/message_generator.hpp | 104 + .../beast/detail/backend/http/impl/parser.hpp | 58 + .../beast/detail/backend/http/impl/read.hpp | 730 ++++ .../detail/backend/http/impl/rfc7230.hpp | 389 +++ .../detail/backend/http/impl/rfc7230.ipp | 205 ++ .../detail/backend/http/impl/serializer.hpp | 431 +++ .../beast/detail/backend/http/impl/status.ipp | 222 ++ .../beast/detail/backend/http/impl/verb.ipp | 303 ++ .../beast/detail/backend/http/impl/write.hpp | 1014 ++++++ .../beast/detail/backend/http/message.hpp | 1018 ++++++ .../beast/detail/backend/http/message_fwd.hpp | 43 + .../detail/backend/http/message_generator.hpp | 101 + .../backend/http/message_generator_fwd.hpp | 23 + .../beast/detail/backend/http/parser.hpp | 607 ++++ .../beast/detail/backend/http/parser_fwd.hpp | 37 + .../webcpp/beast/detail/backend/http/read.hpp | 845 +++++ .../beast/detail/backend/http/rfc7230.hpp | 329 ++ .../beast/detail/backend/http/serializer.hpp | 399 +++ .../detail/backend/http/serializer_fwd.hpp | 34 + .../beast/detail/backend/http/span_body.hpp | 173 + .../detail/backend/http/span_body_fwd.hpp | 24 + .../beast/detail/backend/http/status.hpp | 182 + .../beast/detail/backend/http/string_body.hpp | 194 ++ .../detail/backend/http/string_body_fwd.hpp | 34 + .../beast/detail/backend/http/type_traits.hpp | 232 ++ .../beast/detail/backend/http/vector_body.hpp | 173 + .../detail/backend/http/vector_body_fwd.hpp | 26 + .../webcpp/beast/detail/backend/http/verb.hpp | 161 + .../beast/detail/backend/http/write.hpp | 823 +++++ include/webcpp/beast/detail/backend/src.hpp | 68 + include/webcpp/beast/detail/backend/ssl.hpp | 18 + .../beast/detail/backend/ssl/ssl_stream.hpp | 66 + .../webcpp/beast/detail/backend/version.hpp | 32 + .../webcpp/beast/detail/backend/websocket.hpp | 24 + .../backend/websocket/detail/decorator.hpp | 315 ++ .../detail/backend/websocket/detail/frame.hpp | 247 ++ .../backend/websocket/detail/hybi13.hpp | 48 + .../backend/websocket/detail/hybi13.ipp | 62 + .../backend/websocket/detail/impl_base.hpp | 539 +++ .../detail/backend/websocket/detail/mask.hpp | 63 + .../detail/backend/websocket/detail/mask.ipp | 66 + .../websocket/detail/pmd_extension.hpp | 125 + .../websocket/detail/pmd_extension.ipp | 310 ++ .../detail/backend/websocket/detail/prng.hpp | 50 + .../detail/backend/websocket/detail/prng.ipp | 151 + .../backend/websocket/detail/service.hpp | 78 + .../backend/websocket/detail/service.ipp | 65 + .../backend/websocket/detail/soft_mutex.hpp | 112 + .../backend/websocket/detail/type_traits.hpp | 36 + .../backend/websocket/detail/utf8_checker.hpp | 96 + .../backend/websocket/detail/utf8_checker.ipp | 331 ++ .../beast/detail/backend/websocket/error.hpp | 256 ++ .../detail/backend/websocket/impl/accept.hpp | 698 ++++ .../detail/backend/websocket/impl/close.hpp | 478 +++ .../detail/backend/websocket/impl/error.hpp | 44 + .../detail/backend/websocket/impl/error.ipp | 179 + .../backend/websocket/impl/handshake.hpp | 417 +++ .../detail/backend/websocket/impl/ping.hpp | 375 +++ .../detail/backend/websocket/impl/read.hpp | 1414 ++++++++ .../detail/backend/websocket/impl/rfc6455.hpp | 40 + .../detail/backend/websocket/impl/ssl.hpp | 111 + .../detail/backend/websocket/impl/stream.hpp | 390 +++ .../backend/websocket/impl/stream_impl.hpp | 1003 ++++++ .../backend/websocket/impl/teardown.hpp | 214 ++ .../detail/backend/websocket/impl/write.hpp | 913 +++++ .../beast/detail/backend/websocket/option.hpp | 74 + .../detail/backend/websocket/rfc6455.hpp | 220 ++ .../beast/detail/backend/websocket/ssl.hpp | 107 + .../beast/detail/backend/websocket/stream.hpp | 2970 +++++++++++++++++ .../detail/backend/websocket/stream_base.hpp | 182 + .../detail/backend/websocket/stream_fwd.hpp | 36 + .../detail/backend/websocket/teardown.hpp | 216 ++ include/webcpp/beast/detail/backend/zlib.hpp | 21 + .../detail/backend/zlib/deflate_stream.hpp | 416 +++ .../detail/backend/zlib/detail/bitstream.hpp | 201 ++ .../backend/zlib/detail/deflate_stream.hpp | 723 ++++ .../backend/zlib/detail/deflate_stream.ipp | 2331 +++++++++++++ .../backend/zlib/detail/inflate_stream.hpp | 251 ++ .../backend/zlib/detail/inflate_stream.ipp | 1120 +++++++ .../detail/backend/zlib/detail/ranges.hpp | 102 + .../detail/backend/zlib/detail/window.hpp | 151 + .../beast/detail/backend/zlib/error.hpp | 152 + .../beast/detail/backend/zlib/impl/error.hpp | 63 + .../beast/detail/backend/zlib/impl/error.ipp | 131 + .../detail/backend/zlib/inflate_stream.hpp | 219 ++ .../webcpp/beast/detail/backend/zlib/zlib.hpp | 253 ++ .../webcpp/beast/detail/backend_select.hpp | 40 + .../webcpp/beast/detail/socket_algorithms.hpp | 38 +- include/webcpp/beast/http.hpp | 71 +- .../webcpp/beast/http/basic_dynamic_body.hpp | 6 + .../beast/http/basic_dynamic_body_fwd.hpp | 6 + include/webcpp/beast/http/basic_file_body.hpp | 6 + .../webcpp/beast/http/basic_file_body_fwd.hpp | 6 + include/webcpp/beast/http/basic_parser.hpp | 6 + include/webcpp/beast/http/buffer_body.hpp | 6 + include/webcpp/beast/http/buffer_body_fwd.hpp | 6 + include/webcpp/beast/http/chunk_encode.hpp | 6 + include/webcpp/beast/http/dynamic_body.hpp | 6 + .../webcpp/beast/http/dynamic_body_fwd.hpp | 6 + include/webcpp/beast/http/empty_body.hpp | 6 + include/webcpp/beast/http/empty_body_fwd.hpp | 6 + include/webcpp/beast/http/error.hpp | 6 + include/webcpp/beast/http/field.hpp | 6 + include/webcpp/beast/http/fields.hpp | 6 + include/webcpp/beast/http/fields_fwd.hpp | 6 + include/webcpp/beast/http/file_body.hpp | 6 + include/webcpp/beast/http/file_body_fwd.hpp | 6 + include/webcpp/beast/http/message.hpp | 6 + include/webcpp/beast/http/message_fwd.hpp | 6 + .../webcpp/beast/http/message_generator.hpp | 6 + .../beast/http/message_generator_fwd.hpp | 6 + include/webcpp/beast/http/parser.hpp | 6 + include/webcpp/beast/http/parser_fwd.hpp | 6 + include/webcpp/beast/http/read.hpp | 14 +- include/webcpp/beast/http/rfc7230.hpp | 6 + include/webcpp/beast/http/serializer.hpp | 6 + include/webcpp/beast/http/serializer_fwd.hpp | 6 + include/webcpp/beast/http/span_body.hpp | 6 + include/webcpp/beast/http/span_body_fwd.hpp | 6 + include/webcpp/beast/http/status.hpp | 6 + include/webcpp/beast/http/string_body.hpp | 6 + include/webcpp/beast/http/string_body_fwd.hpp | 6 + include/webcpp/beast/http/type_traits.hpp | 6 + include/webcpp/beast/http/vector_body.hpp | 6 + include/webcpp/beast/http/vector_body_fwd.hpp | 6 + include/webcpp/beast/http/verb.hpp | 6 + include/webcpp/beast/http/write.hpp | 14 +- include/webcpp/beast/src.hpp | 6 + include/webcpp/beast/ssl.hpp | 10 +- include/webcpp/beast/ssl/ssl_stream.hpp | 6 + include/webcpp/beast/tcp_stream.hpp | 15 +- include/webcpp/beast/version.hpp | 6 + include/webcpp/beast/wasi/async.hpp | 64 +- include/webcpp/beast/wasi/http.hpp | 12 +- include/webcpp/beast/wasi/stream.hpp | 8 +- include/webcpp/beast/websocket.hpp | 32 +- include/webcpp/beast/websocket/error.hpp | 9 + include/webcpp/beast/websocket/guest.hpp | 33 +- include/webcpp/beast/websocket/option.hpp | 9 + include/webcpp/beast/websocket/rfc6455.hpp | 9 + include/webcpp/beast/websocket/ssl.hpp | 10 + include/webcpp/beast/websocket/stream.hpp | 9 + .../webcpp/beast/websocket/stream_base.hpp | 9 + include/webcpp/beast/websocket/stream_fwd.hpp | 9 + include/webcpp/beast/websocket/teardown.hpp | 9 + include/webcpp/beast/zlib.hpp | 6 + include/webcpp/beast/zlib/deflate_stream.hpp | 6 + include/webcpp/beast/zlib/error.hpp | 6 + include/webcpp/beast/zlib/inflate_stream.hpp | 6 + include/webcpp/beast/zlib/zlib.hpp | 6 + test/Jamfile | 12 +- test/applications/browser-noexcept/Jamfile | 80 +- test/applications/browser/Jamfile | 80 +- test/applications/browser/network-worker.mjs | 31 + test/applications/browser/page.html | 26 +- test/applications/browser/run.mjs | 22 +- test/applications/documentation_snippets.cpp | 4 +- test/applications/inventory_test.py | 123 +- test/applications/matrix.py | 603 +++- test/applications/noexcept/Jamfile | 84 +- .../streams/websocket_cancel_test.cpp | 14 +- test/applications/wasip3/Jamfile | 124 +- test/browser/Jamfile | 7 +- test/browser/allocation_test.cpp | 98 +- test/browser/browser_test.cpp | 119 +- test/browser/chunk_allocation_test.cpp | 131 + test/browser/environment_test.cpp | 10 +- test/browser/lifecycle_test.cpp | 12 +- test/browser/peer/native_peer.cpp | 4 +- test/browser/run.mjs | 4 +- test/message_test.cpp | 15 +- test/socket_test.cpp | 39 +- test/ssl_test.cpp | 3 +- test/tls/Jamfile | 5 +- test/tls/protocol.cpp | 36 +- test/tls/public_headers.cpp | 22 + test/wasi/async_http.cpp | 70 +- test/wasi/stream.cpp | 4 +- test/wasi/supplied.cpp | 2 +- upstream/README.md | 21 + upstream/generated.json | 365 ++ upstream/pin.json | 285 ++ upstream/sync.py | 115 + 707 files changed, 74804 insertions(+), 3497 deletions(-) create mode 100644 .clang-format create mode 100644 example/applications/backend-migration.json create mode 100644 include/webcpp/beast/_experimental/http/icy_stream.hpp create mode 100644 include/webcpp/beast/_experimental/test/error.hpp create mode 100644 include/webcpp/beast/_experimental/test/fail_count.hpp create mode 100644 include/webcpp/beast/_experimental/test/handler.hpp create mode 100644 include/webcpp/beast/_experimental/test/immediate_executor.hpp create mode 100644 include/webcpp/beast/_experimental/test/stream.hpp create mode 100644 include/webcpp/beast/_experimental/test/tcp.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/amount.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/dstream.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/global_suites.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/match.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/recorder.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/reporter.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/results.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/runner.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/suite.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/suite_info.hpp create mode 100644 include/webcpp/beast/_experimental/unit_test/suite_list.hpp create mode 100644 include/webcpp/beast/core/async_base.hpp create mode 100644 include/webcpp/beast/core/basic_stream.hpp create mode 100644 include/webcpp/beast/core/bind_handler.hpp create mode 100644 include/webcpp/beast/core/buffer_ref.hpp create mode 100644 include/webcpp/beast/core/buffer_traits.hpp create mode 100644 include/webcpp/beast/core/buffered_read_stream.hpp create mode 100644 include/webcpp/beast/core/buffers_adaptor.hpp create mode 100644 include/webcpp/beast/core/buffers_cat.hpp create mode 100644 include/webcpp/beast/core/buffers_generator.hpp create mode 100644 include/webcpp/beast/core/buffers_prefix.hpp create mode 100644 include/webcpp/beast/core/buffers_range.hpp create mode 100644 include/webcpp/beast/core/buffers_suffix.hpp create mode 100644 include/webcpp/beast/core/buffers_to_string.hpp create mode 100644 include/webcpp/beast/core/detect_ssl.hpp create mode 100644 include/webcpp/beast/core/error.hpp create mode 100644 include/webcpp/beast/core/file.hpp create mode 100644 include/webcpp/beast/core/file_base.hpp create mode 100644 include/webcpp/beast/core/file_posix.hpp create mode 100644 include/webcpp/beast/core/file_stdio.hpp create mode 100644 include/webcpp/beast/core/file_win32.hpp create mode 100644 include/webcpp/beast/core/flat_buffer.hpp create mode 100644 include/webcpp/beast/core/flat_static_buffer.hpp create mode 100644 include/webcpp/beast/core/flat_stream.hpp create mode 100644 include/webcpp/beast/core/make_printable.hpp create mode 100644 include/webcpp/beast/core/multi_buffer.hpp create mode 100644 include/webcpp/beast/core/ostream.hpp create mode 100644 include/webcpp/beast/core/rate_policy.hpp create mode 100644 include/webcpp/beast/core/read_size.hpp create mode 100644 include/webcpp/beast/core/role.hpp create mode 100644 include/webcpp/beast/core/saved_handler.hpp create mode 100644 include/webcpp/beast/core/span.hpp create mode 100644 include/webcpp/beast/core/static_buffer.hpp create mode 100644 include/webcpp/beast/core/static_string.hpp create mode 100644 include/webcpp/beast/core/stream_traits.hpp create mode 100644 include/webcpp/beast/core/string.hpp create mode 100644 include/webcpp/beast/core/string_param.hpp create mode 100644 include/webcpp/beast/core/string_type.hpp create mode 100644 include/webcpp/beast/core/tcp_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/http/icy_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/http/impl/icy_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/detail/stream_state.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/detail/stream_state.ipp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/error.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/fail_count.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/handler.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/immediate_executor.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/impl/error.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/impl/error.ipp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/impl/fail_count.ipp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/impl/stream.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/impl/stream.ipp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/stream.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/test/tcp.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/amount.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/detail/const_container.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/dstream.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/global_suites.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/main.ipp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/match.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/recorder.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/reporter.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/results.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/runner.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/suite.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/suite_info.hpp create mode 100644 include/webcpp/beast/detail/backend/_experimental/unit_test/suite_list.hpp create mode 100644 include/webcpp/beast/detail/backend/core.hpp create mode 100644 include/webcpp/beast/detail/backend/core/async_base.hpp create mode 100644 include/webcpp/beast/detail/backend/core/basic_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/bind_handler.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffer_ref.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffer_traits.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffered_read_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffers_adaptor.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffers_cat.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffers_generator.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffers_prefix.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffers_range.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffers_suffix.hpp create mode 100644 include/webcpp/beast/detail/backend/core/buffers_to_string.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/allocator.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/async_base.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/base64.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/base64.ipp create mode 100644 include/webcpp/beast/detail/backend/core/detail/bind_continuation.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/bind_handler.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/buffer_traits.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/buffers_pair.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/buffers_range_adaptor.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/buffers_ref.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/chacha.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/char_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/clamp.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/config.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/cpu_info.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/filtering_cancellation_slot.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/flat_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/get_io_context.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/impl/read.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/impl/temporary_buffer.ipp create mode 100644 include/webcpp/beast/detail/backend/core/detail/is_invocable.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/ostream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/pcg.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/read.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/remap_post_to_defer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/service_base.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/sha1.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/sha1.ipp create mode 100644 include/webcpp/beast/detail/backend/core/detail/static_const.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/static_ostream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/static_string.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/stream_base.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/stream_traits.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/string.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/temporary_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/tuple.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/type_traits.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/variant.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/varint.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detail/win32_unicode_path.hpp create mode 100644 include/webcpp/beast/detail/backend/core/detect_ssl.hpp create mode 100644 include/webcpp/beast/detail/backend/core/error.hpp create mode 100644 include/webcpp/beast/detail/backend/core/file.hpp create mode 100644 include/webcpp/beast/detail/backend/core/file_base.hpp create mode 100644 include/webcpp/beast/detail/backend/core/file_posix.hpp create mode 100644 include/webcpp/beast/detail/backend/core/file_stdio.hpp create mode 100644 include/webcpp/beast/detail/backend/core/file_win32.hpp create mode 100644 include/webcpp/beast/detail/backend/core/flat_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/flat_static_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/flat_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/async_base.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/basic_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/buffered_read_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/buffers_adaptor.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/buffers_cat.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/buffers_generator.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/buffers_prefix.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/buffers_suffix.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/error.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/error.ipp create mode 100644 include/webcpp/beast/detail/backend/core/impl/file_posix.ipp create mode 100644 include/webcpp/beast/detail/backend/core/impl/file_stdio.ipp create mode 100644 include/webcpp/beast/detail/backend/core/impl/file_win32.ipp create mode 100644 include/webcpp/beast/detail/backend/core/impl/flat_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/flat_static_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/flat_static_buffer.ipp create mode 100644 include/webcpp/beast/detail/backend/core/impl/flat_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/multi_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/read_size.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/saved_handler.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/saved_handler.ipp create mode 100644 include/webcpp/beast/detail/backend/core/impl/static_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/impl/static_buffer.ipp create mode 100644 include/webcpp/beast/detail/backend/core/impl/string.ipp create mode 100644 include/webcpp/beast/detail/backend/core/impl/string_param.hpp create mode 100644 include/webcpp/beast/detail/backend/core/make_printable.hpp create mode 100644 include/webcpp/beast/detail/backend/core/multi_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/ostream.hpp create mode 100644 include/webcpp/beast/detail/backend/core/rate_policy.hpp create mode 100644 include/webcpp/beast/detail/backend/core/read_size.hpp create mode 100644 include/webcpp/beast/detail/backend/core/role.hpp create mode 100644 include/webcpp/beast/detail/backend/core/saved_handler.hpp create mode 100644 include/webcpp/beast/detail/backend/core/span.hpp create mode 100644 include/webcpp/beast/detail/backend/core/static_buffer.hpp create mode 100644 include/webcpp/beast/detail/backend/core/static_string.hpp create mode 100644 include/webcpp/beast/detail/backend/core/stream_traits.hpp create mode 100644 include/webcpp/beast/detail/backend/core/string.hpp create mode 100644 include/webcpp/beast/detail/backend/core/string_param.hpp create mode 100644 include/webcpp/beast/detail/backend/core/string_type.hpp create mode 100644 include/webcpp/beast/detail/backend/core/tcp_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/http.hpp create mode 100644 include/webcpp/beast/detail/backend/http/basic_dynamic_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/basic_dynamic_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/basic_file_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/basic_file_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/basic_parser.hpp create mode 100644 include/webcpp/beast/detail/backend/http/buffer_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/buffer_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/chunk_encode.hpp create mode 100644 include/webcpp/beast/detail/backend/http/detail/basic_parsed_list.hpp create mode 100644 include/webcpp/beast/detail/backend/http/detail/basic_parser.hpp create mode 100644 include/webcpp/beast/detail/backend/http/detail/basic_parser.ipp create mode 100644 include/webcpp/beast/detail/backend/http/detail/chunk_encode.hpp create mode 100644 include/webcpp/beast/detail/backend/http/detail/rfc7230.hpp create mode 100644 include/webcpp/beast/detail/backend/http/detail/rfc7230.ipp create mode 100644 include/webcpp/beast/detail/backend/http/detail/type_traits.hpp create mode 100644 include/webcpp/beast/detail/backend/http/dynamic_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/dynamic_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/empty_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/empty_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/error.hpp create mode 100644 include/webcpp/beast/detail/backend/http/field.hpp create mode 100644 include/webcpp/beast/detail/backend/http/fields.hpp create mode 100644 include/webcpp/beast/detail/backend/http/fields_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/file_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/file_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/basic_parser.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/basic_parser.ipp create mode 100644 include/webcpp/beast/detail/backend/http/impl/chunk_encode.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/error.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/error.ipp create mode 100644 include/webcpp/beast/detail/backend/http/impl/field.ipp create mode 100644 include/webcpp/beast/detail/backend/http/impl/fields.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/fields.ipp create mode 100644 include/webcpp/beast/detail/backend/http/impl/file_body_win32.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/message.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/message_generator.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/parser.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/read.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/rfc7230.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/rfc7230.ipp create mode 100644 include/webcpp/beast/detail/backend/http/impl/serializer.hpp create mode 100644 include/webcpp/beast/detail/backend/http/impl/status.ipp create mode 100644 include/webcpp/beast/detail/backend/http/impl/verb.ipp create mode 100644 include/webcpp/beast/detail/backend/http/impl/write.hpp create mode 100644 include/webcpp/beast/detail/backend/http/message.hpp create mode 100644 include/webcpp/beast/detail/backend/http/message_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/message_generator.hpp create mode 100644 include/webcpp/beast/detail/backend/http/message_generator_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/parser.hpp create mode 100644 include/webcpp/beast/detail/backend/http/parser_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/read.hpp create mode 100644 include/webcpp/beast/detail/backend/http/rfc7230.hpp create mode 100644 include/webcpp/beast/detail/backend/http/serializer.hpp create mode 100644 include/webcpp/beast/detail/backend/http/serializer_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/span_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/span_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/status.hpp create mode 100644 include/webcpp/beast/detail/backend/http/string_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/string_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/type_traits.hpp create mode 100644 include/webcpp/beast/detail/backend/http/vector_body.hpp create mode 100644 include/webcpp/beast/detail/backend/http/vector_body_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/http/verb.hpp create mode 100644 include/webcpp/beast/detail/backend/http/write.hpp create mode 100644 include/webcpp/beast/detail/backend/src.hpp create mode 100644 include/webcpp/beast/detail/backend/ssl.hpp create mode 100644 include/webcpp/beast/detail/backend/ssl/ssl_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/version.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/decorator.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/frame.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/hybi13.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/hybi13.ipp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/impl_base.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/mask.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/mask.ipp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/pmd_extension.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/pmd_extension.ipp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/prng.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/prng.ipp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/service.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/service.ipp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/soft_mutex.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/type_traits.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/utf8_checker.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/detail/utf8_checker.ipp create mode 100644 include/webcpp/beast/detail/backend/websocket/error.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/accept.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/close.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/error.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/error.ipp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/handshake.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/ping.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/read.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/rfc6455.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/ssl.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/stream.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/stream_impl.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/teardown.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/impl/write.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/option.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/rfc6455.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/ssl.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/stream.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/stream_base.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/stream_fwd.hpp create mode 100644 include/webcpp/beast/detail/backend/websocket/teardown.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/deflate_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/detail/bitstream.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/detail/deflate_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/detail/deflate_stream.ipp create mode 100644 include/webcpp/beast/detail/backend/zlib/detail/inflate_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/detail/inflate_stream.ipp create mode 100644 include/webcpp/beast/detail/backend/zlib/detail/ranges.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/detail/window.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/error.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/impl/error.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/impl/error.ipp create mode 100644 include/webcpp/beast/detail/backend/zlib/inflate_stream.hpp create mode 100644 include/webcpp/beast/detail/backend/zlib/zlib.hpp create mode 100644 include/webcpp/beast/detail/backend_select.hpp create mode 100644 include/webcpp/beast/http/basic_dynamic_body.hpp create mode 100644 include/webcpp/beast/http/basic_dynamic_body_fwd.hpp create mode 100644 include/webcpp/beast/http/basic_file_body.hpp create mode 100644 include/webcpp/beast/http/basic_file_body_fwd.hpp create mode 100644 include/webcpp/beast/http/basic_parser.hpp create mode 100644 include/webcpp/beast/http/buffer_body.hpp create mode 100644 include/webcpp/beast/http/buffer_body_fwd.hpp create mode 100644 include/webcpp/beast/http/chunk_encode.hpp create mode 100644 include/webcpp/beast/http/dynamic_body.hpp create mode 100644 include/webcpp/beast/http/dynamic_body_fwd.hpp create mode 100644 include/webcpp/beast/http/empty_body.hpp create mode 100644 include/webcpp/beast/http/empty_body_fwd.hpp create mode 100644 include/webcpp/beast/http/error.hpp create mode 100644 include/webcpp/beast/http/field.hpp create mode 100644 include/webcpp/beast/http/fields.hpp create mode 100644 include/webcpp/beast/http/fields_fwd.hpp create mode 100644 include/webcpp/beast/http/file_body.hpp create mode 100644 include/webcpp/beast/http/file_body_fwd.hpp create mode 100644 include/webcpp/beast/http/message.hpp create mode 100644 include/webcpp/beast/http/message_fwd.hpp create mode 100644 include/webcpp/beast/http/message_generator.hpp create mode 100644 include/webcpp/beast/http/message_generator_fwd.hpp create mode 100644 include/webcpp/beast/http/parser.hpp create mode 100644 include/webcpp/beast/http/parser_fwd.hpp create mode 100644 include/webcpp/beast/http/rfc7230.hpp create mode 100644 include/webcpp/beast/http/serializer.hpp create mode 100644 include/webcpp/beast/http/serializer_fwd.hpp create mode 100644 include/webcpp/beast/http/span_body.hpp create mode 100644 include/webcpp/beast/http/span_body_fwd.hpp create mode 100644 include/webcpp/beast/http/status.hpp create mode 100644 include/webcpp/beast/http/string_body.hpp create mode 100644 include/webcpp/beast/http/string_body_fwd.hpp create mode 100644 include/webcpp/beast/http/type_traits.hpp create mode 100644 include/webcpp/beast/http/vector_body.hpp create mode 100644 include/webcpp/beast/http/vector_body_fwd.hpp create mode 100644 include/webcpp/beast/http/verb.hpp create mode 100644 include/webcpp/beast/src.hpp create mode 100644 include/webcpp/beast/ssl/ssl_stream.hpp create mode 100644 include/webcpp/beast/version.hpp create mode 100644 include/webcpp/beast/websocket/error.hpp create mode 100644 include/webcpp/beast/websocket/option.hpp create mode 100644 include/webcpp/beast/websocket/rfc6455.hpp create mode 100644 include/webcpp/beast/websocket/ssl.hpp create mode 100644 include/webcpp/beast/websocket/stream.hpp create mode 100644 include/webcpp/beast/websocket/stream_base.hpp create mode 100644 include/webcpp/beast/websocket/stream_fwd.hpp create mode 100644 include/webcpp/beast/websocket/teardown.hpp create mode 100644 include/webcpp/beast/zlib.hpp create mode 100644 include/webcpp/beast/zlib/deflate_stream.hpp create mode 100644 include/webcpp/beast/zlib/error.hpp create mode 100644 include/webcpp/beast/zlib/inflate_stream.hpp create mode 100644 include/webcpp/beast/zlib/zlib.hpp create mode 100644 test/applications/browser/network-worker.mjs create mode 100644 test/browser/chunk_allocation_test.cpp create mode 100644 test/tls/public_headers.cpp create mode 100644 upstream/README.md create mode 100644 upstream/generated.json create mode 100644 upstream/pin.json create mode 100644 upstream/sync.py diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..0dd06e0 --- /dev/null +++ b/.clang-format @@ -0,0 +1,5 @@ +BasedOnStyle: InheritParentConfig +# These arguments are header-name tokens, not arithmetic expressions. +WhitespaceSensitiveMacros: + - WEBCPP_ASIO_BACKEND_HEADER + - WEBCPP_BEAST_BACKEND_HEADER diff --git a/.gitattributes b/.gitattributes index efdba87..6f89b5a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,8 @@ * text=auto *.sh text eol=lf + +# Unified patches must retain the prefix on empty context lines. +*.patch whitespace=-blank-at-eol,-blank-at-eof + +# Preserve the pinned, mechanically generated implementation's whitespace. +include/webcpp/beast/detail/backend/** -whitespace diff --git a/AGENTS.md b/AGENTS.md index 31da392..aab0ec3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,9 +10,9 @@ Read the superproject's [AGENTS.md](../../AGENTS.md) and byte-stream operations and browser message overloads. WASI host APIs live in `wasi/http.hpp` and depend on independent host bindings. - `/webcpp/beast//beast` supplies portable headers. `//sockets` selects native or - WASIp3 guest transport; `//tls` selects source-built OpenSSL explicitly. - Asio P2 core is now available, but the Beast guest-socket application corpus - remains a separate integration task; do not mark it passed from Asio tests. + WASIp2/P3 guest transport; `//tls` selects source-built OpenSSL explicitly. + P2 guest socket and TLS protocol tests pass; the full migrated application corpus + remains a separate validation gate. Do not infer corpus parity from core tests. - `/webcpp/beast//browser`, `//wasi-http` and `//wasi-streams` select independent environment adapters. Their runtime tests are separate from the socket tests. Keep source compatibility, application counterparts and unavailable facilities diff --git a/build.jam b/build.jam index 50bc063..8bbe57a 100644 --- a/build.jam +++ b/build.jam @@ -8,7 +8,6 @@ project /webcpp/beast ; import feature ; import webcpp ; -use-project /webcpp/asio-wasip3 : ../../tools/boost/asio-wasip3 ; # The hash-verified upstream Jamfiles belong to the reference corpus only. webcpp.source-only example/upstream ; @@ -17,6 +16,7 @@ feature.feature webcpp-beast-unsupported : error ignore : propagated ; # Data interfaces do not require a socket reactor or guest TLS library. alias beast : : : : include /webcpp/config//config + /webcpp/asio//headers error:WEBCPP_BEAST_UNSUPPORTED_ERROR ignore:WEBCPP_BEAST_UNSUPPORTED_IGNORE ; @@ -30,9 +30,7 @@ alias tls : : : : sockets /webcpp/asio//openssl ; alias browser : : : : beast /webcpp/asio//asio ; # Host HTTP bindings are independent of guest sockets and guest TLS. -alias wasi-http : : : : beast /webcpp/wasi//host-http - clang-wasip2:/webcpp/asio-wasip3//host-headers - clang-wasip3:/webcpp/asio-wasip3//headers ; +alias wasi-http : : : : beast /webcpp/wasi//host-http ; # Supplied CLI streams use the portable WASI resource layer, not guest sockets. alias wasi-streams : : : : beast /webcpp/wasi//wasi ; diff --git a/doc/application-matrix.adoc b/doc/application-matrix.adoc index 722b68f..e4daa92 100644 --- a/doc/application-matrix.adoc +++ b/doc/application-matrix.adoc @@ -35,126 +35,138 @@ A passing counterpart preserves the measured application operations. It does not |P17 |`wasip2-supplied-stream-eh-off` |P18 |`wasip3-supplied-stream-eh-on` |P19 |`wasip3-supplied-stream-eh-off` -|P20 |`browser-jspi-eh-on` -|P21 |`browser-jspi-eh-off` -|P22 |`browser-asyncify-eh-on` -|P23 |`browser-asyncify-eh-off` +|P20 |`browser-jspi-single-eh-on-page` +|P21 |`browser-jspi-single-eh-on-worker` +|P22 |`browser-jspi-single-eh-off-page` +|P23 |`browser-jspi-single-eh-off-worker` +|P24 |`browser-jspi-multi-eh-on-page` +|P25 |`browser-jspi-multi-eh-on-worker` +|P26 |`browser-jspi-multi-eh-off-page` +|P27 |`browser-jspi-multi-eh-off-worker` +|P28 |`browser-asyncify-single-eh-on-page` +|P29 |`browser-asyncify-single-eh-on-worker` +|P30 |`browser-asyncify-single-eh-off-page` +|P31 |`browser-asyncify-single-eh-off-worker` +|P32 |`browser-asyncify-multi-eh-on-page` +|P33 |`browser-asyncify-multi-eh-on-worker` +|P34 |`browser-asyncify-multi-eh-off-page` +|P35 |`browser-asyncify-multi-eh-off-worker` |=== [cols="4,1,1,1,1,1,1",options="header"] |=== |Application |P01 C/R |P02 C/R |P03 C/R |P04 C/R |P05 C/R |P06 C/R -|`advanced-server` |P/P |P/P |P/P |P/P |P/P |B/B -|`advanced-server-flex` |P/P |P/P |P/P |P/P |P/P |B/B -|`advanced-server-flex-awaitable` |P/P |P/P |P/P |P/P |P/P |B/B -|`doc-ssl-client` |P/P |P/P |P/P |P/P |P/P |B/B -|`doc-ssl-server` |P/P |P/P |P/P |P/P |P/P |B/B -|`echo-op` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-client-async` |P/P |P/P |P/P |P/P |P/P |B/B +|`advanced-server` |P/P |P/P |P/P |P/P |P/P |P/P +|`advanced-server-flex` |P/P |P/P |P/P |P/P |P/P |P/P +|`advanced-server-flex-awaitable` |P/P |P/P |P/P |P/P |P/P |P/P +|`doc-ssl-client` |P/P |P/P |P/P |P/P |P/P |P/P +|`doc-ssl-server` |P/P |P/P |P/P |P/P |P/P |P/P +|`echo-op` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-async` |P/P |P/P |P/P |P/P |P/P |P/P |`http-client-async-local` |P/P |P/P |P/P |P/P |P/P |U/U -|`http-client-async-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-client-async-ssl-system-executor` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-client-awaitable` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-client-awaitable-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`json_client` |P/P |P/P |P/P |P/P |P/P |B/B +|`http-client-async-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-async-ssl-system-executor` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-awaitable` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-awaitable-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`json_client` |P/P |P/P |P/P |P/P |P/P |P/P |`http-client-coro` |P/P |P/P |P/P |B/B |B/B |B/B |`http-client-coro-ssl` |P/P |P/P |P/P |B/B |B/B |B/B -|`http-crawl` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-client-methods` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-client-sync` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-client-sync-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-server-async` |P/P |P/P |P/P |P/P |P/P |B/B +|`http-crawl` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-methods` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-sync` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-sync-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-async` |P/P |P/P |P/P |P/P |P/P |P/P |`http-server-async-local` |P/P |P/P |P/P |P/P |P/P |U/U -|`http-server-async-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-server-awaitable` |P/P |P/P |P/P |P/P |P/P |B/B +|`http-server-async-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-awaitable` |P/P |P/P |P/P |P/P |P/P |P/P |`http-server-coro` |P/P |P/P |P/P |B/B |B/B |B/B |`http-server-coro-ssl` |P/P |P/P |P/P |B/B |B/B |B/B -|`http-server-fast` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-server-flex` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-server-small` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-server-stackless` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-server-stackless-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-server-sync` |P/P |P/P |P/P |P/P |P/P |B/B -|`http-server-sync-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-client-async` |P/P |P/P |P/P |P/P |P/P |B/B +|`http-server-fast` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-flex` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-small` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-stackless` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-stackless-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-sync` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-sync-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-async` |P/P |P/P |P/P |P/P |P/P |P/P |`websocket-client-async-local` |P/P |P/P |P/P |P/P |P/P |U/U -|`websocket-client-async-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-client-async-ssl-system-executor` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-client-awaitable` |P/P |P/P |P/P |P/P |P/P |B/B +|`websocket-client-async-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-async-ssl-system-executor` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-awaitable` |P/P |P/P |P/P |P/P |P/P |P/P |`websocket-client-coro` |P/P |P/P |P/P |B/B |B/B |B/B |`websocket-client-coro-ssl` |P/P |P/P |P/P |B/B |B/B |B/B -|`websocket-client-sync` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-client-sync-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-server-async` |P/P |P/P |P/P |P/P |P/P |B/B +|`websocket-client-sync` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-sync-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-server-async` |P/P |P/P |P/P |P/P |P/P |P/P |`websocket-server-async-local` |P/P |P/P |P/P |P/P |P/P |U/U -|`websocket-server-async-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-server-awaitable` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-chat-multi` |P/P |P/P |P/P |P/P |P/P |B/B +|`websocket-server-async-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-server-awaitable` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-chat-multi` |P/P |P/P |P/P |P/P |P/P |P/P |`websocket-server-coro` |P/P |P/P |P/P |B/B |B/B |B/B |`websocket-server-coro-ssl` |P/P |P/P |P/P |B/B |B/B |B/B |`websocket-server-fast` |P/P |P/P |P/P |B/B |B/B |B/B -|`websocket-server-stackless` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-server-stackless-ssl` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-server-sync` |P/P |P/P |P/P |P/P |P/P |B/B -|`websocket-server-sync-ssl` |P/P |P/P |P/P |P/P |P/P |B/B +|`websocket-server-stackless` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-server-stackless-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-server-sync` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-server-sync-ssl` |P/P |P/P |P/P |P/P |P/P |P/P |=== [cols="4,1,1,1,1,1,1",options="header"] |=== |Application |P07 C/R |P08 C/R |P09 C/R |P10 C/R |P11 C/R |P12 C/R -|`advanced-server` |B/B |P/P |P/P |B/B |P/P |P/P -|`advanced-server-flex` |B/B |P/P |P/P |B/B |P/P |P/P -|`advanced-server-flex-awaitable` |B/B |P/P |P/P |B/B |P/P |P/P -|`doc-ssl-client` |B/B |P/P |P/P |B/B |P/P |P/P -|`doc-ssl-server` |B/B |P/P |P/P |B/B |P/P |P/P -|`echo-op` |B/B |P/P |P/P |B/B |P/P |U/U -|`http-client-async` |B/B |P/P |P/P |B/B |P/P |P/P +|`advanced-server` |P/P |P/P |P/P |B/B |P/P |P/P +|`advanced-server-flex` |P/P |P/P |P/P |B/B |P/P |P/P +|`advanced-server-flex-awaitable` |P/P |P/P |P/P |B/B |P/P |P/P +|`doc-ssl-client` |P/P |P/P |P/P |B/B |P/P |P/P +|`doc-ssl-server` |P/P |P/P |P/P |B/B |P/P |P/P +|`echo-op` |P/P |P/P |P/P |B/B |P/P |U/U +|`http-client-async` |P/P |P/P |P/P |B/B |P/P |P/P |`http-client-async-local` |U/U |U/U |U/U |B/B |U/U |P/P -|`http-client-async-ssl` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-client-async-ssl-system-executor` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-client-awaitable` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-client-awaitable-ssl` |B/B |P/P |P/P |B/B |P/P |P/P -|`json_client` |B/B |P/P |P/P |B/B |P/P |P/P +|`http-client-async-ssl` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-client-async-ssl-system-executor` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-client-awaitable` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-client-awaitable-ssl` |P/P |P/P |P/P |B/B |P/P |P/P +|`json_client` |P/P |P/P |P/P |B/B |P/P |P/P |`http-client-coro` |B/B |B/B |B/B |B/B |B/B |P/P |`http-client-coro-ssl` |B/B |B/B |B/B |B/B |B/B |P/P -|`http-crawl` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-client-methods` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-client-sync` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-client-sync-ssl` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-server-async` |B/B |P/P |P/P |B/B |P/P |P/P +|`http-crawl` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-client-methods` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-client-sync` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-client-sync-ssl` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-server-async` |P/P |P/P |P/P |B/B |P/P |P/P |`http-server-async-local` |U/U |U/U |U/U |B/B |U/U |P/P -|`http-server-async-ssl` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-server-awaitable` |B/B |P/P |P/P |B/B |P/P |P/P +|`http-server-async-ssl` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-server-awaitable` |P/P |P/P |P/P |B/B |P/P |P/P |`http-server-coro` |B/B |B/B |B/B |B/B |B/B |P/P |`http-server-coro-ssl` |B/B |B/B |B/B |B/B |B/B |P/P -|`http-server-fast` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-server-flex` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-server-small` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-server-stackless` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-server-stackless-ssl` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-server-sync` |B/B |P/P |P/P |B/B |P/P |P/P -|`http-server-sync-ssl` |B/B |P/P |P/P |B/B |P/P |P/P -|`websocket-client-async` |B/B |P/P |P/P |B/B |P/P |U/U +|`http-server-fast` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-server-flex` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-server-small` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-server-stackless` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-server-stackless-ssl` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-server-sync` |P/P |P/P |P/P |B/B |P/P |P/P +|`http-server-sync-ssl` |P/P |P/P |P/P |B/B |P/P |P/P +|`websocket-client-async` |P/P |P/P |P/P |B/B |P/P |U/U |`websocket-client-async-local` |U/U |U/U |U/U |B/B |U/U |U/U -|`websocket-client-async-ssl` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-client-async-ssl-system-executor` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-client-awaitable` |B/B |P/P |P/P |B/B |P/P |U/U +|`websocket-client-async-ssl` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-client-async-ssl-system-executor` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-client-awaitable` |P/P |P/P |P/P |B/B |P/P |U/U |`websocket-client-coro` |B/B |B/B |B/B |B/B |B/B |U/U |`websocket-client-coro-ssl` |B/B |B/B |B/B |B/B |B/B |U/U -|`websocket-client-sync` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-client-sync-ssl` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-server-async` |B/B |P/P |P/P |B/B |P/P |U/U +|`websocket-client-sync` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-client-sync-ssl` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-server-async` |P/P |P/P |P/P |B/B |P/P |U/U |`websocket-server-async-local` |U/U |U/U |U/U |B/B |U/U |U/U -|`websocket-server-async-ssl` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-server-awaitable` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-chat-multi` |B/B |P/P |P/P |B/B |P/P |U/U +|`websocket-server-async-ssl` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-server-awaitable` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-chat-multi` |P/P |P/P |P/P |B/B |P/P |U/U |`websocket-server-coro` |B/B |B/B |B/B |B/B |B/B |U/U |`websocket-server-coro-ssl` |B/B |B/B |B/B |B/B |B/B |U/U |`websocket-server-fast` |B/B |B/B |B/B |B/B |B/B |U/U -|`websocket-server-stackless` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-server-stackless-ssl` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-server-sync` |B/B |P/P |P/P |B/B |P/P |U/U -|`websocket-server-sync-ssl` |B/B |P/P |P/P |B/B |P/P |U/U +|`websocket-server-stackless` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-server-stackless-ssl` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-server-sync` |P/P |P/P |P/P |B/B |P/P |U/U +|`websocket-server-sync-ssl` |P/P |P/P |P/P |B/B |P/P |U/U |=== [cols="4,1,1,1,1,1,1",options="header"] @@ -215,30 +227,146 @@ A passing counterpart preserves the measured application operations. It does not |`websocket-server-sync-ssl` |U/U |U/U |U/U |U/U |U/U |U/U |=== +[cols="4,1,1,1,1,1,1",options="header"] +|=== +|Application |P19 C/R |P20 C/R |P21 C/R |P22 C/R |P23 C/R |P24 C/R +|`advanced-server` |U/U |U/U |U/U |U/U |U/U |U/U +|`advanced-server-flex` |U/U |U/U |U/U |U/U |U/U |U/U +|`advanced-server-flex-awaitable` |U/U |U/U |U/U |U/U |U/U |U/U +|`doc-ssl-client` |U/U |B/B |B/B |B/B |B/B |B/B +|`doc-ssl-server` |U/U |U/U |U/U |U/U |U/U |U/U +|`echo-op` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-client-async` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-client-async-local` |P/P |U/U |U/U |U/U |U/U |U/U +|`http-client-async-ssl` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-client-async-ssl-system-executor` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-client-awaitable` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-client-awaitable-ssl` |U/U |P/P |P/P |P/P |P/P |P/P +|`json_client` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-client-coro` |U/U |B/B |B/B |B/B |B/B |B/B +|`http-client-coro-ssl` |U/U |B/B |B/B |B/B |B/B |B/B +|`http-crawl` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-client-methods` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-client-sync` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-client-sync-ssl` |U/U |P/P |P/P |P/P |P/P |P/P +|`http-server-async` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-async-local` |P/P |U/U |U/U |U/U |U/U |U/U +|`http-server-async-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-awaitable` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-coro` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-coro-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-fast` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-flex` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-small` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-stackless` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-stackless-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-sync` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-sync-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-client-async` |U/U |P/P |P/P |P/P |P/P |P/P +|`websocket-client-async-local` |P/P |U/U |U/U |U/U |U/U |U/U +|`websocket-client-async-ssl` |U/U |P/P |P/P |P/P |P/P |P/P +|`websocket-client-async-ssl-system-executor` |U/U |P/P |P/P |P/P |P/P |P/P +|`websocket-client-awaitable` |U/U |P/P |P/P |P/P |P/P |P/P +|`websocket-client-coro` |U/U |B/B |B/B |B/B |B/B |B/B +|`websocket-client-coro-ssl` |U/U |B/B |B/B |B/B |B/B |B/B +|`websocket-client-sync` |U/U |P/P |P/P |P/P |P/P |P/P +|`websocket-client-sync-ssl` |U/U |P/P |P/P |P/P |P/P |P/P +|`websocket-server-async` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-async-local` |P/P |U/U |U/U |U/U |U/U |U/U +|`websocket-server-async-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-awaitable` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-chat-multi` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-coro` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-coro-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-fast` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-stackless` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-stackless-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-sync` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-sync-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|=== + +[cols="4,1,1,1,1,1,1",options="header"] +|=== +|Application |P25 C/R |P26 C/R |P27 C/R |P28 C/R |P29 C/R |P30 C/R +|`advanced-server` |U/U |U/U |U/U |U/U |U/U |U/U +|`advanced-server-flex` |U/U |U/U |U/U |U/U |U/U |U/U +|`advanced-server-flex-awaitable` |U/U |U/U |U/U |U/U |U/U |U/U +|`doc-ssl-client` |B/B |B/B |B/B |B/B |B/B |B/B +|`doc-ssl-server` |U/U |U/U |U/U |U/U |U/U |U/U +|`echo-op` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-client-async` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-async-local` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-client-async-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-async-ssl-system-executor` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-awaitable` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-awaitable-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`json_client` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-coro` |B/B |B/B |B/B |B/B |B/B |B/B +|`http-client-coro-ssl` |B/B |B/B |B/B |B/B |B/B |B/B +|`http-crawl` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-methods` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-sync` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-client-sync-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`http-server-async` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-async-local` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-async-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-awaitable` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-coro` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-coro-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-fast` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-flex` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-small` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-stackless` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-stackless-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-sync` |U/U |U/U |U/U |U/U |U/U |U/U +|`http-server-sync-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-client-async` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-async-local` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-client-async-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-async-ssl-system-executor` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-awaitable` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-coro` |B/B |B/B |B/B |B/B |B/B |B/B +|`websocket-client-coro-ssl` |B/B |B/B |B/B |B/B |B/B |B/B +|`websocket-client-sync` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-client-sync-ssl` |P/P |P/P |P/P |P/P |P/P |P/P +|`websocket-server-async` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-async-local` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-async-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-awaitable` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-chat-multi` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-coro` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-coro-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-fast` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-stackless` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-stackless-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-sync` |U/U |U/U |U/U |U/U |U/U |U/U +|`websocket-server-sync-ssl` |U/U |U/U |U/U |U/U |U/U |U/U +|=== + [cols="4,1,1,1,1,1",options="header"] |=== -|Application |P19 C/R |P20 C/R |P21 C/R |P22 C/R |P23 C/R +|Application |P31 C/R |P32 C/R |P33 C/R |P34 C/R |P35 C/R |`advanced-server` |U/U |U/U |U/U |U/U |U/U |`advanced-server-flex` |U/U |U/U |U/U |U/U |U/U |`advanced-server-flex-awaitable` |U/U |U/U |U/U |U/U |U/U -|`doc-ssl-client` |U/U |B/B |B/B |B/B |B/B +|`doc-ssl-client` |B/B |B/B |B/B |B/B |B/B |`doc-ssl-server` |U/U |U/U |U/U |U/U |U/U |`echo-op` |U/U |U/U |U/U |U/U |U/U -|`http-client-async` |U/U |P/P |P/P |P/P |P/P -|`http-client-async-local` |P/P |U/U |U/U |U/U |U/U -|`http-client-async-ssl` |U/U |P/P |P/P |P/P |P/P -|`http-client-async-ssl-system-executor` |U/U |P/P |P/P |P/P |P/P -|`http-client-awaitable` |U/U |P/P |P/P |P/P |P/P -|`http-client-awaitable-ssl` |U/U |P/P |P/P |P/P |P/P -|`json_client` |U/U |P/P |P/P |P/P |P/P -|`http-client-coro` |U/U |B/B |B/B |B/B |B/B -|`http-client-coro-ssl` |U/U |B/B |B/B |B/B |B/B -|`http-crawl` |U/U |P/P |P/P |P/P |P/P -|`http-client-methods` |U/U |P/P |P/P |P/P |P/P -|`http-client-sync` |U/U |P/P |P/P |P/P |P/P -|`http-client-sync-ssl` |U/U |P/P |P/P |P/P |P/P +|`http-client-async` |P/P |P/P |P/P |P/P |P/P +|`http-client-async-local` |U/U |U/U |U/U |U/U |U/U +|`http-client-async-ssl` |P/P |P/P |P/P |P/P |P/P +|`http-client-async-ssl-system-executor` |P/P |P/P |P/P |P/P |P/P +|`http-client-awaitable` |P/P |P/P |P/P |P/P |P/P +|`http-client-awaitable-ssl` |P/P |P/P |P/P |P/P |P/P +|`json_client` |P/P |P/P |P/P |P/P |P/P +|`http-client-coro` |B/B |B/B |B/B |B/B |B/B +|`http-client-coro-ssl` |B/B |B/B |B/B |B/B |B/B +|`http-crawl` |P/P |P/P |P/P |P/P |P/P +|`http-client-methods` |P/P |P/P |P/P |P/P |P/P +|`http-client-sync` |P/P |P/P |P/P |P/P |P/P +|`http-client-sync-ssl` |P/P |P/P |P/P |P/P |P/P |`http-server-async` |U/U |U/U |U/U |U/U |U/U -|`http-server-async-local` |P/P |U/U |U/U |U/U |U/U +|`http-server-async-local` |U/U |U/U |U/U |U/U |U/U |`http-server-async-ssl` |U/U |U/U |U/U |U/U |U/U |`http-server-awaitable` |U/U |U/U |U/U |U/U |U/U |`http-server-coro` |U/U |U/U |U/U |U/U |U/U @@ -250,17 +378,17 @@ A passing counterpart preserves the measured application operations. It does not |`http-server-stackless-ssl` |U/U |U/U |U/U |U/U |U/U |`http-server-sync` |U/U |U/U |U/U |U/U |U/U |`http-server-sync-ssl` |U/U |U/U |U/U |U/U |U/U -|`websocket-client-async` |U/U |P/P |P/P |P/P |P/P -|`websocket-client-async-local` |P/P |U/U |U/U |U/U |U/U -|`websocket-client-async-ssl` |U/U |P/P |P/P |P/P |P/P -|`websocket-client-async-ssl-system-executor` |U/U |P/P |P/P |P/P |P/P -|`websocket-client-awaitable` |U/U |P/P |P/P |P/P |P/P -|`websocket-client-coro` |U/U |B/B |B/B |B/B |B/B -|`websocket-client-coro-ssl` |U/U |B/B |B/B |B/B |B/B -|`websocket-client-sync` |U/U |P/P |P/P |P/P |P/P -|`websocket-client-sync-ssl` |U/U |P/P |P/P |P/P |P/P +|`websocket-client-async` |P/P |P/P |P/P |P/P |P/P +|`websocket-client-async-local` |U/U |U/U |U/U |U/U |U/U +|`websocket-client-async-ssl` |P/P |P/P |P/P |P/P |P/P +|`websocket-client-async-ssl-system-executor` |P/P |P/P |P/P |P/P |P/P +|`websocket-client-awaitable` |P/P |P/P |P/P |P/P |P/P +|`websocket-client-coro` |B/B |B/B |B/B |B/B |B/B +|`websocket-client-coro-ssl` |B/B |B/B |B/B |B/B |B/B +|`websocket-client-sync` |P/P |P/P |P/P |P/P |P/P +|`websocket-client-sync-ssl` |P/P |P/P |P/P |P/P |P/P |`websocket-server-async` |U/U |U/U |U/U |U/U |U/U -|`websocket-server-async-local` |P/P |U/U |U/U |U/U |U/U +|`websocket-server-async-local` |U/U |U/U |U/U |U/U |U/U |`websocket-server-async-ssl` |U/U |U/U |U/U |U/U |U/U |`websocket-server-awaitable` |U/U |U/U |U/U |U/U |U/U |`websocket-chat-multi` |U/U |U/U |U/U |U/U |U/U @@ -275,13 +403,13 @@ A passing counterpart preserves the measured application operations. It does not ==== Adaptations and limits -* WASIp3 uses a fixture resolver posting the known local endpoint. DNS worker threads remain unverified. Worker/system executors use an explicit event loop. +* WASIp2/P3 socket counterparts use a fixture resolver posting the known local endpoint. DNS worker threads remain unverified. Worker/system executors use an explicit event loop. * Host HTTP preserves file handlers or request/body operations. Host listeners, framing and TLS are distinct from guest sockets. Six HTTPS client counterparts run through a configured Wasmtime host with an isolated CA, rejecting unknown issuers and trusted certificates for the wrong hostname. The documentation client additionally measures host-owned mutual TLS and missing-identity rejection. The documentation server measures a host mutual-TLS frontend. * The host crawler retains upstream report aggregation and two asynchronous workers over bounded authority/path inputs. Its fixture uses two peers, six paths, four response statuses, and a truncated-response failure followed by continued work. Host HTTP combines transport phases: failures count as Read; separate DNS/connect/write/timer phase counts are unmeasured. * Supplied streams replace Unix-domain addressing with caller-provided stdio. P2 WebSocket counterparts retain asynchronous partial operations through Asio pollables; the other supplied counterparts use synchronous partial operations. * Browser fetch/WebSocket own DNS, framing and TLS. Guest CA lists, protocol pinning and handshake User-Agent are removed explicitly. HTTPS fixtures install an ephemeral CA in an isolated Chrome profile. A fresh untrusted profile rejects the certificate; the trusted profile rejects its incorrect IP hostname. No certificate-error bypass or system trust-store modification is used. * Exception-off counterparts retain error-code paths and successful operations; formerly throwing paths report failure and abort. Stackful Context remains blocked. -* Asio P2 provides sockets and guest TLS, but the Beast guest-socket and guest-TLS application corpus still needs P2 integration and validation. Browser listeners and WASI Unix-domain socket addressing remain unavailable. WASIp3 cooperative EH-on lacks the toolchain exception runtime. +* P2 socket and guest-TLS cells require their own measured application results. Browser listeners and WASI Unix-domain socket addressing remain unavailable. WASIp3 cooperative EH-on lacks the toolchain exception runtime. ==== Reproduction diff --git a/doc/beast.adoc b/doc/beast.adoc index 094ab98..07b0435 100644 --- a/doc/beast.adoc +++ b/doc/beast.adoc @@ -12,8 +12,13 @@ :attribute-missing: warn `webcpp::beast` is a {cpp}20 compatibility facade for Boost.Beast applications. +Its purpose is to make those applications usable in WebAssembly through +Emscripten or WASIp2/P3, with explicit adaptations where the host has different +network facilities. JSPI and Asyncify are Emscripten suspension variants; +they are not WASI versions. Native upstream-equivalent types, including the +WebSocket stream, are aliases of the actual Boost.Beast types. It preserves Boost.Beast's messages, buffers and parsers while selecting a -transport appropriate to the program's environment. Native and WASIp3 socket +transport appropriate to the program's environment. Native and WASIp2/P3 socket programs use the guest protocol engine. Browser clients use WebSocket and fetch; WASI host HTTP programs use the host's request and response resources. The application matrix distinguishes direct source compatibility from explicit @@ -113,7 +118,7 @@ fails the test. Supplying a guest TCP acceptor is unnecessary for this backend. |=== |B2 dependency |Purpose |`/webcpp/beast//beast` |Portable buffers, HTTP messages, parsers and serializers. -|`/webcpp/beast//sockets` |Native/WASIp3 guest socket algorithms and Asio configuration. +|`/webcpp/beast//sockets` |Native/WASIp2/P3 guest socket algorithms and Asio configuration. |`/webcpp/beast//tls` |Guest-owned TLS with source-built OpenSSL. |`/webcpp/beast//browser` |Browser-owned WebSocket, fetch and TLS policy. |`/webcpp/beast//wasi-http` |WASIp2/P3 host HTTP resources, without guest sockets or OpenSSL. @@ -130,10 +135,32 @@ host HTTP handler does not need the guest socket or TLS dependency. Combining backends is explicit, for example a WASIp3 service that accepts host HTTP requests and separately contacts a TCP service. +[#beast-distribution] +=== Build without B2 + +Use `webcpp/beast/` headers and `webcpp::beast` names, together with the +corresponding `webcpp::asio` types. Native equivalents are actual Boost types. +Wasm selects the versioned protocol implementation shipped in the library; +the maintainer importer is not a consumer build step, and no replacement Boost +include tree is needed. Boost 1.92 remains an explicit dependency for other +Boost facilities used by these headers. + +Socket and browser programs compile Asio's target-specific runtime source and +use matching thread, exception and suspension settings. Guest TLS adds the +explicit OpenSSL and CA provider. Host HTTP instead needs the bindings generated +from the selected WASI world. These are different dependency contracts, not +automatic substitutions based on an HTTP URL. + +The superproject's `tools/test/fixtures/portable-network/CMakeLists.txt` builds +HTTP and WebSocket consumers from copied source distributions with explicit +toolchain and dependency inputs. It uses the same implementation as B2. +Application-matrix and measurement results identify their tested revision; +historical results do not validate this distribution migration. + [source,bash] ---- b2 -a variant=release exception-handling=on,off libs/beast/test libs/beast/example -b2 -a toolset=clang-wasip2 testing.launcher=wasmtime exception-handling=on,off libs/beast/test libs/beast/example +b2 -a toolset=clang-wasip2 testing.launcher=tools/boost/asio-wasip2/run.sh exception-handling=on,off libs/beast/test libs/beast/example b2 -a toolset=clang-wasip3 testing.launcher=tools/boost/asio-wasip3/run.sh exception-handling=on,off libs/beast/test libs/beast/example b2 -a toolset=emscripten exception-handling=on,off libs/beast/test libs/beast/example ---- @@ -179,11 +206,21 @@ implemented as arbitrary raw-socket options. Host TLS never uses guest OpenSSL settings. Prefer explicit errors to silently claiming that the host accepted an unavailable setting. -The native/WASI WebSocket allocator constructor accepts the portable constructor +The WASI WebSocket allocator constructor accepts the portable constructor syntax, but upstream Beast still controls its internal stream-state allocation. +Native uses the actual Boost stream and its original constructors. Associated completion-handler allocators retain upstream semantics. Data containers use their upstream allocator template parameters. +The shipped Wasm engine corrects an upstream `noexcept` on the internal variant +used by HTTP chunk serialization. With exceptions enabled, failure to allocate a +chunk header propagates `std::bad_alloc`; without exceptions, allocation failure +is not recoverable. Native retains the actual Boost 1.92 implementation, which +terminates on that particular allocation failure. Error-code overloads do not +turn allocation exceptions into protocol error codes. The browser regression +injects the failure through the public HTTP serializer and verifies both the +exception and the successful serialization controls. + `set_server_name` configures SNI only. It copies a non-terminated string view into a bounded buffer and rejects empty, overlong or embedded-NUL hostnames. Certificate and hostname verification remain separate TLS settings. Guest OpenSSL settings must never @@ -201,13 +238,13 @@ API or transport detail of the original program is available. |=== |Feature |Native |WASIp2 |WASIp3 |Emscripten |HTTP message/parser/serializer interfaces |Implemented |Implemented |Implemented |Implemented -|Guest HTTP/WebSocket socket engine |Asio sockets |Asio core available; guest-socket facade/application integration pending |Asio socket port |Explicit supplied byte stream only +|Guest HTTP/WebSocket socket engine |Asio sockets |Asio pollable socket backend; see the dated application matrix |Asio socket port |Explicit supplied byte stream only |Browser WebSocket and fetch |Not applicable |Not applicable |Not applicable |JSPI and Asyncify -|Guest TLS, identity verification and shutdown |Source-built OpenSSL |No guest TLS backend |Source-built OpenSSL |Browser owns TLS +|Guest TLS, identity verification and shutdown |Source-built OpenSSL |Source-built OpenSSL |Source-built OpenSSL |Browser owns TLS |Host HTTP entry/client |Not applicable |wasi:http |wasi:http |fetch client only |Unix socket namespace and peer identity |Operating-system sockets |Unavailable |Unavailable |Unavailable |Explicit supplied-stream counterpart |Borrowed descriptors |CLI input/output; asynchronous WebSocket via pollables |CLI input/output |Caller-supplied channel -|Raw TCP HTTP/WebSocket listener |Available |Use host HTTP entry |Available |Unavailable +|Raw TCP HTTP/WebSocket listener |Available |Available with network grants |Available |Unavailable |Host HTTP WebSocket upgrade |Not applicable |Not provided by host adapter |Use guest socket backend |Browser WebSocket client only |Native CPU-parallel threads |Available |Unavailable |Cooperative WASI threads only |Not implied by this backend |=== diff --git a/doc/changelog.adoc b/doc/changelog.adoc index c891622..7139b11 100644 --- a/doc/changelog.adoc +++ b/doc/changelog.adoc @@ -14,6 +14,8 @@ Changes to the unreleased Beast facade. === Unreleased // tag::unreleased[] +* Fixed browser HTTP and WebSocket transfers with shared Wasm memory. +* Added current application coverage and shared Release parser measurements. // end::unreleased[] [#beast-changelog-0-1-0] diff --git a/doc/verification.adoc b/doc/verification.adoc index 670e36d..b8deb7d 100644 --- a/doc/verification.adoc +++ b/doc/verification.adoc @@ -7,6 +7,18 @@ [#beast-verification] == Verification and reproduction +The <> contains the current application refresh for the +shipped implementation, including separate browser page/worker and single/multi +profiles. The dated contract-test record below remains historical evidence; it +must not be read as a fresh run of the unsubmitted migration or as performance +data. + +The shared +link:{webcpp-libs}/cobalt/{webcpp-page}#cobalt-release-measurements[Release comparison] +also measures Beast HTTP response parsing inside matched Asio/Cobalt workloads. +That in-memory parser workload measures neither transport latency nor TLS +throughput. It must not be presented as a network performance comparison. + The local evidence below was collected on macOS ARM64 on 2026-11-02 and 2026-11-03 with Boost 1.92, native Clang 21, wasi-sdk 34, Emscripten 6.0.11 and Wasmtime 50.0.1. Core and guest TLS runs use Release builds. Browser contract runs use Debug, @@ -75,6 +87,14 @@ link with different browser policies and a matching-policy success control. An expected compile/link failure is a passing negative test only when B2 reports `failed-as-expected` and its success control also passes. +The local closure regression on 2026-11-07 additionally exercises the public HTTP +serializer in real Chrome with JSPI and Asyncify. With exceptions enabled, a +forced chunk-header allocation failure must reach the caller as `std::bad_alloc`, +not abort. A fixed-length body and successful chunked serialization are controls. +The builds without exceptions exercise successful serialization only; they do +not claim recovery from exhausted memory. The native Boost 1.92 reproduction +retains the upstream termination behavior described in <>. + [#beast-reproduce] === Reproduce a suite diff --git a/example/applications/adaptations.patch b/example/applications/adaptations.patch index 26b308f..0f40b3c 100644 --- a/example/applications/adaptations.patch +++ b/example/applications/adaptations.patch @@ -2254,7 +2254,7 @@ - the one the child task runs on (e.g. via @c net::bind_executor). This is - because @c emit() can run on a different thread than the task, and - @c co_spawn dispatches the cancellation to the handler's associated -+ ote `completion_token` must have an associated executor that matches ++ @note `completion_token` must have an associated executor that matches + the one the child task runs on (e.g. via `net::bind_executor`). This is + because `emit`() can run on a different thread than the task, and + `co_spawn` dispatches the cancellation to the handler's associated @@ -2473,11 +2473,13 @@ auto [ec, _] = co_await ws.async_read(buffer, net::as_tuple); - if(ec == websocket::error::closed || ec == ssl::error::stream_truncated) -+ if (ec == websocket::error::closed || ec == ssl::error::stream_truncated) - co_return; - +- co_return; +- - if(ec) - throw boost::system::system_error{ ec }; ++ if (ec == websocket::error::closed || ec == ssl::error::stream_truncated) ++ co_return; ++ + if (ec) + throw boost::system::system_error{ec}; @@ -2522,13 +2524,15 @@ - co_await http::async_read(stream, buffer, parser, net::as_tuple); - - if(ec == http::error::end_of_stream) +- co_return; +- +- if(websocket::is_upgrade(parser.get())) +- { + auto [ec, _] = co_await http::async_read(stream, buffer, parser, net::as_tuple); + + if (ec == http::error::end_of_stream) - co_return; - -- if(websocket::is_upgrade(parser.get())) -- { ++ co_return; ++ + if (websocket::is_upgrade(parser.get())) { // The websocket::stream uses its own timeout settings. beast::get_lowest_layer(stream).expires_never(); @@ -2608,9 +2612,8 @@ co_await run_session(stream, buffer, doc_root); - if(!stream.socket().is_open()) -+ if (!stream.socket().is_open()) - co_return; - +- co_return; +- - stream.socket().shutdown(net::ip::tcp::socket::shutdown_send); - } -} @@ -2623,6 +2626,9 @@ - beast::string_view doc_root) -{ - auto cs = co_await net::this_coro::cancellation_state; ++ if (!stream.socket().is_open()) ++ co_return; ++ + stream.socket().shutdown(webcpp::asio::ip::tcp::socket::shutdown_send); + } +} @@ -2649,13 +2655,15 @@ - co_await acceptor.async_accept(socket_executor, net::as_tuple); - - if(ec == net::error::operation_aborted) +- co_return; +- +- if(ec) +- throw boost::system::system_error{ ec }; + auto [ec, socket] = co_await acceptor.async_accept(socket_executor, net::as_tuple); + + if (ec == net::error::operation_aborted) - co_return; - -- if(ec) -- throw boost::system::system_error{ ec }; ++ co_return; ++ + if (ec) + throw boost::system::system_error{ec}; @@ -2723,7 +2731,7 @@ { std::cout << "Sending a terminal cancellation signal...\n"; task_group.emit(net::cancellation_type::terminal); -@@ -586,80 +528,64 @@ +@@ -586,92 +528,70 @@ } std::cout << "Child tasks completed.\n"; @@ -2835,17 +2843,19 @@ t.join(); return EXIT_SUCCESS; -@@ -667,9 +593,7 @@ + } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/common/root_certificates.hpp +++ port/common/root_certificates.hpp @@ -1,3 +1,20 @@ @@ -4626,7 +4636,7 @@ // set up the peer verification mode so that the TLS/SSL handshake fails // if the certificate verification is unsuccessful -@@ -117,19 +121,15 @@ +@@ -117,21 +121,13 @@ net::co_spawn(ioc, request(ctx), print_exception); @@ -4641,14 +4651,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/doc/ssl/server.cpp +++ port/doc/ssl/server.cpp @@ -1,3 +1,20 @@ @@ -4783,7 +4795,7 @@ // The client's certificate will be verified against this // certificate authority. -@@ -113,19 +113,15 @@ +@@ -113,21 +113,13 @@ net::co_spawn(ioc, acceptor(ctx), print_exception); @@ -4798,14 +4810,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/echo-op/echo_op.cpp +++ port/echo-op/echo_op.cpp @@ -1,3 +1,19 @@ @@ -5601,7 +5615,7 @@ return EXIT_FAILURE; } auto const path = argv[1]; -@@ -162,26 +144,23 @@ +@@ -162,26 +144,19 @@ int version = argc == 6 && !std::strcmp("1.0", argv[5]) ? 10 : 11; // The io_context is required for all I/O @@ -5620,17 +5634,15 @@ } #else - +- -int -main(int, char*[]) -{ -std::cerr << - "Local sockets not available on this platform" << std::endl; -return EXIT_FAILURE; -+int main(int, char*[]) { -+ std::cerr << "Local sockets not available on this platform" << std::endl; -+ return EXIT_FAILURE; - } +-} ++#error "This application requires its declared Asio backend" #endif --- upstream/http/client/async-ssl/http_client_async_ssl.cpp @@ -6372,17 +6384,20 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -135,9 +141,7 @@ +@@ -134,12 +140,6 @@ + } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp +++ port/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp @@ -1,3 +1,20 @@ @@ -6562,17 +6577,20 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -188,9 +187,7 @@ +@@ -187,12 +186,6 @@ + } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/http/client/body/json_body.hpp +++ port/http/client/body/json_body.hpp @@ -1,3 +1,19 @@ @@ -19317,7 +19335,7 @@ return EXIT_FAILURE; } auto const path = argv[1]; -@@ -410,32 +364,25 @@ +@@ -410,45 +364,31 @@ auto const threads = std::max(1, std::atoi(argv[3])); // The io_context is required for all I/O @@ -19357,20 +19375,18 @@ std::cerr << e.what() << std::endl; return EXIT_FAILURE; } -@@ -443,12 +390,9 @@ + } #else - +- -int -main(int, char*[]) -{ -std::cerr << - "Local sockets not available on this platform" << std::endl; -return EXIT_FAILURE; -+int main(int, char*[]) { -+ std::cerr << "Local sockets not available on this platform" << std::endl; -+ return EXIT_FAILURE; - } +-} ++#error "This application requires its declared Asio backend" #endif --- upstream/http/server/async-ssl/http_server_async_ssl.cpp @@ -20326,7 +20342,7 @@ // At this point the connection is closed gracefully // we ignore the error because the client might have -@@ -247,89 +258,68 @@ +@@ -247,91 +258,66 @@ } // Accepts incoming connections and launches the sessions @@ -20447,15 +20463,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } ---- upstream/http/server/coro/http_server_coro.cpp +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif--- upstream/http/server/coro/http_server_coro.cpp +++ port/http/server/coro/http_server_coro.cpp @@ -1,3 +1,19 @@ +// Copyright (c) 2026 WebCpp.org @@ -25812,7 +25829,7 @@ return EXIT_FAILURE; } auto const path = argv[1]; -@@ -185,26 +155,23 @@ +@@ -185,26 +155,19 @@ auto const text = argv[4]; // The io_context is required for all I/O @@ -25831,17 +25848,15 @@ } #else - +- -int -main(int, char*[]) -{ -std::cerr << - "Local sockets not available on this platform" << std::endl; -return EXIT_FAILURE; -+int main(int, char*[]) { -+ std::cerr << "Local sockets not available on this platform" << std::endl; -+ return EXIT_FAILURE; - } +-} ++#error "This application requires its declared Asio backend" #endif --- upstream/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -26632,17 +26647,20 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -138,9 +137,7 @@ +@@ -137,12 +136,6 @@ + } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/websocket/client/coro/websocket_client_coro.cpp +++ port/websocket/client/coro/websocket_client_coro.cpp @@ -1,3 +1,20 @@ @@ -27975,7 +27993,7 @@ // Remove previous binding std::remove(path); -@@ -244,18 +197,14 @@ +@@ -244,31 +197,20 @@ // Run the I/O service on the requested number of threads std::vector v; v.reserve(threads - 1); @@ -27999,20 +28017,20 @@ std::cerr << e.what() << std::endl; return EXIT_FAILURE; } -@@ -263,11 +212,8 @@ + } #else - +- -int -main(int, char*[]) -{ - std::cerr << - "Local sockets not available on this platform" << std::endl; -+int main(int, char*[]) { -+ std::cerr << "Local sockets not available on this platform" << std::endl; - return EXIT_FAILURE; - } +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + #endif --- upstream/websocket/server/async-ssl/websocket_server_async_ssl.cpp +++ port/websocket/server/async-ssl/websocket_server_async_ssl.cpp @@ -1,3 +1,21 @@ @@ -28533,7 +28551,7 @@ std::cerr << "Error in session: " << e.what() << "\n"; } } -@@ -105,59 +105,47 @@ +@@ -105,61 +105,45 @@ } } @@ -28607,14 +28625,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/websocket/server/chat-multi/beast.hpp +++ port/websocket/server/chat-multi/beast.hpp @@ -1,3 +1,20 @@ diff --git a/example/applications/backend-migration.json b/example/applications/backend-migration.json new file mode 100644 index 0000000..7145efd --- /dev/null +++ b/example/applications/backend-migration.json @@ -0,0 +1,1780 @@ +{ + "description": "Explicit namespace and include migration after fixture adaptations; oracle unchanged.", + "files": [ + { + "path": "port/advanced/server/advanced_server.cpp", + "before_sha256": "c0f72f528ae5278e702d87f8a5fb24bc8f806ebf5b9f06acfa3c821da441d1ed", + "after_sha256": "21de4a5ccef3ac64832b1b3d630112a96231a04341f01e503c738b4e60229bf5" + }, + { + "path": "port/advanced/server-flex/advanced_server_flex.cpp", + "before_sha256": "173ab4822ea74217c9ef46323402819a6835aa439df387d423c7753efa4ad38e", + "after_sha256": "78727853cc65791d3eb14bfdc4474bcf0b82e048f2a536bc0b127a1391918951" + }, + { + "path": "port/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp", + "before_sha256": "ce420527bd663633d1f0ea3881dff9727127ccd44392e38a6bce1cc68a4df425", + "after_sha256": "eac88f167c8cd19f2f7f50a8d9861c4de67785be60071ac1821940ee80b65476" + }, + { + "path": "port/common/root_certificates.hpp", + "before_sha256": "8eeb7c4830c2ee7b5974b246e1fabd79d6d9bfaad776fb090b00573de98b32df", + "after_sha256": "a43372d532f886c00ac44c1cdab3282afb8c76f124d30c084a83ed389566d377" + }, + { + "path": "port/common/server_certificate.hpp", + "before_sha256": "898ad9c03548a5319d3cbae0152fc012c73fe8069cc70cf1e916647d2783944d", + "after_sha256": "2cedc06c24e19de8acc08f587e162306439e69d408676b83e7d634506a594b8b" + }, + { + "path": "port/doc/http_examples.hpp", + "before_sha256": "acc019933283a2ce553d157f75fe04e99a3b1560e554e0d577cc0735d91c4049", + "after_sha256": "4c4387e28cc9e477c8a2d313ca457ad128cb4f644ce37bd703d2ad8b42e40ce9" + }, + { + "path": "port/doc/ssl/client.cpp", + "before_sha256": "43395a122318abb58505b88945dc4a66825f50ea5ae1d224cddca2f6d77c4f49", + "after_sha256": "cc79a88e8084c64fb9a9c95d792de62a4b0300a912aee44ba76fcd86624c5909" + }, + { + "path": "port/doc/ssl/server.cpp", + "before_sha256": "76521bdb299a660d627354c66f98a1edd98293821bf362b9f0d1f328eaa3c274", + "after_sha256": "c8ef2aaf9335fe79f6de0fd1f9f16123a9feb69c33f9ddc70c48341ff289a642" + }, + { + "path": "port/echo-op/echo_op.cpp", + "before_sha256": "65211b71940509bcafffa3aab1e3ea57220f792fdc95a10943ab8da3de395cee", + "after_sha256": "340d80c147e09fe13931c724b05d5c80bdd3f4b38010920fe89ddfdc55ad1ff4" + }, + { + "path": "port/http/client/async/http_client_async.cpp", + "before_sha256": "bc71f13ab86a7c637f3e89c083e4bba604a9ac35c67bd62986f997459cca30a6", + "after_sha256": "a9f9a4d82c6df851382df313bbaf187afacd7724f511fc2395f7b671fcdc336c" + }, + { + "path": "port/http/client/async-local/http_client_async_local.cpp", + "before_sha256": "1e1ff94dc00f3e2c62731cb784aa78637aed4927ef77ce6154e6b9e8e51242ef", + "after_sha256": "9bb231856e0078b1679a743326a1096d732c5e089108db0f41ea30ab093565d3" + }, + { + "path": "port/http/client/async-ssl/http_client_async_ssl.cpp", + "before_sha256": "d16a40dd8cf84100a14d30a51a43228a69496659eeb504694feae5452de8e817", + "after_sha256": "ec3b3e2c4d24c16df939011afe916523b3431134ee88405cc2de42ca3cb9652c" + }, + { + "path": "port/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp", + "before_sha256": "9bb64a1a643bab4ac2d50eb7dbf8edb00f03fc0f3d4c95a186b2cf0ec77dd0cf", + "after_sha256": "b829629f752e30f2227233e518d496b9cb84978bfe050a34fa9567fb56298c89" + }, + { + "path": "port/http/client/awaitable/http_client_awaitable.cpp", + "before_sha256": "1f2e6e2578940b1f55c849ea400544304eb1bf2ee5e7448d32337dd2404cde8c", + "after_sha256": "4fa24ae172941b2da3acd08c16ad766e0572d3633a5170d885173f5729d4ef4b" + }, + { + "path": "port/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp", + "before_sha256": "b4d00b47c926d5cbad7cb27fdc0ef6873f84f80c124c07ce6c0095cd6ce52d8e", + "after_sha256": "8bbf544406caccb16ac395f07e4ab800ee204959c7646abfbbf417a81c5fdb41" + }, + { + "path": "port/http/client/body/json_body.hpp", + "before_sha256": "90946c070ce4474ecece30c0849d5ffe9e671c5b0bbae2fdf2d12db6e57171bd", + "after_sha256": "196a455fffb074c56ebc1ad2599df94349d294bda8809d2b46401f8f2926befa" + }, + { + "path": "port/http/client/body/json_client.cpp", + "before_sha256": "8c92075b4b60d493deb263953321c301bdf8388909da0370b43cfa6a2a92f3e5", + "after_sha256": "94d4575950c9717142a26c76944e14ec4fbfead1276ae02709cfe89156c2143f" + }, + { + "path": "port/http/client/coro/http_client_coro.cpp", + "before_sha256": "7c3282e4b8e474dbb599e27bf2f4d3bda252982a61f8d81dc827f408b16c78a0", + "after_sha256": "7006e699c7b1df777ccf5fddf194d905fd8a78d620df0698bb95e15af6b6cfb6" + }, + { + "path": "port/http/client/coro-ssl/http_client_coro_ssl.cpp", + "before_sha256": "e8c886d3e1d223b05e2ae28d7da1eda829b3bb56f2cbf31b6d13fc73c75aae3f", + "after_sha256": "441947ca4682e3dca67e41c4b29713dcfa3b80539b48c993d3a10e405610bd60" + }, + { + "path": "port/http/client/crawl/http_crawl.cpp", + "before_sha256": "41f55a16e23c80e9cef07403bfb54481bd717a08509e25244021b89ba667bc40", + "after_sha256": "e0ded5bde134ebe22209a1dc0d269994acb9f5cc47789640350d2bb3e737a01b" + }, + { + "path": "port/http/client/crawl/urls_large_data.cpp", + "before_sha256": "39a8537d56c07c936f6ed719568e9188da09e6af50a6e39959db85bcd3135a5c", + "after_sha256": "39a8537d56c07c936f6ed719568e9188da09e6af50a6e39959db85bcd3135a5c" + }, + { + "path": "port/http/client/crawl/urls_large_data.hpp", + "before_sha256": "3e6f0561a847599131e70dfba9a4807843c7f5a67d35c6c3e4390280001f76d2", + "after_sha256": "3e6f0561a847599131e70dfba9a4807843c7f5a67d35c6c3e4390280001f76d2" + }, + { + "path": "port/http/client/methods/http_client_methods.cpp", + "before_sha256": "4b02deb42f85d9534e8506ea3817f9cc72ceef4f8cf45f094a4b491be53ed9e5", + "after_sha256": "beef8378f47e112f8b8ee3ca8147c3f0d5124e5fe7376b7efdb6f7f30ac1bb14" + }, + { + "path": "port/http/client/sync/http_client_sync.cpp", + "before_sha256": "05d7b73eaca72c28e0c5d29ba74165f11b551543b6105a8c58bab35db86418a0", + "after_sha256": "73650637239991ff0ca206a9d1d1153f1200c32aba0118eb101753387b23c2f4" + }, + { + "path": "port/http/client/sync-ssl/http_client_sync_ssl.cpp", + "before_sha256": "4399abe6fe732978a3f0f02a080c64a2f485d64f4a15e2195d04e4662daaf6e5", + "after_sha256": "dffa98509c809a6cda1eb71142c5a6b2b479402ec52dbe70bace5362a2ba2233" + }, + { + "path": "port/http/server/async/http_server_async.cpp", + "before_sha256": "142e1e71031e755d2961c4c41ec08f75f4daf40e5d4eacd6dd6f910b02f5453c", + "after_sha256": "65631d9a7559806ab294364fdb8ba51fb456644314d300403b6efa422ca71918" + }, + { + "path": "port/http/server/async-local/http_server_async_local.cpp", + "before_sha256": "7dd694796b854043c8c036aa5ddb8237282ce03afbbb993d5f7e9790cc4595f1", + "after_sha256": "80e31745cdde6090a371baab987b5bc1620bd108891813109498dd8f18cb01a0" + }, + { + "path": "port/http/server/async-ssl/http_server_async_ssl.cpp", + "before_sha256": "64ab4ba37493f89901b302c864e9033cfb18a43e0e1b58ec24a41ac8f75428df", + "after_sha256": "ea356ab16cb08435b3e9e03b0ca5f6fbc4dda6033eab686c023e867191e00c1a" + }, + { + "path": "port/http/server/awaitable/http_server_awaitable.cpp", + "before_sha256": "88d8e1743c592421c856eeba8777e1ec07913048a9e8d86290c22a2cfc7608cc", + "after_sha256": "821932159c33a8b0cee2521b51677d876e06f8c1bcdeec9f04e313648c3fc1ee" + }, + { + "path": "port/http/server/coro/http_server_coro.cpp", + "before_sha256": "98daf242d12d94c3eea250b3e82df7721701db64d719d0c24014a52cdd15d1cf", + "after_sha256": "19e05d7298075d7c0da9a469f08c7c7e0305d85d255d0919ae7b60603163be8a" + }, + { + "path": "port/http/server/coro-ssl/http_server_coro_ssl.cpp", + "before_sha256": "153456b94220dd7b214f540c8db1cae2c548c4862e92d12e2ad0ebd6d104f7d8", + "after_sha256": "74956e8517976b2ca57c4717c213a708a6cfbaf6e573f64e658bb0ce79b6326f" + }, + { + "path": "port/http/server/fast/fields_alloc.hpp", + "before_sha256": "2241fe8f26827d9b023f404182c3d6a91344d138c6ec383330561823585b3284", + "after_sha256": "2241fe8f26827d9b023f404182c3d6a91344d138c6ec383330561823585b3284" + }, + { + "path": "port/http/server/fast/http_server_fast.cpp", + "before_sha256": "2634feafda6c07b1673029be9acaca0c135e35aedbb6bfe28e27f6a9ccab11da", + "after_sha256": "d5f12958964acaa7348ed91a24f626b4c0053dfafcd600179154ec5356e3f479" + }, + { + "path": "port/http/server/flex/http_server_flex.cpp", + "before_sha256": "92b6b0cebb061f8b7210c65cd28f96880c84274ea118aa7b50ae4d70eabdc9ea", + "after_sha256": "1588d23471e2a2de7443d20aa669fe61f528260e85b174b535cc0842c37173d5" + }, + { + "path": "port/http/server/small/http_server_small.cpp", + "before_sha256": "bfcdd3d964c1b1136de685845a327e009264799a25a269a1ee2bd43dfdb30892", + "after_sha256": "6fa6ced2c14c759cd1f1af4e4cacfcc541041a4dd7f771b221c938a174279f27" + }, + { + "path": "port/http/server/stackless/http_server_stackless.cpp", + "before_sha256": "27fdd8146ccd153c21748da838d838f7277ea4b8590b166ed55456bbe29c7596", + "after_sha256": "69cd14ca707dfd4b5a69bd61f85652dabf435dd30a8c48f601d156c18336a2f2" + }, + { + "path": "port/http/server/stackless-ssl/http_server_stackless_ssl.cpp", + "before_sha256": "0cb0ee4842b636842bb080e0576aed57c2ed4a04539e97a710d78b1a43e59892", + "after_sha256": "bbf5d88d817c167d20edc0ca06b9649fe12ff0bcbab010681cd97755d7d22331" + }, + { + "path": "port/http/server/sync/http_server_sync.cpp", + "before_sha256": "d1163758f3edbbadd04b02d368a518ff8d4e277b34a8040164d5a0cea90e74f0", + "after_sha256": "6e4adff35269a833f47a9dbc0c1113174276d6868075e2399f3fe376d82cf8a4" + }, + { + "path": "port/http/server/sync-ssl/http_server_sync_ssl.cpp", + "before_sha256": "a770102edb915f88936abf05b5047df4c40a0030dc8db22af2b3cd6ba9d6b5c5", + "after_sha256": "8d675d5e29a09f933633fea2b51dfc2c5ab53eaad1a5fdaaa83b6ad9d9cbf6ab" + }, + { + "path": "port/websocket/client/async/websocket_client_async.cpp", + "before_sha256": "e41d6e818e9d16d628f6047e9111acdcac91d635887347a8d4e1eee37dcd60c9", + "after_sha256": "15a2ab2b5986c30d761b04787e9f6357fc508ed272d2211ea6027dfc524b7228" + }, + { + "path": "port/websocket/client/async-local/websocket_client_async_local.cpp", + "before_sha256": "13d8361337ec34ac7e1d7346d25eec9e6fb081cc63816541e3b30f8b2f0b18b0", + "after_sha256": "6cce9380dec39a51f4610fd17cbd08ad418ba5918295cb7bfe29a8ec6e87df8f" + }, + { + "path": "port/websocket/client/async-ssl/websocket_client_async_ssl.cpp", + "before_sha256": "f446d0f620bd80c85e26eae297b41e6a91f5fb0ae10458cddf89210033ddb328", + "after_sha256": "76358cc22688bd412ffeed3ac9d82c981a6fca78d635169172a13b7619c0db81" + }, + { + "path": "port/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp", + "before_sha256": "d001ba8d99ded61b5fdaf7d6c281de2fbe215559f6a8c50eb74c0b53711ac8c3", + "after_sha256": "3c623d44ac0728a9f2ce0a59a047a042c3dbe1cf298e5a9eaf35c13f73c74767" + }, + { + "path": "port/websocket/client/awaitable/websocket_client_awaitable.cpp", + "before_sha256": "720345bcdf2307759895027ad4d6cf055bcb0e66048322f944df71d578057a45", + "after_sha256": "b3669b415cbd48090abe8507bbab527c74ad746eb9b4350a6ab467a5b8a2ec7b" + }, + { + "path": "port/websocket/client/coro/websocket_client_coro.cpp", + "before_sha256": "e69f24f92d80cb79a55a65d8ed37aaa067a299b3ed1eaa485d851ec42c4cf446", + "after_sha256": "94729e985bf8cd028bce828b0c0d0db722fb37d3b2e06f98ff426c25afcbdab5" + }, + { + "path": "port/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp", + "before_sha256": "93b2be2ed7a52aaf11b4c6a514b86aba5669d77465d6f8e20aa8e22a6074c218", + "after_sha256": "ff1cc0d9286048d82b9fed7945a83757d6d011229545440e4bf657ecfd650a89" + }, + { + "path": "port/websocket/client/sync/websocket_client_sync.cpp", + "before_sha256": "118e138a47078700b7e3d314b97349085d88fbd8eff1ca16fa46fe66f5ab93f2", + "after_sha256": "c9c6780555b2b10ddd2c03a0e1241f609dcb7bb277729db0130d8f503eab8532" + }, + { + "path": "port/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp", + "before_sha256": "0a3dbed952b542912f24762115bbd0453bb69f264366c01b348d5df55e07cce9", + "after_sha256": "0bee666d3df50494d52f19a8ca43c63f1d3e27f7ede68bd34a541f469e6cb5ec" + }, + { + "path": "port/websocket/server/async/websocket_server_async.cpp", + "before_sha256": "767888327ecb42eb264f44c945e8666b2d76624416e64f25b031991ed5753241", + "after_sha256": "3427d66f1927b278d530d03b374771e74a2ec0e8b31c8691f10ff00e3fb5b2ac" + }, + { + "path": "port/websocket/server/async-local/websocket_server_async_local.cpp", + "before_sha256": "49d6e1587c844d5f658f6adf0821a7889984ae6bfeaebc36483bd3be852c639f", + "after_sha256": "39b7403cd373ba8a99a9b992af98ae15a3e11ade4e184451da744e5abf7e5306" + }, + { + "path": "port/websocket/server/async-ssl/websocket_server_async_ssl.cpp", + "before_sha256": "941a60709a0130a462667dcaff4f04b053a563248427c9abef3af4d93f5a967f", + "after_sha256": "81ac75f604ff7d8f37bbf550bafcb92b95539dd7e4e4c6105e4efbe3d44ef215" + }, + { + "path": "port/websocket/server/awaitable/websocket_server_awaitable.cpp", + "before_sha256": "594f1c4b71f6ab764e7e5505cf6a0d7d2dea7ca2af788f619c31cfba707e04a3", + "after_sha256": "6a4965153edf7013e1c5c1611d56d311b7187a5213cc5389af5fe404f01fd8ec" + }, + { + "path": "port/websocket/server/chat-multi/beast.hpp", + "before_sha256": "92f4e536080145b2da3ee479b0c425e387f725e0fe90a9796d706a2b574e43be", + "after_sha256": "92f4e536080145b2da3ee479b0c425e387f725e0fe90a9796d706a2b574e43be" + }, + { + "path": "port/websocket/server/chat-multi/http_session.cpp", + "before_sha256": "bfaa606d367c955b49f71e6e5c7b449b70cb94881df71a7a8062155b2c23f4e4", + "after_sha256": "bfaa606d367c955b49f71e6e5c7b449b70cb94881df71a7a8062155b2c23f4e4" + }, + { + "path": "port/websocket/server/chat-multi/http_session.hpp", + "before_sha256": "b76cb6edda83827aba86fb892a3c8b741152227026317404918feca1e0823cd2", + "after_sha256": "b76cb6edda83827aba86fb892a3c8b741152227026317404918feca1e0823cd2" + }, + { + "path": "port/websocket/server/chat-multi/listener.cpp", + "before_sha256": "fd8a7961ad233739734c6b1108b06d3c49d862a00cec91cd0c08026a02df519c", + "after_sha256": "fd8a7961ad233739734c6b1108b06d3c49d862a00cec91cd0c08026a02df519c" + }, + { + "path": "port/websocket/server/chat-multi/listener.hpp", + "before_sha256": "55b9148242068b5e1b6f4c79516fde77db4523e7aa514a9920422130a00166f2", + "after_sha256": "55b9148242068b5e1b6f4c79516fde77db4523e7aa514a9920422130a00166f2" + }, + { + "path": "port/websocket/server/chat-multi/main.cpp", + "before_sha256": "f43ee1bf8d9d1cdb2582d1d64e9ceb210d497e3d2f1e3a0e4990f565410461c7", + "after_sha256": "54bf9771f113ff2579b3d0a569a81435547528421fe34080d17a7890499fed15" + }, + { + "path": "port/websocket/server/chat-multi/net.hpp", + "before_sha256": "d2fbf1c484a4f120974ec632c39c2e7fad71923ffcd82fc0c961556b1428f14b", + "after_sha256": "68f43cb952fe4a89adbdf89935213d6f63822f6f0288d0c6f6282ac3d8fd93b0" + }, + { + "path": "port/websocket/server/chat-multi/shared_state.cpp", + "before_sha256": "52304203ddd87b8d44de9f839e1eb2f3c498255b982a952949b89bd1d771d249", + "after_sha256": "52304203ddd87b8d44de9f839e1eb2f3c498255b982a952949b89bd1d771d249" + }, + { + "path": "port/websocket/server/chat-multi/shared_state.hpp", + "before_sha256": "0028f48577186179a8f9141e4071cc83769920263dfca811e4846be35dffdccf", + "after_sha256": "0028f48577186179a8f9141e4071cc83769920263dfca811e4846be35dffdccf" + }, + { + "path": "port/websocket/server/chat-multi/websocket_session.cpp", + "before_sha256": "df8d60298382bd428e32e87e06cd4a91ebfab3c093d71dbd8f8ed7c267d30089", + "after_sha256": "df8d60298382bd428e32e87e06cd4a91ebfab3c093d71dbd8f8ed7c267d30089" + }, + { + "path": "port/websocket/server/chat-multi/websocket_session.hpp", + "before_sha256": "5451477e9d6e81ba16f5915bb63c760d2febfa025ee2d3e177978d4db916737b", + "after_sha256": "5451477e9d6e81ba16f5915bb63c760d2febfa025ee2d3e177978d4db916737b" + }, + { + "path": "port/websocket/server/coro/websocket_server_coro.cpp", + "before_sha256": "65c262ed392e51bcdd33d6001d32bf3419a24dcf2f0cdbac277392714bd45643", + "after_sha256": "df5d8747d4dbf07027d9d3d2af52f61180e3fc75c12506d54cccc008b3d4887a" + }, + { + "path": "port/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp", + "before_sha256": "c6481d98071883d23a4317e6e6672769e5a21c26993ff1519000208d8a5c9a49", + "after_sha256": "feb6f0bcf876c9b2139904974cd7667c9e8e38770dcfe0a605fbb6206908013d" + }, + { + "path": "port/websocket/server/fast/websocket_server_fast.cpp", + "before_sha256": "902667ea6ef3f3997b5edee5677b9bf1a04ee6e68880b9d94fec278661d71c29", + "after_sha256": "d9517728705ac9c723aa21bd94e36f32a0381b81a0d416cbf26f8284afa1114f" + }, + { + "path": "port/websocket/server/stackless/websocket_server_stackless.cpp", + "before_sha256": "fe867fd1e0873035fc99fbb0131136a47db29e3b00fdd54f5906033c57eb67da", + "after_sha256": "9621e879dc1370ad9229bba40b7627a0a95490b30350ca63b50222145af3481b" + }, + { + "path": "port/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp", + "before_sha256": "56cd0c6c1fa9fa3e930b1ed2382a4ac628efbc0472701af23c9601b050fe6652", + "after_sha256": "ff3cc67d0b949cde4396836ae83c5866b6f2d8889541bd0878bb0b464b9377b6" + }, + { + "path": "port/websocket/server/sync/websocket_server_sync.cpp", + "before_sha256": "3bf98656874177c604b3fab2736ad9efe2768ef37f38644765ce772f5a38b1fc", + "after_sha256": "54f061aba51b3eb59fbc227f3b26cccfdba74038ce29c27fab258d29ef240a63" + }, + { + "path": "port/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp", + "before_sha256": "5aea6adb6acaf586e2a007ce11bdae21374a5b078216b391a20b06a2301f33bf", + "after_sha256": "a2f7a50626653cbd623cb1f7a09d52c8f6a9fa637e209c1191c0db638d6b1fb9" + }, + { + "path": "wasip3/advanced/server/advanced_server.cpp", + "before_sha256": "e5eb137b9580f47bea86cbb534fc15473110cfc0630f1c75c41e8238dd41bd97", + "after_sha256": "4d83d326cf595cc4bd9b4125ff01e52f644cc099be6aaf5684fa192e1e52b887" + }, + { + "path": "wasip3/advanced/server-flex/advanced_server_flex.cpp", + "before_sha256": "06cc1b52d7eeda0fc38b8160b3d1e220b59b51734fb9c41e14d5d2015bc0dbc4", + "after_sha256": "70de69b5c043e7425d17b1d92be8b4c4b1a1c74cf95ae331ffd24819e1009860" + }, + { + "path": "wasip3/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp", + "before_sha256": "ff182281d3ebc8737b1869392d15b2e2c21187ab90f2ed3aae9a5488ccd168f2", + "after_sha256": "a175d27c99728dd30800e47ed1c36202fba1ab47112052f46b0ca4d6e199eedf" + }, + { + "path": "wasip3/common/root_certificates.hpp", + "before_sha256": "c1d96d2acc81100ae03c49dec9c83895a326834c9e2a5a415a07dc502fc91b37", + "after_sha256": "ca94db5f14181d18faf729979b1ce1bc3465bd31ef4abfc05602c822597aefd3" + }, + { + "path": "wasip3/common/server_certificate.hpp", + "before_sha256": "25bed00fb8a615733007f5d07ed5631cb02d29b15bbc48fd61bf1c3e23d78b09", + "after_sha256": "3079d0888f2e29aa67592d9b241d91e710676678b4cc968c1c6c7b5f7b582b8c" + }, + { + "path": "wasip3/doc/http_examples.hpp", + "before_sha256": "4bc1abaaf71bf8b21f99d427bdfda536fe41ac770d1ff8276b3e418571df1e4a", + "after_sha256": "e545889a442f08ebb4f936203c923c9e1e6e3499e327d440c56e0d097d7e9d3f" + }, + { + "path": "wasip3/doc/ssl/client.cpp", + "before_sha256": "5b8edc4e48d35d97a631016944fc149969c045f5bee92f7a17ad65151f659ebb", + "after_sha256": "778c5b0d32b058fd3890122c3cf3e3ff5524f3ea14374821d01f9d20feb2aef5" + }, + { + "path": "wasip3/doc/ssl/server.cpp", + "before_sha256": "77765ed8360d3bd580953515a67e597b3e66277d429950fb19644328078c3471", + "after_sha256": "96c74cdddedd7f1182baffe96c403402ca5152d7d906d0dd953c0e246fba3cbc" + }, + { + "path": "wasip3/echo-op/echo_op.cpp", + "before_sha256": "014be8cb98932f9a31ccabade7a8de3ad0d2537a0a45970047f581e5a882c07f", + "after_sha256": "f045a56ce7ca33ba0976d8a53f529c08d24180180c6ec3ba9370493f27885928" + }, + { + "path": "wasip3/http/client/async/http_client_async.cpp", + "before_sha256": "2285828c5b451158a156cac780791abf95fe64289013bc331ebd6de404d6ca0f", + "after_sha256": "9523b6d3340ef2b6a585c745745e1b2d60a75d6e99227bae9920480644d61b72" + }, + { + "path": "wasip3/http/client/async-local/http_client_async_local.cpp", + "before_sha256": "75e4bb7b5b90e0e4289c48edb099edd18103214dffaf01bae14fbda90e355887", + "after_sha256": "eb486b841b49adb68a87263b333d4174abaf74081b8c71fd67758ba874e51160" + }, + { + "path": "wasip3/http/client/async-ssl/http_client_async_ssl.cpp", + "before_sha256": "1b36c1b99a76ed9e8ee3e9e3373be983b8a5ec19c50840cfa4c3512d66ab8202", + "after_sha256": "5991ca64a2902b0cf516215ac370677d6c820fb5e22605e7ea4b7f7aca80896c" + }, + { + "path": "wasip3/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp", + "before_sha256": "f6667eb4e8c7a1efcce1c3f2efa43bbed83a322030879c3c3af78b98f7b8aafd", + "after_sha256": "f911adfea2e7b2bca81ac0bc4db03f79876f2eec37dbd2313570266a54435d93" + }, + { + "path": "wasip3/http/client/awaitable/http_client_awaitable.cpp", + "before_sha256": "ff51a143879c05151ffffda38cef703da28aeb492fc1c659682898adb548c478", + "after_sha256": "2d39d18a49e14f0d3b400e0730d54e379908b3a2326845b466b1592f9898de8d" + }, + { + "path": "wasip3/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp", + "before_sha256": "6d1548f4bd3530c2b36abb90eb51283a363f6c736b740c134a49b9d09abc343f", + "after_sha256": "a0ecd605fa73eda2882f5c833a2c454a810ef4abc5a1e4ccd637ccb645d04093" + }, + { + "path": "wasip3/http/client/body/json_body.hpp", + "before_sha256": "239fb1f46a0ce856c3b402c15aa9d89605ef9fab877e34fe7f5f40651753ba78", + "after_sha256": "92bd6922db49019f3184010ab0c59622604a6877f7fe04688fb4e3e98647f67a" + }, + { + "path": "wasip3/http/client/body/json_client.cpp", + "before_sha256": "ecef52359562e85ad0b3264dcbba7055d7e938adcd1f7d3b5a688a3c81d2a6d0", + "after_sha256": "aebc2d412fbc64e992dc11ba9545e96c67c06392ae25aeb31792f90905355b73" + }, + { + "path": "wasip3/http/client/coro/http_client_coro.cpp", + "before_sha256": "1886f5f464fa8394413b08ef6dfc7e712fc3d58ac35160e7baf52dff0d66ddf8", + "after_sha256": "08c629720a5e0541c7e2823fb8a5739cc44209acaebb3e57c4f36e33052a0316" + }, + { + "path": "wasip3/http/client/coro-ssl/http_client_coro_ssl.cpp", + "before_sha256": "527b864ab827818b6c9548364f726229cb5230b9c8ded5d8c07b2753b43c7313", + "after_sha256": "b1f5a87e402a77920a54f29ca3fa1df5f82bbd95d2e26a16f67653286e2a5f56" + }, + { + "path": "wasip3/http/client/crawl/http_crawl.cpp", + "before_sha256": "27ebf5465fef8cf7cfd5c1d087af0a6a26f880c21bb57b8a712edbbd4faef2ca", + "after_sha256": "26baeeec475f72a9ad6bf8f0877d547004ae20518667bbacdf34848e930f0f3a" + }, + { + "path": "wasip3/http/client/crawl/urls_large_data.cpp", + "before_sha256": "ff1d3f583497c6349a5ac3e391780203bb5b0797fa7eab9cbf23519421cd1f95", + "after_sha256": "ff1d3f583497c6349a5ac3e391780203bb5b0797fa7eab9cbf23519421cd1f95" + }, + { + "path": "wasip3/http/client/crawl/urls_large_data.hpp", + "before_sha256": "40a1576a89fe4f7bd05d88cb46fac47ea1cb4907b0d2405479fa8577be4be1f8", + "after_sha256": "40a1576a89fe4f7bd05d88cb46fac47ea1cb4907b0d2405479fa8577be4be1f8" + }, + { + "path": "wasip3/http/client/methods/http_client_methods.cpp", + "before_sha256": "9772217152cd9b0590c5bd58702943c4596447faf400ceb5ca65695d4d114e28", + "after_sha256": "015eac7293a5be5a7db2507e48165cdb730181ce1e290e94f868ac474cd7024f" + }, + { + "path": "wasip3/http/client/sync/http_client_sync.cpp", + "before_sha256": "0811bd306739c97a127f5a7bc0295f6b5d533a9d0a2997f240b6435ea7d13086", + "after_sha256": "e2290f15765b13643cbd66c5f67f6816beb3dc435bbf84c83ca4e3da88f7f09b" + }, + { + "path": "wasip3/http/client/sync-ssl/http_client_sync_ssl.cpp", + "before_sha256": "7cd2ea7df47701fbecc711b8194e925655c4ca5048ee1056db862cca828f77dd", + "after_sha256": "fb9b2b4c201a4c04e1b6d73bcd5937980d5670ee6c1353fb64ad3aac5eaf7d46" + }, + { + "path": "wasip3/http/server/async/http_server_async.cpp", + "before_sha256": "b8e5e1e29b636335fa2b018d5b1a5bf1b6337ce018b15a740aedf1e991ab872a", + "after_sha256": "5cb74901b535cd5e8803cca211e2ceb3cb36f478e8a3852c624821f96388ad0a" + }, + { + "path": "wasip3/http/server/async-local/http_server_async_local.cpp", + "before_sha256": "61ac6c39e0e41f9187274cc02a633e459ac21cf9927be5315c4c9839c3069a6f", + "after_sha256": "a717a577865253a000dba87a06c85ec3e976490567b09105b19965e4e62b405b" + }, + { + "path": "wasip3/http/server/async-ssl/http_server_async_ssl.cpp", + "before_sha256": "ffa07d92961e61b6de15ee844a94865467095a36a20fb0bfeffd3149c1b69255", + "after_sha256": "5c85b0ac8f53567d9fcb5b6d3c0bdce87788d59bf1a3870f471b1b656f4dfb56" + }, + { + "path": "wasip3/http/server/awaitable/http_server_awaitable.cpp", + "before_sha256": "044c688ac42abc563e853feb38046d58bf30ec0b5d519ff22436cf9905dbb8f0", + "after_sha256": "9855b4b08e67309e0cbb8e52ded9c30abe290b40e74ddfaabf0e18f53092cd2d" + }, + { + "path": "wasip3/http/server/coro/http_server_coro.cpp", + "before_sha256": "76d436d30f6959d6b4f72b90f6bf96795213318e5e41050b61c74d6250a48ae7", + "after_sha256": "c8b2995c2284bfbd79339a7697804f12c15d43266f4f6b42d14066a98d4da794" + }, + { + "path": "wasip3/http/server/coro-ssl/http_server_coro_ssl.cpp", + "before_sha256": "19bf523aa47e2a900a459a1252a64004fc863a8c68e73c5a43228931ea35b72e", + "after_sha256": "7fc684708f082f93ff69d10b4e1afdb6ef3ac53a2a77066ccd0435d99ce1edfd" + }, + { + "path": "wasip3/http/server/fast/fields_alloc.hpp", + "before_sha256": "ea08cd509366fcffe33391cf1c62d30a48a17d011120950b003a7f22efb71839", + "after_sha256": "ea08cd509366fcffe33391cf1c62d30a48a17d011120950b003a7f22efb71839" + }, + { + "path": "wasip3/http/server/fast/http_server_fast.cpp", + "before_sha256": "0afc2e5a193f7c664a0a3f970563c8f33ea73a45e66ab96cd88c1632476ae00f", + "after_sha256": "c808306a71deb4ae07da3cefa70645a0465b132468c15f1964d043cf9b390d23" + }, + { + "path": "wasip3/http/server/flex/http_server_flex.cpp", + "before_sha256": "754b54450bbf2f8ab677d68259c5b14db0f82ae80912a34452b736b8e8a059e7", + "after_sha256": "bd6191a644473c4121c57604f094022331e41fbe1feaf9f0ed58d1656fd5be6c" + }, + { + "path": "wasip3/http/server/small/http_server_small.cpp", + "before_sha256": "05e1a313bf624aa0619105fd3c480da796a20b36d21b65970d9dd940107dc082", + "after_sha256": "8552ac300e655a37047a75b8e523d964ed5e10f703498b679fd91d94303f7f91" + }, + { + "path": "wasip3/http/server/stackless/http_server_stackless.cpp", + "before_sha256": "e43b38e0ca0845d1aa825f009dbc576c8497d20da762c84e3dd79205d40fbb6b", + "after_sha256": "c878eb4f4f8d259be0137bd0ecc0fcd4d0d15d6125c4c7d86ed36a871a31f1ee" + }, + { + "path": "wasip3/http/server/stackless-ssl/http_server_stackless_ssl.cpp", + "before_sha256": "b48cb2d8024c0475bbbacd6f049acca3c2c969f3a48567f3a3b92f21bc81d02b", + "after_sha256": "f0ad59f139321b8af970d444b6addc1f8fe025aa3cdf936858b67b1eeba95b7d" + }, + { + "path": "wasip3/http/server/sync/http_server_sync.cpp", + "before_sha256": "840ddfdb748c61aea22e39e21e83bedf435d30ed8e93f80213775ce9e7aeaa53", + "after_sha256": "5f586df74d5b48ff15d5b070b7a1cd44d2c224dfd86e911e538d47196651c2e7" + }, + { + "path": "wasip3/http/server/sync-ssl/http_server_sync_ssl.cpp", + "before_sha256": "9a31d0941da5c73910956a54ae600bfeab8f15d491ec427ae7131422676ba6b2", + "after_sha256": "b4a41199e3dec6b19a9dbce5f03ad91ec027d150450db756e48765d29862a1c0" + }, + { + "path": "wasip3/websocket/client/async/websocket_client_async.cpp", + "before_sha256": "a2e17669c2ebbdd9b959ffc7fcaa37cb170d524086db8a7432a10186c2f92a99", + "after_sha256": "cb91ac977fece9ea42f82f24387c0f109c7528f4ea917f24ebe69fac5db52a05" + }, + { + "path": "wasip3/websocket/client/async-local/websocket_client_async_local.cpp", + "before_sha256": "62c3d6fe2c244ac406acf9863d0a4d280cca5cd4bf81fab3a09d36c7d1f1eb65", + "after_sha256": "fa82633604c7876cd869b317e917085894ea26e68bff03c9bfb7ebea06aa141d" + }, + { + "path": "wasip3/websocket/client/async-ssl/websocket_client_async_ssl.cpp", + "before_sha256": "1d968319fe2854f00ee098cb207b5e2ed2b1be563c1b57632b4d841eed8b5b62", + "after_sha256": "9ee62ebe9d1d8a8c807e1030d3dc99e3ed0e002b1da171c84efef5e5757fde11" + }, + { + "path": "wasip3/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp", + "before_sha256": "e871c9e6c5256da04471df6393a3730a755244ceb4b7f37f4fc2a605fd74cfe7", + "after_sha256": "d1217186d4d16b2938db21057982b9f734e799fe85526c15827ca16c482ccb1c" + }, + { + "path": "wasip3/websocket/client/awaitable/websocket_client_awaitable.cpp", + "before_sha256": "2d98b912f486ebe9efe5f01f88f4602c4c5dc137bd4740e0fa18949415833896", + "after_sha256": "40e4b4fa4dbacd485ed1de27fa9fcb353bf4a974062b262dbf2d2f24aedc46d0" + }, + { + "path": "wasip3/websocket/client/coro/websocket_client_coro.cpp", + "before_sha256": "11dd07e77fb90406c428591c9cc7ef3f234938d781c57c64afcd4ac95b4c9412", + "after_sha256": "67bb26f59d5510a8d14e8f41299e7be8b138ea6ce47cf7933a1174eed738a6a7" + }, + { + "path": "wasip3/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp", + "before_sha256": "ed548fa32660e06ea762fb162ea526a0eb682d3efc84aa9a10c93800e4a44beb", + "after_sha256": "df0c19fb53b6d99fcc14f729de87880a6ab846361710dc02ab503ebbfd884168" + }, + { + "path": "wasip3/websocket/client/sync/websocket_client_sync.cpp", + "before_sha256": "c3d5e4b20fe930cae17f84a00c19f9fc1bd83d6a62f24fd0e525de60991c46ea", + "after_sha256": "536fcb197691103efb7789e9886b9b31a728d006e3f930c99f77796ac48ac851" + }, + { + "path": "wasip3/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp", + "before_sha256": "17aa2fdae18236bb7e5c8f5cf76ff5aa2990b440612e5bcc4259ed0ed79dfe4f", + "after_sha256": "ea387827e4b6f6f3694373f2f80b3db2f24a2ce5ec1df6c98b2d15827b67d563" + }, + { + "path": "wasip3/websocket/server/async/websocket_server_async.cpp", + "before_sha256": "cdb2b60af886a4d801fc1f3a4d3ca8199eb7db82a5d66a6d6ff71f21501d76de", + "after_sha256": "dc3f2b8dff891ef1dd8aa97805d493c3d82e528bd37321519fa1bd893ad18a84" + }, + { + "path": "wasip3/websocket/server/async-local/websocket_server_async_local.cpp", + "before_sha256": "8fc7d79e5757ffa4f89b7de65d07661944aba1864c829f35e1bfeac95d61e208", + "after_sha256": "2ce990533c2c64d3d7c5bf266824a76c75392fa185232428973e3c4eae099d27" + }, + { + "path": "wasip3/websocket/server/async-ssl/websocket_server_async_ssl.cpp", + "before_sha256": "429f78ee218f6d8cf68c5c9ebf8a90508891f80ad70456489f3ff596c8ed4cd7", + "after_sha256": "f102a3a30aa9336d2d2316949d1d3abae44ac8b30349d93f750db4cb9bc149fa" + }, + { + "path": "wasip3/websocket/server/awaitable/websocket_server_awaitable.cpp", + "before_sha256": "7f5a905f45ddfd60275fbff18047de77e98604da55d8cca181a0a4ed7807a5dd", + "after_sha256": "287e8c784b6a02245eef81340d9aab7b57ffbd16e9db1041d5c32b91b7ebe0bf" + }, + { + "path": "wasip3/websocket/server/chat-multi/beast.hpp", + "before_sha256": "756800bdfc0666cf4d6af056cf339429b992ffb41641febfed1e19e7bc2cc438", + "after_sha256": "756800bdfc0666cf4d6af056cf339429b992ffb41641febfed1e19e7bc2cc438" + }, + { + "path": "wasip3/websocket/server/chat-multi/http_session.cpp", + "before_sha256": "bc5c857e2bf45186e9d25816f720ea99f38161ae5fe816a9849882683e916dc4", + "after_sha256": "bc5c857e2bf45186e9d25816f720ea99f38161ae5fe816a9849882683e916dc4" + }, + { + "path": "wasip3/websocket/server/chat-multi/http_session.hpp", + "before_sha256": "c9a54d788ca06f477ef71350a6c65527e4d635bcb0ba39f9dc60dc584291e499", + "after_sha256": "c9a54d788ca06f477ef71350a6c65527e4d635bcb0ba39f9dc60dc584291e499" + }, + { + "path": "wasip3/websocket/server/chat-multi/listener.cpp", + "before_sha256": "40826596c434060dd7b3cc22c7a4588efbfafc153692b767b9b320113bf2b3b8", + "after_sha256": "40826596c434060dd7b3cc22c7a4588efbfafc153692b767b9b320113bf2b3b8" + }, + { + "path": "wasip3/websocket/server/chat-multi/listener.hpp", + "before_sha256": "1d9449a356ba3b838e170e5d0b26c52945e3de897b2adeae7f908b31dfcd2729", + "after_sha256": "1d9449a356ba3b838e170e5d0b26c52945e3de897b2adeae7f908b31dfcd2729" + }, + { + "path": "wasip3/websocket/server/chat-multi/main.cpp", + "before_sha256": "26902bb2ea461f83c243843bea45a83ebb5c4c2ba3a3b2781515591a58ba9e8f", + "after_sha256": "26902bb2ea461f83c243843bea45a83ebb5c4c2ba3a3b2781515591a58ba9e8f" + }, + { + "path": "wasip3/websocket/server/chat-multi/net.hpp", + "before_sha256": "1a5acd059afa8183609465306decc02353910a6cfbb667a8deaf94f6c9396c21", + "after_sha256": "e994bdf2b4e265551a4626bf72dda71bd67137411ac8ba957ef1741e4d699d47" + }, + { + "path": "wasip3/websocket/server/chat-multi/shared_state.cpp", + "before_sha256": "cb6ff5ae523c305753a7210214fb552d85a6ba754da9f73e32512ca98494c026", + "after_sha256": "cb6ff5ae523c305753a7210214fb552d85a6ba754da9f73e32512ca98494c026" + }, + { + "path": "wasip3/websocket/server/chat-multi/shared_state.hpp", + "before_sha256": "aac19c9391d7920edb7d84a3a95bb0c8603bd0a8fb5c13e630b278599e849489", + "after_sha256": "aac19c9391d7920edb7d84a3a95bb0c8603bd0a8fb5c13e630b278599e849489" + }, + { + "path": "wasip3/websocket/server/chat-multi/websocket_session.cpp", + "before_sha256": "766a889ddfa6d8f045abddcae8e434a9a02038dabd7c77699fc1744c36639c33", + "after_sha256": "766a889ddfa6d8f045abddcae8e434a9a02038dabd7c77699fc1744c36639c33" + }, + { + "path": "wasip3/websocket/server/chat-multi/websocket_session.hpp", + "before_sha256": "4b3b2613ef98dbdfd5e2318fb9342568ffc5972b8daf7e040452b8e96b704859", + "after_sha256": "4b3b2613ef98dbdfd5e2318fb9342568ffc5972b8daf7e040452b8e96b704859" + }, + { + "path": "wasip3/websocket/server/coro/websocket_server_coro.cpp", + "before_sha256": "cf8a9ffe47e23fd1ae94427de8cb3366ef249c55a1155b4b9b06191bbd9ba7b7", + "after_sha256": "525206b2267576b3c42944f89a0ff293d4cec55a321c7be60fdea47747de91d6" + }, + { + "path": "wasip3/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp", + "before_sha256": "01d1912f721747bbf7afbae7ab9b364c2a095ab800a74a5bbe629837ca1b12be", + "after_sha256": "918d303281280345b93d42ce783f5554ddf7c35de899c5e1adfe5f969ba5b41a" + }, + { + "path": "wasip3/websocket/server/fast/websocket_server_fast.cpp", + "before_sha256": "46ef3d22259fee0077b53f3224b0329f27d5483d5a6e9b4428f73f3d70091657", + "after_sha256": "7e4638a14b99ca37580b31da6da2c93ffb085225c5145aaa9038f83f0b7a25e4" + }, + { + "path": "wasip3/websocket/server/stackless/websocket_server_stackless.cpp", + "before_sha256": "2f056788a1c25754f145bd48554c284249264f669e561a4055bd2fffd6e8ba3d", + "after_sha256": "1a51288899bf8c5d8ee3fe1f65add405d262830af9feddc255a02ca6fe15e1fb" + }, + { + "path": "wasip3/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp", + "before_sha256": "cdc318dcc06146361cb1d5682b7238cbd96d3e9dadd4b2c2a723da0266a8ffa7", + "after_sha256": "5980db0eac1941046fa4cb52444ab96459af4ef9bc1ae881b2c879bbee3ab702" + }, + { + "path": "wasip3/websocket/server/sync/websocket_server_sync.cpp", + "before_sha256": "055c030a9aee608afccfa9e5f05715fdcfd30df45eda47b7f145baa774700d36", + "after_sha256": "4ba03bbfccdb3e182aecd6581d60c534f1b5e153dc2c79f34bf0bd3eb7db87e7" + }, + { + "path": "wasip3/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp", + "before_sha256": "2bfbc52573196ef2cf066cc73c0fda9d440d7837b39d3e732b8940a15a50263f", + "after_sha256": "e86838f779e7acfc7b8ed33a2d358459d94315ac350aa65dc6bb7bba57563949" + }, + { + "path": "browser/http/client/async/http_client_async.cpp", + "before_sha256": "274ddd591c68adee363fd47b3785b1641a2bde4200414c9de97bc3e42d9fda0b", + "after_sha256": "9689305d8f5138cabed95e8ed19fcf015e1deb75e080cb548febcd109b07d8aa" + }, + { + "path": "browser/http/client/async-ssl/http_client_async_ssl.cpp", + "before_sha256": "cfd65395b05707b8935ae69a77833ba6b56d7ad086dbcadc2b347f61d9a54a3d", + "after_sha256": "81711c1eebeae7db8b2cff669377afdfe386b5d44d10a434fdffee4d0dc9788c" + }, + { + "path": "browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp", + "before_sha256": "bf614435f4ca685f6a7e586f727f2f6d1dbe84b3218ed6c47147a6089d19200c", + "after_sha256": "32c03e8bd7863265455bdfea9c9c5179403532a6ac9666071fb413f6297c6db3" + }, + { + "path": "browser/http/client/awaitable/http_client_awaitable.cpp", + "before_sha256": "d97264b6a100bbae75e728750c8f67012c01d085138ea90876720e6c0621a98e", + "after_sha256": "0f67844f72a18e4cfddb04746847c76c6eef1728c69f067b5a4e412144245ea1" + }, + { + "path": "browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp", + "before_sha256": "d4e85fad21ca2611195749fcc92a50667629461126681ec6115ad053863a048b", + "after_sha256": "727b65b0b2064081803a3676e1360980cffe10a41c9fa4c74285dda03e8f0a74" + }, + { + "path": "browser/http/client/body/json_body.hpp", + "before_sha256": "7e35470a70f1b5e935988a506229b1275d27d2df75f36ec417faef9ac97e9e3d", + "after_sha256": "cc76077f3490012f86c97cf5b9f62bdd5e16adb092add3dea1bc5ce6707b716b" + }, + { + "path": "browser/http/client/body/json_client.cpp", + "before_sha256": "2c05e7f5ad5d4e2e6643718e50bb41900c08e5d2a1f45a63fde0cb91e8e71cee", + "after_sha256": "91eb7b2655696f36bc5c66fca0af68f81b1d177982ea9b2910a7da012b3f08e5" + }, + { + "path": "browser/http/client/crawl/http_crawl.cpp", + "before_sha256": "cb99c94b497b2123b7b83a3c742e7ac48cad9d5f1e568926e85f5b99baaf27c1", + "after_sha256": "e893f1f13069aa54fc01037cfdbb24335f63b120bfd91d8eb5103f776ff4b155" + }, + { + "path": "browser/http/client/crawl/urls_large_data.cpp", + "before_sha256": "f0bd48e54476d6276c716eb30fa4bbbbad7e4cd8bc6cc90874fbfac1112479c4", + "after_sha256": "ca026703d95ae403588ee7ec2cd0146cc6e7ae5f876ef8ac6eff63c689a62e9e" + }, + { + "path": "browser/http/client/crawl/urls_large_data.hpp", + "before_sha256": "caabdbfeb839ea898108b52da44520e529c11d2fbd9e0a8c8bbdaad578af9a79", + "after_sha256": "56dab6a1fa975c0354224a513694498728c35352bb769f47d64c286aac2f610a" + }, + { + "path": "browser/http/client/methods/http_client_methods.cpp", + "before_sha256": "699a4a88bf530b42056158a4f560bd96bf03b179f63fe8eca5198a321b4c9f1c", + "after_sha256": "3cb642a56347a6e1e49fc0e1c76a57c48bb557157cee9ec3c0f3c6aff0a5b16d" + }, + { + "path": "browser/http/client/sync/http_client_sync.cpp", + "before_sha256": "a82cba7681279e2a0c3cdcc914331f660f2abce642b59bdd006308a07e558783", + "after_sha256": "b9ba2a46defd21774aa3571f8eb0499b8da9aaa0731d059e089fddc430d0186f" + }, + { + "path": "browser/http/client/sync-ssl/http_client_sync_ssl.cpp", + "before_sha256": "394d64ddf052f145e5032908930af06a42e50dddf7b252cde827e8434a9d541a", + "after_sha256": "0bbf910af9f92197a630e147ec314774b2a1a3ce05ddd951de93c57fd17acf1e" + }, + { + "path": "browser/websocket/client/async/websocket_client_async.cpp", + "before_sha256": "4a1eceaba17f73d83340c3496082626916feec15223c4a37f69f8a49fc595b3a", + "after_sha256": "9a0c51326fc10be52bfa6e7e0e2b407e5a3ac7a2bb7999511ae0c8f3bdba2f5b" + }, + { + "path": "browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp", + "before_sha256": "bbad86f3e7a9debcdce5c53c446500a9e2eaee4e4a0c056fdd1bb4112c137aa0", + "after_sha256": "cb471c6281c7e686f57c10d17ed515eddba81b5b886708e681239fbe4a4abacc" + }, + { + "path": "browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp", + "before_sha256": "49a560ed2ae3d0ef0985eca5a65825e98e41e4c212d682ff750f4543c1e7687c", + "after_sha256": "93774567941330fca970d285c7fdd56846aa473e74019457c68ba85a861eb468" + }, + { + "path": "browser/websocket/client/awaitable/websocket_client_awaitable.cpp", + "before_sha256": "bc36671fb10c7c8b8541fb60e27b536f944f5f222d0c68088f0957c701d27043", + "after_sha256": "65dd6fff4efac198676befbead3939fe6a5a4517725c8e417310446c4d5da895" + }, + { + "path": "browser/websocket/client/sync/websocket_client_sync.cpp", + "before_sha256": "3a5be6dbe748524da3643058a011cf48b646ac9dcefeab72a128c3506b0d5552", + "after_sha256": "ebe964a27dec24b52c1dd3ba6426ba4c664f8ff839d2021dfe690481f40d5f45" + }, + { + "path": "browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp", + "before_sha256": "6ef48bec93042ebf63772e55c788eb05ced79d834cc64692542d10327cb4fa20", + "after_sha256": "8019513c310b502befe7c26e109ac2a865db59ecc429b7255f338517c11b6c0b" + }, + { + "path": "host/advanced-server-flex-awaitable.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/advanced-server-flex.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/advanced-server.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-async-local.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-async-ssl.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-async.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-awaitable.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-coro-ssl.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-coro.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-flex.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-stackless-ssl.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-stackless.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-sync-ssl.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host/http-server-sync.cpp", + "before_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7", + "after_sha256": "f5c5d1d2417270b96c6c602ace67a81f7b9e43d2a213eb9b6d35910ec5d05bd7" + }, + { + "path": "host-clients/doc-ssl-client.cpp", + "before_sha256": "e79720205772f7de68302003e2c5d09d768a587f68867e211c5f6259204860d8", + "after_sha256": "e79720205772f7de68302003e2c5d09d768a587f68867e211c5f6259204860d8" + }, + { + "path": "host-clients/http-client-async-local.cpp", + "before_sha256": "783c58264c5f69c336b095e7a21b89de74c14f061299b9dbd329a597da55e1be", + "after_sha256": "783c58264c5f69c336b095e7a21b89de74c14f061299b9dbd329a597da55e1be" + }, + { + "path": "host-clients/http-client-async-ssl-system-executor.cpp", + "before_sha256": "76e5a720fdcfaab890fe6487cb5d5178b2ae00517c7607473a33bf47fe563e2d", + "after_sha256": "76e5a720fdcfaab890fe6487cb5d5178b2ae00517c7607473a33bf47fe563e2d" + }, + { + "path": "host-clients/http-client-async-ssl.cpp", + "before_sha256": "388bbfea0d9cc7d952753fbf10dd78de7fec7226e444f5d78e282371464ecc1d", + "after_sha256": "388bbfea0d9cc7d952753fbf10dd78de7fec7226e444f5d78e282371464ecc1d" + }, + { + "path": "host-clients/http-client-async.cpp", + "before_sha256": "e76091faed5c69badf0c8e0ace0b90020d3b146c6ddb159792aa87b884dc9ef4", + "after_sha256": "e76091faed5c69badf0c8e0ace0b90020d3b146c6ddb159792aa87b884dc9ef4" + }, + { + "path": "host-clients/http-client-awaitable-ssl.cpp", + "before_sha256": "709a6822f903c7baeb0f3d71b94ac3390a1015e139eda0e2753f4734a1744e6a", + "after_sha256": "709a6822f903c7baeb0f3d71b94ac3390a1015e139eda0e2753f4734a1744e6a" + }, + { + "path": "host-clients/http-client-awaitable.cpp", + "before_sha256": "709a6822f903c7baeb0f3d71b94ac3390a1015e139eda0e2753f4734a1744e6a", + "after_sha256": "709a6822f903c7baeb0f3d71b94ac3390a1015e139eda0e2753f4734a1744e6a" + }, + { + "path": "host-clients/http-client-coro-ssl.cpp", + "before_sha256": "691661a14c6640f6e81ebde8017ee63e62718d9a54ccddc9c51566fcbbceaa2a", + "after_sha256": "691661a14c6640f6e81ebde8017ee63e62718d9a54ccddc9c51566fcbbceaa2a" + }, + { + "path": "host-clients/http-client-coro.cpp", + "before_sha256": "1319d2ce14eb2b266895be01669817b76a4f66826e21402b00df514418c4fc34", + "after_sha256": "1319d2ce14eb2b266895be01669817b76a4f66826e21402b00df514418c4fc34" + }, + { + "path": "host-clients/http-client-methods.cpp", + "before_sha256": "ee396fd2a4d593819addd1294dd55fbc517691ca52d3449199cae87dcd2ff0f9", + "after_sha256": "ee396fd2a4d593819addd1294dd55fbc517691ca52d3449199cae87dcd2ff0f9" + }, + { + "path": "host-clients/http-client-sync-ssl.cpp", + "before_sha256": "bf8bd3ae5e0c63ee474301a3a3ad9f1d90944c4d8be077dc765669de731c37ca", + "after_sha256": "bf8bd3ae5e0c63ee474301a3a3ad9f1d90944c4d8be077dc765669de731c37ca" + }, + { + "path": "host-clients/http-client-sync.cpp", + "before_sha256": "aa613b7ef751e51f3391639836b389fe2ea42618b0c71fa63649983caabccbe1", + "after_sha256": "aa613b7ef751e51f3391639836b389fe2ea42618b0c71fa63649983caabccbe1" + }, + { + "path": "host-clients/http-crawl.cpp", + "before_sha256": "6666832aea4681a6fad07347aa818247561b98e75010795569c60ab5da4486a8", + "after_sha256": "6666832aea4681a6fad07347aa818247561b98e75010795569c60ab5da4486a8" + }, + { + "path": "host-clients/json_body.hpp", + "before_sha256": "ef8a1f799259e40aa48dce43f8c6c039f77dfd3094e44c157995d64d4933c5d1", + "after_sha256": "30deb532aaffca5dc8cf75c6db420f607cc30d8ed94fbff49e242bbb97160e24" + }, + { + "path": "host-clients/json_client.cpp", + "before_sha256": "1694f73d4292c47adf310304deb51acde4283f40fc29e2ea5d1c70d5a3d916ed", + "after_sha256": "1694f73d4292c47adf310304deb51acde4283f40fc29e2ea5d1c70d5a3d916ed" + }, + { + "path": "host-extra/doc-ssl-server.cpp", + "before_sha256": "013dd93057632bd223ab778a12b599cd4118bc85ce648518307f2bd59344a52a", + "after_sha256": "013dd93057632bd223ab778a12b599cd4118bc85ce648518307f2bd59344a52a" + }, + { + "path": "host-extra/http-server-fast.cpp", + "before_sha256": "9c838ae47e254647ba11a096531d54fadaeae16ac86e53b135e5dbca653d48ad", + "after_sha256": "9c838ae47e254647ba11a096531d54fadaeae16ac86e53b135e5dbca653d48ad" + }, + { + "path": "host-extra/http-server-small.cpp", + "before_sha256": "d939339269d9a0da6b1c315818ee3e368d7cc296af479b18e20bc86b7bf1d9c6", + "after_sha256": "d939339269d9a0da6b1c315818ee3e368d7cc296af479b18e20bc86b7bf1d9c6" + }, + { + "path": "streams/http-client-async-local.cpp", + "before_sha256": "c9b8fd2700738c56c0237f79137f495c4b7f356022e0dfc04be1eb6a960282c2", + "after_sha256": "c9b8fd2700738c56c0237f79137f495c4b7f356022e0dfc04be1eb6a960282c2" + }, + { + "path": "streams/http-server-async-local.cpp", + "before_sha256": "1bde71f26f14300d4e94f134e410f9fcfb4bedd08acbc9a8d55576caa84dc1bf", + "after_sha256": "1bde71f26f14300d4e94f134e410f9fcfb4bedd08acbc9a8d55576caa84dc1bf" + }, + { + "path": "streams/websocket-channel.hpp", + "before_sha256": "84cec6f5e9acf4d3f43d3d6e2089609f98be92f2d009fcd264899d8be6435644", + "after_sha256": "84cec6f5e9acf4d3f43d3d6e2089609f98be92f2d009fcd264899d8be6435644" + }, + { + "path": "streams/websocket-client-async-local.cpp", + "before_sha256": "a6319dce6a6a852ecdc2d6b4d53ccf51758d9c24c0d48d3a3abf2bc66e407b6c", + "after_sha256": "a6319dce6a6a852ecdc2d6b4d53ccf51758d9c24c0d48d3a3abf2bc66e407b6c" + }, + { + "path": "streams/websocket-server-async-local.cpp", + "before_sha256": "ad770066e86cf6f8ae5adead9e2933f1fcebacd44e8c0fe019a3c7a577f6eee3", + "after_sha256": "ad770066e86cf6f8ae5adead9e2933f1fcebacd44e8c0fe019a3c7a577f6eee3" + }, + { + "path": "noexcept-native/advanced/server/advanced_server.cpp", + "before_sha256": "a42bcb6a55049037b94cf0aa113ffb9bf9cf9a91f88f6f4fec4badc25d4c5e89", + "after_sha256": "73405cd456be4c593d60f90488f4ffe5fc1230e9f8c4127e5d5d0fe0b3c1834c" + }, + { + "path": "noexcept-native/advanced/server-flex/advanced_server_flex.cpp", + "before_sha256": "96a73e4f5ca797647f2ccebb2b19984aa45e4fd9721abd36de65f2b20629efed", + "after_sha256": "20f33c9bbee2c77d3528800151f7322f068a31ac9d7d752aed1068ce3ad39958" + }, + { + "path": "noexcept-native/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp", + "before_sha256": "d11f968f93f7343f034ba36e934e93e3e411285156e428867562dd11753d8ad2", + "after_sha256": "e3930fbffbd2fb617980bb2a9feb37059fa309f4f3ae3157590e9103ea756469" + }, + { + "path": "noexcept-native/common/root_certificates.hpp", + "before_sha256": "a24e38ab3a38f02fc4ff25d4947599a4315bb7c36f4436818f27754aaa4fb96b", + "after_sha256": "e2d3a7c1b5ba0f2e10bbb74377e0beadecab058137120307b7745a266e19200e" + }, + { + "path": "noexcept-native/common/server_certificate.hpp", + "before_sha256": "0d2e529d60f23ae0c5cd7e47f39619a1e39c82da397eb62830afe681ccd5ad05", + "after_sha256": "f66ce23463f4a5864633ab67308f34946b7b87af0c0af56dd71bff2c9387d1fc" + }, + { + "path": "noexcept-native/doc/http_examples.hpp", + "before_sha256": "24e963eaee89c4cc3e3e0f56783cb5380bf31cde6d25589208dc2d91bf5135dc", + "after_sha256": "26012ab5dac8a116a31acd5cd470d16c583db3dacaad54ac1de130a4ad1cd81e" + }, + { + "path": "noexcept-native/doc/ssl/client.cpp", + "before_sha256": "7927486068a0d667f6a8f15d425c92ccbbcba8bdadaada1577533db019951895", + "after_sha256": "bcecb170eab9c28b27dcd690f8cb0363c52aa23f4e0f9b9958fa9dcd522f46e3" + }, + { + "path": "noexcept-native/doc/ssl/server.cpp", + "before_sha256": "73de0ee720668424bfd760131d4062d8c269caeb863ca6545d8e8b34355a0e6c", + "after_sha256": "adb41392d9f5a4880fac9d46d9eb75755cac24a54cd2045facab151ce8de21a2" + }, + { + "path": "noexcept-native/echo-op/echo_op.cpp", + "before_sha256": "8bd2f2311a59014f4a82a4b9e6315612659881d3b0b700357ac6701d908b295c", + "after_sha256": "22cf8a2181b16344e87fdb32232474472bdf19e966851b79f0d29073520cda7b" + }, + { + "path": "noexcept-native/http/client/async/http_client_async.cpp", + "before_sha256": "e9ec60e2e4355f4107fe8c9811080a4aee2874366ec14a0e79f057ce63da233f", + "after_sha256": "b493dfb29c88dee4d76a56f29e75868995bd3cd85b8c4bb77c582bd909aed856" + }, + { + "path": "noexcept-native/http/client/async-local/http_client_async_local.cpp", + "before_sha256": "1c7d3640e061f4802193db8e9b738da78b95075dc31cde3e28166941d11ae535", + "after_sha256": "c28812b988b3508e9b12d081d186aca77da506038da8e54476a91026aad1a816" + }, + { + "path": "noexcept-native/http/client/async-ssl/http_client_async_ssl.cpp", + "before_sha256": "00ceb4c29c68ab14631d96347ad186995f4ebe53ad0931307861ff7ed7cded46", + "after_sha256": "92e0d0bca9a985044563a2fd15389f6cd9ad42ca6156490805b8beb70ac3b609" + }, + { + "path": "noexcept-native/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp", + "before_sha256": "96605d94fe5db57a08fff61dd7db94810b1db6f1ca78a23585ac8870f4154432", + "after_sha256": "1f2997d07a6ea0f035a27dd6a48d7feedbb5b8b564c174295616556e0aefc361" + }, + { + "path": "noexcept-native/http/client/awaitable/http_client_awaitable.cpp", + "before_sha256": "3c3ab683f5046919ec2e394ff1ac33ba88d55c753bcac1c99d8ae8a8332af06d", + "after_sha256": "c978416e6bec010af43f9b7dc86923ecefbc8343fd8e94366f4a907d3dadcac3" + }, + { + "path": "noexcept-native/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp", + "before_sha256": "b50cfe203081006821586b679c1b5b2479d91134d4eb99beefd7efb2a0eba4c5", + "after_sha256": "e8758a18f68afa094a1cbd5783221bfc03f8ef277bc5ee29bb2a2a8ebd89e330" + }, + { + "path": "noexcept-native/http/client/body/json_body.hpp", + "before_sha256": "9ca8dc6e69eb9147cb71236f13f51a9f2617f7b0ff5be4a247058f109e902dbc", + "after_sha256": "c84940fe6bc256ab6e4b605068ae03e52fd8494651f462d488a43836cd3673f0" + }, + { + "path": "noexcept-native/http/client/body/json_client.cpp", + "before_sha256": "59660785f06cf94bbb59d6601edf4769ffb79f2593cf1318eedf3ad8f5482d1a", + "after_sha256": "96b2e94c1d936ec3991c432b67066ecb0ebe6c088afe47e284e66ddaccd38c58" + }, + { + "path": "noexcept-native/http/client/coro/http_client_coro.cpp", + "before_sha256": "c0464a60ad0f6832d34a8064097e55c13b4cc9c1d65cbbd0fb00c0ff759e3091", + "after_sha256": "20c3a502979e051a4b8f535e0b0aacbc71ee8a42bad1e49f76e508e7fd997e29" + }, + { + "path": "noexcept-native/http/client/coro-ssl/http_client_coro_ssl.cpp", + "before_sha256": "70c6be36fcb9a47ed6b80aeee8217a3479bee68e51d6da49c56f31762d3ec162", + "after_sha256": "62f526f5c8114a8a36d854a8bf1e6a9326ba2934dea02ec83ee50fbd6e8891a2" + }, + { + "path": "noexcept-native/http/client/crawl/http_crawl.cpp", + "before_sha256": "4f71c5a6513f554daae1b3c60be5c303cfb5aaa47dccebb1d088c95680c8cd16", + "after_sha256": "615135e564cd844590510309cbf9e4b5ae4be9e5a94c2e6c040f149b8f51a463" + }, + { + "path": "noexcept-native/http/client/crawl/urls_large_data.cpp", + "before_sha256": "48359a2a9172a5335000e7dc729a479a36e8c05e1893270cde9887f8f6b5d8f6", + "after_sha256": "48359a2a9172a5335000e7dc729a479a36e8c05e1893270cde9887f8f6b5d8f6" + }, + { + "path": "noexcept-native/http/client/crawl/urls_large_data.hpp", + "before_sha256": "c886519f5a4ec555e44046362455e6e96311f3578fc3c0bfb5a5b0978408ea0e", + "after_sha256": "c886519f5a4ec555e44046362455e6e96311f3578fc3c0bfb5a5b0978408ea0e" + }, + { + "path": "noexcept-native/http/client/methods/http_client_methods.cpp", + "before_sha256": "1f30c0a11a0c8fcd3e1b04f1a5211dfa7313331f46d6e6d0f43b44a086ecc03c", + "after_sha256": "c80fc3e55ff9ec580903d4b0e0ff2640c57e44e9998f1eb5b85605fdb0f6e4b6" + }, + { + "path": "noexcept-native/http/client/sync/http_client_sync.cpp", + "before_sha256": "975c026ba99b3ab5d9b79e8293a76c5d2ca459ee9d691f952f7439fabdd71df0", + "after_sha256": "a34bbf78053ac1e722bea290b6c27e440abae14f47b8df8bcb2e240c65773d60" + }, + { + "path": "noexcept-native/http/client/sync-ssl/http_client_sync_ssl.cpp", + "before_sha256": "66686841f6b48dca60687b9d772795047f99b1d9ed01983be69b432a1f8af799", + "after_sha256": "6838094b3d9a8db01b15a0005f3ae4e114ce1a3f3a9d1d2fa81495b6dbee40ef" + }, + { + "path": "noexcept-native/http/server/async/http_server_async.cpp", + "before_sha256": "ac7682dc62ccdfa7bc48a911a295ab225554a5810e0e8ca92bcd3705f4e4c4a8", + "after_sha256": "d99cae070a42b14a0857431fd62562f48ba9b184e2aefb9f7962bf1b70330ccf" + }, + { + "path": "noexcept-native/http/server/async-local/http_server_async_local.cpp", + "before_sha256": "a397c9cb7e2a7d9a8db52a6c61a67dc1369cf6bdd3901a2e8dd4728fcb54a68a", + "after_sha256": "4c6c2346cc951f6e88cf8a44729414bf0f08d55daa51f7ed0d8968f97902dfdc" + }, + { + "path": "noexcept-native/http/server/async-ssl/http_server_async_ssl.cpp", + "before_sha256": "3445ed59f20a708f54838801e0684e6ac730e36e9492a786f316a1337d52f608", + "after_sha256": "b06f78849781fec2d3609c6f116d1d609d28824256ad5d69ec4928b20b08fdae" + }, + { + "path": "noexcept-native/http/server/awaitable/http_server_awaitable.cpp", + "before_sha256": "fe3604315475d563433b5b05772bd1c9df1426c66e62ce8b1d865ee72ae684df", + "after_sha256": "e1e515234d14c51fc3a2f17947cfe97e9074a9028ff0db81f3b058e1508c0836" + }, + { + "path": "noexcept-native/http/server/coro/http_server_coro.cpp", + "before_sha256": "2fc847d19869fc57bbba3b1fb59abb488a6265fb64b2b61f5b6a8ba92dbb8219", + "after_sha256": "981b2482858be27ad537733a66151884010d2f33fddfd8dea12ecaa13a7e714f" + }, + { + "path": "noexcept-native/http/server/coro-ssl/http_server_coro_ssl.cpp", + "before_sha256": "fd69f2b75dc8cf128f1a5b1440113a696c95d232f2f277429458cfe0b62902f5", + "after_sha256": "ce406d6c1000d4a20b008b88ae491240aa30452903f41f8beb0ef550ca03334c" + }, + { + "path": "noexcept-native/http/server/fast/fields_alloc.hpp", + "before_sha256": "208bb4d7655e8b1ab890c444498688d6ab57f27416d12acfed0bb5463b2c3425", + "after_sha256": "208bb4d7655e8b1ab890c444498688d6ab57f27416d12acfed0bb5463b2c3425" + }, + { + "path": "noexcept-native/http/server/fast/http_server_fast.cpp", + "before_sha256": "1975d10dd6d428693255ab407b8638993473f9b80cb317e6f2fae1304a8acf68", + "after_sha256": "e998142fa45e8c55dd69dfae6d95ce004cb5d62a384a68b710a0447debb2f6c6" + }, + { + "path": "noexcept-native/http/server/flex/http_server_flex.cpp", + "before_sha256": "7538826eaac24f424ac867966483dc649ad48f1fb40b97df332c46fac79a2a9b", + "after_sha256": "8407f976cfbecefee4a4bcee383e1d070045fd02ec359f06fb665032e567c876" + }, + { + "path": "noexcept-native/http/server/small/http_server_small.cpp", + "before_sha256": "ec659aedf8f1e6aab70b9afd20445f3e65ab52a8db7e1d88edf26c389a8f6deb", + "after_sha256": "ca12ec0654388544127e875e774baa0bf9b4bff8814d99358de3c499532790a1" + }, + { + "path": "noexcept-native/http/server/stackless/http_server_stackless.cpp", + "before_sha256": "cc67fbc42e524253afdb8e58b2b9f1a52071fbba1b26b2e786db6db06bebb1c2", + "after_sha256": "ce5d47d5bff4494b614de20794f8433a983af4d9b70a7c035b63e0eed10ddc31" + }, + { + "path": "noexcept-native/http/server/stackless-ssl/http_server_stackless_ssl.cpp", + "before_sha256": "8875e6d7116f2d99837a2a8224b6ee7aae1fd425170e27db8de90021f8c8e43b", + "after_sha256": "bcf13179f5268ecdc60109d3cc64b011e57677d44a429991da0ab8eee3ca953e" + }, + { + "path": "noexcept-native/http/server/sync/http_server_sync.cpp", + "before_sha256": "5f6b5ed91ae50984ed09248d2fc21161eadf03daf6561b1431093446be68b0c9", + "after_sha256": "c55371c0534da66fc634a016bd2b02d8c761dacc120f307d805ff47a171f2735" + }, + { + "path": "noexcept-native/http/server/sync-ssl/http_server_sync_ssl.cpp", + "before_sha256": "dee1c4aa3ddf72146f504c2b17ec092cdb7f8b46910019095ce2414a6facd81e", + "after_sha256": "31dd2764201766a4fbcdc5b429c8654975c40eb01d2aff3e7aee2c2855414e29" + }, + { + "path": "noexcept-native/websocket/client/async/websocket_client_async.cpp", + "before_sha256": "68221e807ca9c7cfe111e3dad57a632d7b47137b352bd70129ac755d0199b4dc", + "after_sha256": "afde08e78627aaa348dfc22fd723b35612611890e67283ed8c7d81bb270cd539" + }, + { + "path": "noexcept-native/websocket/client/async-local/websocket_client_async_local.cpp", + "before_sha256": "c441ac8d3855ede727a728970d25b29d2f97bee774f985c2e61c757050a34302", + "after_sha256": "116633d81acf223e2e78d89bc6b91b015b14238868dd7184bca81b5c123fc8b2" + }, + { + "path": "noexcept-native/websocket/client/async-ssl/websocket_client_async_ssl.cpp", + "before_sha256": "8e2f9cc636add18dd890f9d5e49ca465e6601823400a382a41445b8107772808", + "after_sha256": "ef9e8730f13745af96b1300902c81df45c8999d8aedfd2c9f7c0d0dcb6518b6d" + }, + { + "path": "noexcept-native/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp", + "before_sha256": "582cd9fd3414ce56e829dbaaaa09818c18b4823c5cfd4cde15ec0f098508824c", + "after_sha256": "9df828d1306009314659432bb6299b945620b8f2d93bf0ef5df87023f0a5951b" + }, + { + "path": "noexcept-native/websocket/client/awaitable/websocket_client_awaitable.cpp", + "before_sha256": "ab0b4cc1a19ac43d1179fd7b23e296be939fd9094ec554260f1fb56b8bf86e22", + "after_sha256": "f621c53a0a34d1aeec66d824e64566675ec620d1a59b6f982f1b22ef0e8b3595" + }, + { + "path": "noexcept-native/websocket/client/coro/websocket_client_coro.cpp", + "before_sha256": "f10846a3dce955fbee85b735042c566ec0861bd63f4ce941af29404c79e71928", + "after_sha256": "24e991fb699fa3739bd95748bd70ac366b9d4d5a4629d98480ba4853c83546d7" + }, + { + "path": "noexcept-native/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp", + "before_sha256": "c403fe76abe67eb3e467816eabaea6cf57de7fd98e252c62ab729f3e52f1ecf5", + "after_sha256": "61eeb63d59b81aff159dcb932ab1478bb919e1b3033907557c5f95703aa67f28" + }, + { + "path": "noexcept-native/websocket/client/sync/websocket_client_sync.cpp", + "before_sha256": "b8b159c2db6cffb67dadca9168859195c588ba967db97bab46798a3d6baaa2ad", + "after_sha256": "fbf270cfba6b04dcfe31d0a798607c1fdf6f01266476511023639b51914f7df4" + }, + { + "path": "noexcept-native/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp", + "before_sha256": "a8c5c49efc9d47f12b12812777d232011b5aa7b30073e8fc404568bc7ac4dda2", + "after_sha256": "7720f6db365e1809dc60883f27e3997d6933b6451fc457fabfcf47174bc122dd" + }, + { + "path": "noexcept-native/websocket/server/async/websocket_server_async.cpp", + "before_sha256": "23d0f36f1546b7002586339e6a3fce4d586ea4d4a55bf59f14f56575a8e8f354", + "after_sha256": "03a14dfe06bce03cc6a3e81ca2d059ca4ee74808d9f3164d4c3fe92a09a27fb5" + }, + { + "path": "noexcept-native/websocket/server/async-local/websocket_server_async_local.cpp", + "before_sha256": "22d0139dd86ac176e1af66a41e15cfa44daeedc859bae9a1c17dc0088c138837", + "after_sha256": "72c664d9bc5ab8fa508c01947722b89b94cb820f5d59b242bcddf546b3c39d5b" + }, + { + "path": "noexcept-native/websocket/server/async-ssl/websocket_server_async_ssl.cpp", + "before_sha256": "2e3c04b5b7ccabac01d810a029e7aa2d8901c801cafe0c7a49cfecf4bcefc025", + "after_sha256": "aa7328fb93dd23547bffa43f6bec2207a9de5b3349d4932dac02cb402e22e1ba" + }, + { + "path": "noexcept-native/websocket/server/awaitable/websocket_server_awaitable.cpp", + "before_sha256": "7332f2c002eb97b817a04850604f05b82022c596ca39847c499ca2b50c2de217", + "after_sha256": "7c5534c04f4ce399cb911a07f4bd5060e00ba5ccb705e42adef1127ed51e8103" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/beast.hpp", + "before_sha256": "6da27ed5c3faff39b27699c949da85d8b09dc1453d171d578a46d89f314dfc3b", + "after_sha256": "6da27ed5c3faff39b27699c949da85d8b09dc1453d171d578a46d89f314dfc3b" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/http_session.cpp", + "before_sha256": "9f561e5a9ec59a1519e4e99b2239ea91fe507e61232b3db8db688f5feb97aec8", + "after_sha256": "9f561e5a9ec59a1519e4e99b2239ea91fe507e61232b3db8db688f5feb97aec8" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/http_session.hpp", + "before_sha256": "65c5d1643c25b075b15fe1f20b711dc132e1c413a811ebfcb34cf2b73e82fa11", + "after_sha256": "65c5d1643c25b075b15fe1f20b711dc132e1c413a811ebfcb34cf2b73e82fa11" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/listener.cpp", + "before_sha256": "20b6e5dd0592b13eb85ff9267b40acf0a43af7ce9d7722b22bbf7fb5ed0124db", + "after_sha256": "20b6e5dd0592b13eb85ff9267b40acf0a43af7ce9d7722b22bbf7fb5ed0124db" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/listener.hpp", + "before_sha256": "37129b8da66a144f5168ae3a68151270b7df82c70c3e44c07b15602bcc7b490e", + "after_sha256": "37129b8da66a144f5168ae3a68151270b7df82c70c3e44c07b15602bcc7b490e" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/main.cpp", + "before_sha256": "1c1e0ff0cdbb913464092c9a5557b9315103ae0b0495383e722f653dd62be6a6", + "after_sha256": "9e610dfbaaf8171e477d37df3e2ffc32a452cdc7b7326a0aad24d50606021f03" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/net.hpp", + "before_sha256": "42113674e5b1b21ae83142d368b2d758d7a03f65317c13dff594d4440a1113ad", + "after_sha256": "1828fe78d5603c9ea828714530f3ccde7b9bb2c743856f17011afda1c70bbc95" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/shared_state.cpp", + "before_sha256": "c51678efb2c4998f6a24bcab9b0fccb079408d4335515ff73403be1b09bb29d9", + "after_sha256": "c51678efb2c4998f6a24bcab9b0fccb079408d4335515ff73403be1b09bb29d9" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/shared_state.hpp", + "before_sha256": "7bab6dca5f04e8866e7d7837dfe3cafff23a9742cf493d0829ada6ef5c3bfc05", + "after_sha256": "7bab6dca5f04e8866e7d7837dfe3cafff23a9742cf493d0829ada6ef5c3bfc05" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/websocket_session.cpp", + "before_sha256": "490308faae33b072e1424ee8908f2d58b403f72e505992cd9b9caf42c1e9111f", + "after_sha256": "490308faae33b072e1424ee8908f2d58b403f72e505992cd9b9caf42c1e9111f" + }, + { + "path": "noexcept-native/websocket/server/chat-multi/websocket_session.hpp", + "before_sha256": "5ff29a75b795d556cd8b9f1945dffe62065b06327914172a56667a78ab49c35c", + "after_sha256": "5ff29a75b795d556cd8b9f1945dffe62065b06327914172a56667a78ab49c35c" + }, + { + "path": "noexcept-native/websocket/server/coro/websocket_server_coro.cpp", + "before_sha256": "c3702ee079574e91337ca6dc79501ddfede8b8b8605f2a1f431f19213ed994a1", + "after_sha256": "00aff5e735c0813609a28261e950c7b5cf230fd5b1664c5bd13cea34761efdbc" + }, + { + "path": "noexcept-native/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp", + "before_sha256": "5096a25dc295f4685bfba6e9015885fc85dc28962abb3bcf46e8d982fb2600ae", + "after_sha256": "54f8fa68e90127a4eee97d6ca8921bfd8e7132d92eb3b14f910b1992cee0bf5a" + }, + { + "path": "noexcept-native/websocket/server/fast/websocket_server_fast.cpp", + "before_sha256": "611094627a5c9e1429b005684db1f77cf4290366acb33a0740da20a52dfc79f0", + "after_sha256": "b73c5edc536756f89c1b831a6379c089ddcf9e112b6644d93de607f122a5dc36" + }, + { + "path": "noexcept-native/websocket/server/stackless/websocket_server_stackless.cpp", + "before_sha256": "1d82e4999375b38f4bdd4f6c7cfc86c12acd861bb696faef8d8f33cad5bd424f", + "after_sha256": "3e1f61c7b06091b270f4ea57d84893a8348f7c286cb5c107d74e8160e5e18472" + }, + { + "path": "noexcept-native/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp", + "before_sha256": "bb2f1a4777ac8b4abe0fc6d9d9b0f66b8224cd6129e9fed217b8da71d91cb604", + "after_sha256": "700259cc98a7738b0b98361a7fbbd8682b3dc45d1381ae064a5b70bc35d27b24" + }, + { + "path": "noexcept-native/websocket/server/sync/websocket_server_sync.cpp", + "before_sha256": "e2325c2dc2f32c8160ec8f064877806c390a51506fc88ea174a9e60b5574659a", + "after_sha256": "6d5efc98257263b4c584971f0cff1ce0868817308035ecf81e5b9d1f62f3d0fe" + }, + { + "path": "noexcept-native/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp", + "before_sha256": "81932cdf83abce99ed8aeb9c21ebf68b9ee875180b59d49432072f31a634fe6e", + "after_sha256": "70293e8a2e219f1f2f563d3a79ccec675cc31aac71ad3ef1aedebfe743671a66" + }, + { + "path": "noexcept-single/advanced/server/advanced_server.cpp", + "before_sha256": "2638c656d8abdd3972d93e397dee8051f11dea7fb0b3741004c00828d00020bd", + "after_sha256": "4350ca67fb2d70ad96f10ee0f588c2990fbb56469e51fc973114169c2288ba49" + }, + { + "path": "noexcept-single/advanced/server-flex/advanced_server_flex.cpp", + "before_sha256": "6e35aa50ee62a092e2c03b78e08bb0a0a74c66aa873d6eb27ed4ac6bf216e609", + "after_sha256": "79db6a45a63da0e7c2246c0f0bdb73558d7176b826cb28bfaacd9a4ca9c4606f" + }, + { + "path": "noexcept-single/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp", + "before_sha256": "10969cf7bc585cda18152a1119c8decd4e106d428555f1b311a76cc43a415d2b", + "after_sha256": "642c81020ec9b05d527608ab11b08c8f27af9bb477eea91060f52397d09c951d" + }, + { + "path": "noexcept-single/common/root_certificates.hpp", + "before_sha256": "a4fc0f0f2c88ffe13106a1a87a11bd8c5a86584556e844665b3588c26b571f4e", + "after_sha256": "4002e9780bbcf72dda88cb033d6645c7609b71af2e7494d14f5af142e6101263" + }, + { + "path": "noexcept-single/common/server_certificate.hpp", + "before_sha256": "3cd637d03c96ad953b1eee0257e4f5ac3265bbdb4671e2cca317aafe2b88e6f3", + "after_sha256": "f51d61ccb1ede94f3d68f0545953da7eeae23c567a01fb8099f85c21312452e9" + }, + { + "path": "noexcept-single/doc/http_examples.hpp", + "before_sha256": "d42ee00e66b698644f2b0d4ee968c02b455fa4663423cfe876073a2289f72810", + "after_sha256": "947a29a4330133a3fc45f6ab1a53555f3d0056bb773cc6d416841e89e6e85f06" + }, + { + "path": "noexcept-single/doc/ssl/client.cpp", + "before_sha256": "56ee37e2d9471652d8ffbe9e4ae909fd52105c2d95e35b559be4e2711bdbebf8", + "after_sha256": "c262146a2de5f4dca47dc4f48e81d2e9a0ad6b41c3ab814810146b8137e19afb" + }, + { + "path": "noexcept-single/doc/ssl/server.cpp", + "before_sha256": "149c126d385cfe8a0c9613032345da5bdaefc6ae1dd37a705afe70822ea6b9f2", + "after_sha256": "41e872c3840dbbd1cc36156e638f53658c5f0c79afc7def82b2d8e5e99880baf" + }, + { + "path": "noexcept-single/echo-op/echo_op.cpp", + "before_sha256": "1bc0e4e4850484034ba7e66f651ac01a00c67c71dd17b8f5532b7eb7c143dacb", + "after_sha256": "060ee3399249c7fe4f72f4cc9b25a0cd0d2912dd7ff80a89e913a1cd9a680d30" + }, + { + "path": "noexcept-single/http/client/async/http_client_async.cpp", + "before_sha256": "f6e4e71a0d9d3fbce34ce7e80340ba45016bb90e1fc4e2a57a71eca8d371a923", + "after_sha256": "aca11aa48b939c99ef62ad1810fc624381d81e4ade2022ba36916eb6bd4a6487" + }, + { + "path": "noexcept-single/http/client/async-local/http_client_async_local.cpp", + "before_sha256": "60dcc38d56c6bea2e7ea7ad7c895647c5e6ea9df75e2a60627609814c471487d", + "after_sha256": "e3094ed67c5bfe8b77f90d8e578502b9c076f809eb427b4f83e035e50dac6321" + }, + { + "path": "noexcept-single/http/client/async-ssl/http_client_async_ssl.cpp", + "before_sha256": "22493e3becd8f6107cf99aaf24e485768802481d1cded9cfe7ed2b25ffe19b7e", + "after_sha256": "f8037b6aa0dec11b9aeccfa04e42fd1d637bcbc230dc5ecee556006b41913595" + }, + { + "path": "noexcept-single/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp", + "before_sha256": "aa8943d1488fe1f8942e189fa44e6c8e08d87f2e4d165461860c73b44bd785e0", + "after_sha256": "4f792eb44b146b861b48b85c67f21623aa9648f319e7c8490a854e802728d2cf" + }, + { + "path": "noexcept-single/http/client/awaitable/http_client_awaitable.cpp", + "before_sha256": "e51e2bb17f7b025a05ff6495828a9a9a0adae5f85a5cd2b0f276288384b8ee56", + "after_sha256": "3337abdb40d31c904a7b7e98f08d6193fc037dcb5ce6981235e177a458ce716a" + }, + { + "path": "noexcept-single/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp", + "before_sha256": "0b950ca404b311c3f46d84886ef0340bcd1ec3621c5b5e2d11b78ff580958b6f", + "after_sha256": "8e3de8c0d740938bc1c92bac7706a3fb593fcd46b3651cfa6767ea1859bbf2e9" + }, + { + "path": "noexcept-single/http/client/body/json_body.hpp", + "before_sha256": "e0e01d5e5b87df6eb5770e2add7894522fb261a2b117c05f4a64044b3d058bf0", + "after_sha256": "79cc41f3b701db54271f484436c8ab6c95b6fe7e98ddd0f561944f11e3ae47b0" + }, + { + "path": "noexcept-single/http/client/body/json_client.cpp", + "before_sha256": "9957082e7671d8051d925541f4e6b13572b00d199693b46e8e7aa54a855fd77f", + "after_sha256": "b5d5cc8b5b725bd8fe9153a51f7e89371ea86317ee2ec9aa2859c9fe9873e595" + }, + { + "path": "noexcept-single/http/client/coro/http_client_coro.cpp", + "before_sha256": "993c85c5e5991827d4b8d62c8f22c81adbb597a656e3f6d390f7fbbda9dc51b2", + "after_sha256": "74a9b322025c8bc9f06990680f848d1d284ffb7620b8a24ea130d5d104d75f6b" + }, + { + "path": "noexcept-single/http/client/coro-ssl/http_client_coro_ssl.cpp", + "before_sha256": "7f0a5d97f473c7fa4928193b1c5954e7b5b23ea2a157df73d85de45f2d3915c1", + "after_sha256": "d3794d8098220b7488595abab73c5a3f9fbf0eac382b40461c4eba16f04e1dd8" + }, + { + "path": "noexcept-single/http/client/crawl/http_crawl.cpp", + "before_sha256": "f81f54ec5c331e86a2d3682c0e034bbea672053c57ebcacae103ebcd47aa34a2", + "after_sha256": "10cc2c34386c3f0b812fa41bed8143ded1c31fcf37e29a6016776de77e443993" + }, + { + "path": "noexcept-single/http/client/crawl/urls_large_data.cpp", + "before_sha256": "acce8b526b94c2eae8cc4159c8a6e255a2ea39c4c8af3a59bd1dd2babf0ec223", + "after_sha256": "acce8b526b94c2eae8cc4159c8a6e255a2ea39c4c8af3a59bd1dd2babf0ec223" + }, + { + "path": "noexcept-single/http/client/crawl/urls_large_data.hpp", + "before_sha256": "4b2865a159593bc3b88747c7392a8fb0e3d100c881c6e9e157189ce5027c25fe", + "after_sha256": "4b2865a159593bc3b88747c7392a8fb0e3d100c881c6e9e157189ce5027c25fe" + }, + { + "path": "noexcept-single/http/client/methods/http_client_methods.cpp", + "before_sha256": "c3223cd59e3cab11653cb07f99c3c0318e2103a8d5a2590dc5f5b3e83c24dd1c", + "after_sha256": "01e2e3bbb5b1bf1b3e746d4c9a44f4c6f5394b07c47ed9d78504a08939ecb006" + }, + { + "path": "noexcept-single/http/client/sync/http_client_sync.cpp", + "before_sha256": "7a59c14a3af26ba7e9fdff541c04f0a90cc9cac79575aece4d6caf14ae4e20e0", + "after_sha256": "d58c98e985b2cd152f11438059019fa36c01dbbf0931e6d44f47937c3440e935" + }, + { + "path": "noexcept-single/http/client/sync-ssl/http_client_sync_ssl.cpp", + "before_sha256": "d7eddbf0b005d9f87c80ff819260371dab1936f7ffa04666cbe14288ed3279a2", + "after_sha256": "d432c920481008d8ea1183f3c2bb7877377c0a4fec941a3bc0ed3d52f36a78bb" + }, + { + "path": "noexcept-single/http/server/async/http_server_async.cpp", + "before_sha256": "01d55ea4acb57fcb4e1eac9f81de6f6453e627bc009b00bb49ebd7c89d82bcbb", + "after_sha256": "6ac4e7b3fdf4c7c0e345c85754af6e91381dcb9a497ce78c5431752c53854c41" + }, + { + "path": "noexcept-single/http/server/async-local/http_server_async_local.cpp", + "before_sha256": "431a76d58ab7fda37e89a16843eb74c84a82e9fef59527ef13782ef605f96d70", + "after_sha256": "9e24672b08dfd77519eb9b8f3644705ade672e6895281b6f4a76f04ce898d5a1" + }, + { + "path": "noexcept-single/http/server/async-ssl/http_server_async_ssl.cpp", + "before_sha256": "502991b579f1a2b6fd596b2e966df7bd1ce15c32f16199fb3fd83108aeb3ff7c", + "after_sha256": "810377a648679455b0514eec8b67e66b4a2e56dc02baa2c0666d615348107256" + }, + { + "path": "noexcept-single/http/server/awaitable/http_server_awaitable.cpp", + "before_sha256": "6fee4a01374f860434c20fd076dce1ce3e8f74238179237a871e0d736dacac76", + "after_sha256": "c94eef0f65d8dd793bb0099c3d6f1f59370df43fa8793aafb7d7002a5491eede" + }, + { + "path": "noexcept-single/http/server/coro/http_server_coro.cpp", + "before_sha256": "bdda91260cd1222541167c6feba96af5cd56f9dad192d377ae0f0b56e467d3db", + "after_sha256": "651a6f8f198b1ffb60d35d34a3097d1c8d06aad210f862ea102472bda9ab2539" + }, + { + "path": "noexcept-single/http/server/coro-ssl/http_server_coro_ssl.cpp", + "before_sha256": "ab3f5d826f16b95cfac9ade7b1a38fd8cd2d92e3c49c0439abc28e1dd523a829", + "after_sha256": "c8d5af74d78b7afd28e4fe6cfc10cd41f3d7e79b933e9bbf0b5386bb4d46b3a4" + }, + { + "path": "noexcept-single/http/server/fast/fields_alloc.hpp", + "before_sha256": "bb189659162b2aa212ae53daf3d8017d57c812f5b92c0a1f2e52fe2e6e8ba578", + "after_sha256": "bb189659162b2aa212ae53daf3d8017d57c812f5b92c0a1f2e52fe2e6e8ba578" + }, + { + "path": "noexcept-single/http/server/fast/http_server_fast.cpp", + "before_sha256": "d9b0fed0cd1bc50b743adb2b38ac7d1a1029d51f9f973d90b854e18bcd9141bc", + "after_sha256": "170a130b53c45c386a9b759b0c2bbe518a4440a17abcea2c24e2cb8bcee71590" + }, + { + "path": "noexcept-single/http/server/flex/http_server_flex.cpp", + "before_sha256": "ec4cb6a4ae45c5e3c880d8384d4c9824a77e27bfabdf240f374e5606b61d573d", + "after_sha256": "9804020e2793f0643b88360b1b6fc11655f04e5e6b85230f0f03e4fc5ce233f0" + }, + { + "path": "noexcept-single/http/server/small/http_server_small.cpp", + "before_sha256": "b7fcc01f7a0e152b2f32bb02a95cbe1935d22bb5ac8815d4532a109f079a98c4", + "after_sha256": "4e7626797259e5d96a979fb0fd0d7407890e94ee6642261a56453aed0174bda4" + }, + { + "path": "noexcept-single/http/server/stackless/http_server_stackless.cpp", + "before_sha256": "d793e325eaa28119730c21ba612d476680aaa739970535cbc0e1f1328007f2ea", + "after_sha256": "0af827972397ff1eef61a711918244ce8ac4c9ab0fc39b7de51a880714ae270e" + }, + { + "path": "noexcept-single/http/server/stackless-ssl/http_server_stackless_ssl.cpp", + "before_sha256": "d779c318b4512ad136746d38cd2dee7fbec895235141b509f46d043e8cb4b633", + "after_sha256": "0f8591a414a1771bd143f81276e0b46454891c7638d2631117b67e1c9b523edb" + }, + { + "path": "noexcept-single/http/server/sync/http_server_sync.cpp", + "before_sha256": "a3657d144a439421c22dcc322ae6265990edc855a799bc6df4721d6025f858ba", + "after_sha256": "2edfe36c5df8ecae84aebda1ce84e74ccb01da4dda65dba2873fdf042f3dc8b9" + }, + { + "path": "noexcept-single/http/server/sync-ssl/http_server_sync_ssl.cpp", + "before_sha256": "419510146ad8b4d83199ae4cda39db480d513805d6b84c2454fe2646a4fae6f0", + "after_sha256": "cb77c55fdcb9d21a7819672558a4e70053d1956a29158fca25feb82f2a8f3c12" + }, + { + "path": "noexcept-single/websocket/client/async/websocket_client_async.cpp", + "before_sha256": "1478ed8f8754b8032545940e9c2c71ff2670a7d146a17de5f2140263db872eaa", + "after_sha256": "2a11b81efd81330f7d422f2c54f1462532635a02fce26294adaa1a0b8550b1aa" + }, + { + "path": "noexcept-single/websocket/client/async-local/websocket_client_async_local.cpp", + "before_sha256": "30ba06ea4b12ea9828ad24cd9610af5414dacbb5380cd1182f6ab60f29f06656", + "after_sha256": "5b7bf375c0b05885a24067d482bf7c9b81f5f88a7cbe349b60dae6ab454b960f" + }, + { + "path": "noexcept-single/websocket/client/async-ssl/websocket_client_async_ssl.cpp", + "before_sha256": "ec718ab0507e6e8c6516d4feb045ab1c6660aea263cc55960dca60696d2cd2ee", + "after_sha256": "198987b21f2ea8bce1f9583c2fa431a5d4983e10bcd6c7256809edfff79b1dee" + }, + { + "path": "noexcept-single/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp", + "before_sha256": "888817ce2fb0017d95fa99a15eae43e6aa4f73ff0b1c594eb17bce9cac5e1416", + "after_sha256": "db92cbdf243e9662108f9a332d81310476f1a659ac792d6a3c61e6dde27007c3" + }, + { + "path": "noexcept-single/websocket/client/awaitable/websocket_client_awaitable.cpp", + "before_sha256": "8ad26a27041e66a87ccf420304c7bdd6ff31ad06dc2e89cea84007e355bd7757", + "after_sha256": "a6781efbb3d24104e832e3cdc08a7adb0f12f6a9b6b23eade967b451938c8a84" + }, + { + "path": "noexcept-single/websocket/client/coro/websocket_client_coro.cpp", + "before_sha256": "36bd303031c8d527621eb6748e922d5e5bd24b45a4fa139f3ab6b61754eceeb5", + "after_sha256": "16fb8e1e29f1f1a45ed9d6b64b50c9ef3b5bbb77bc47f7b3a3d665c9a876b25d" + }, + { + "path": "noexcept-single/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp", + "before_sha256": "513ef41cb7ad2dbb4056cb9cbddb45e774e9e6d77ee67601ba6a51725d114b88", + "after_sha256": "b98c61783f7dec6822a992007ce9f70f4cf44e102af819b2e322e3ab3e209d26" + }, + { + "path": "noexcept-single/websocket/client/sync/websocket_client_sync.cpp", + "before_sha256": "eb125327a8f5a0d8740099843df7d7267eb94211d0a5df9e57726847032cb7e5", + "after_sha256": "d60a300ce963f78b95d3fb218d6abe79758c31e45e8369ac5208c0fe121a8b58" + }, + { + "path": "noexcept-single/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp", + "before_sha256": "fcbfc95944f9954c75cc8d85eb67b34923495fddfd6784d7bf09cfe5b9a5583c", + "after_sha256": "7280b08348e95af34063b5402858b3b1615c2c0a83d7999d18effa6b4ab9f3bf" + }, + { + "path": "noexcept-single/websocket/server/async/websocket_server_async.cpp", + "before_sha256": "2931cf4e668ff0b3459d85e33d34963c3206e9df11f24a0d9be6f1f55820872f", + "after_sha256": "581161b79936ffab06e96cf1581f7f8235301101c78c5a2389ebf343f640a313" + }, + { + "path": "noexcept-single/websocket/server/async-local/websocket_server_async_local.cpp", + "before_sha256": "7913dac695f37bb448d1a8c4906f01994ee92dc84b0315eca8e7ffa7cc7b8e1c", + "after_sha256": "eac074016d488a6b0c9035b34df256025ed5497224a19b32a7535d40035426e5" + }, + { + "path": "noexcept-single/websocket/server/async-ssl/websocket_server_async_ssl.cpp", + "before_sha256": "56c5cd1079cc7c9a37ebd80ba11013a1bfdb75d7f000fd604548937590821032", + "after_sha256": "3c2542e1b1d04b49794a5a504fdb8f343057a43ef50adf1b1f211f3d7e625961" + }, + { + "path": "noexcept-single/websocket/server/awaitable/websocket_server_awaitable.cpp", + "before_sha256": "7751c99de223d899ff704fc4c2e17908b7908f760f30cbc9423d3a24fd68159a", + "after_sha256": "45e20fbc4762ec149c6f5c21c5bbd85a1b7df49fb116837d0e77565d09c3f094" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/beast.hpp", + "before_sha256": "e1be70db87f5be7c1c11573d69a0d66f02a37fa584976ff5d10f03a46e82ca90", + "after_sha256": "e1be70db87f5be7c1c11573d69a0d66f02a37fa584976ff5d10f03a46e82ca90" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/http_session.cpp", + "before_sha256": "7ab3071a58bed6c48e3d4f6554ee000440a65063ced99fe97b5fe7f192e8c2a3", + "after_sha256": "7ab3071a58bed6c48e3d4f6554ee000440a65063ced99fe97b5fe7f192e8c2a3" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/http_session.hpp", + "before_sha256": "2e1645f49649595ee795edf48ab84ef76b594c5a32d062ce0da6dc5f465875ea", + "after_sha256": "2e1645f49649595ee795edf48ab84ef76b594c5a32d062ce0da6dc5f465875ea" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/listener.cpp", + "before_sha256": "84db0243438576eab6b7fb6eee8098cb88d23f9913ec78292bed7b4509245e5c", + "after_sha256": "84db0243438576eab6b7fb6eee8098cb88d23f9913ec78292bed7b4509245e5c" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/listener.hpp", + "before_sha256": "19b603fbf924716f385208fcb0965d7b123c4ee196fb096e1e834dffc3a445e5", + "after_sha256": "19b603fbf924716f385208fcb0965d7b123c4ee196fb096e1e834dffc3a445e5" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/main.cpp", + "before_sha256": "ab0579f8c95b4dd0f854c7cea63d5f2a51d49e6f7bc65354c5703145ab186382", + "after_sha256": "ab0579f8c95b4dd0f854c7cea63d5f2a51d49e6f7bc65354c5703145ab186382" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/net.hpp", + "before_sha256": "a5aae80e5922d73857e52cff45db47d6ec79cd120a6ccf74d0edbf37864738fb", + "after_sha256": "8eaece949f44a661aa81fdacc747252c8122009b7c9c4c760b07e3b3009fd863" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/shared_state.cpp", + "before_sha256": "f785720d987927527f9c42c5949df6a5444f57cba8940dea132d808f89df9029", + "after_sha256": "f785720d987927527f9c42c5949df6a5444f57cba8940dea132d808f89df9029" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/shared_state.hpp", + "before_sha256": "c104e02d4d0ca625cbdf59d3084c33fd2d5ff1f3e169d2cd8b591fbf348d39d7", + "after_sha256": "c104e02d4d0ca625cbdf59d3084c33fd2d5ff1f3e169d2cd8b591fbf348d39d7" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/websocket_session.cpp", + "before_sha256": "f0cfc11597bb0490b27153b77ddd803ebdc5a97bbfa000090628436762ae0448", + "after_sha256": "f0cfc11597bb0490b27153b77ddd803ebdc5a97bbfa000090628436762ae0448" + }, + { + "path": "noexcept-single/websocket/server/chat-multi/websocket_session.hpp", + "before_sha256": "45166ee5ba2a71d4e205359020d457f4763ad16aae9b02efdef46d82a2de680a", + "after_sha256": "45166ee5ba2a71d4e205359020d457f4763ad16aae9b02efdef46d82a2de680a" + }, + { + "path": "noexcept-single/websocket/server/coro/websocket_server_coro.cpp", + "before_sha256": "801831d7ee540f0584eca08099209038b97c5ba59402eb2a6c734f481be0e591", + "after_sha256": "8443be0d058ea66238aa72aa6de9d616c9491afa199ba9b85602f93d748106fd" + }, + { + "path": "noexcept-single/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp", + "before_sha256": "3bf0516678c3cb6cf12636f86b729da21dc77270753a159b0f48a6714b74565d", + "after_sha256": "83d4b62f60f2265adf6bb6d1f4c7ff7c9bb0fb80cc83f04f67f931cb0a0a40b5" + }, + { + "path": "noexcept-single/websocket/server/fast/websocket_server_fast.cpp", + "before_sha256": "b79670b42b338c0de47e8de52bd64f56afa5741eb5e79359a21b877a76671d2c", + "after_sha256": "d14484f9c9c9b46ac44434dbc3681172849674bedc782332989b6a2b67726005" + }, + { + "path": "noexcept-single/websocket/server/stackless/websocket_server_stackless.cpp", + "before_sha256": "0ed4e93b3b243faeb918ddcb50a70d05e0fa8d5ee88e170bcf335a7e1461823c", + "after_sha256": "5633b914e2c8204cc848d40ac3cc88aa288842d818483d2f3664ccffa6d4beeb" + }, + { + "path": "noexcept-single/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp", + "before_sha256": "b40fbdbddeb3e22c745c708d4fafbeab97b3772f3ff79bb384fcc229b6f67544", + "after_sha256": "2414bb8697628ced5bc775a2235f23690263a6a9d04fca4f1a87c2c117e16877" + }, + { + "path": "noexcept-single/websocket/server/sync/websocket_server_sync.cpp", + "before_sha256": "6cbce0a233c9538ebbfa3b533ec4efa373c9a3022c7d6d32fad50850623ed29a", + "after_sha256": "4fe85b5bd9e8cc409bf19f43c328488d2db444c83dd4b8855ad5e67ed434ff5a" + }, + { + "path": "noexcept-single/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp", + "before_sha256": "da91c8eeb89ac52404af42e101a2b0513db5b044b117b7ae079e69a6c94cd5d8", + "after_sha256": "212206d8f538163fbb239d2554c7735a045db8ee626b73e71259c08cdf71b1a0" + }, + { + "path": "noexcept-browser/http/client/async/http_client_async.cpp", + "before_sha256": "e8be2ac8cd29f7a37583ed40dd70a916abe92dd772d2765503608a663f3b6a6a", + "after_sha256": "1e659cc81cbb3eb1765e5715cb2d17d580ae0fd64dace6a224b514847e9780ac" + }, + { + "path": "noexcept-browser/http/client/async-ssl/http_client_async_ssl.cpp", + "before_sha256": "dc8433a32e1f5a34c39bf7af304d4597064dfd0df014b69a816b7916df2f1e4d", + "after_sha256": "a25d6c48043b19b142df8fc0991a90d4da839e7ec67e7c5a6f1c82f7be03adc5" + }, + { + "path": "noexcept-browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp", + "before_sha256": "778e3396e90e5e547e3dbb90834b9af91174d2b2e93ce1e945c61f3286763d7f", + "after_sha256": "87f71345ded81d8076e9ad73dce5fc95386044aac9b6f6975032779b8caf1dfc" + }, + { + "path": "noexcept-browser/http/client/awaitable/http_client_awaitable.cpp", + "before_sha256": "85e939951133b1df6a21483ac468d4c20f29edc121aeca1959684ef8376e8c07", + "after_sha256": "e66130fa3dfac445c3d6a38bca24561443083feaa8767a8a10b544ebcc69a07e" + }, + { + "path": "noexcept-browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp", + "before_sha256": "5f362b1ba0ad5592914b0901208969e26d1541228551c6fd77f624406c4f143b", + "after_sha256": "3c0d770df08d36b7798337c3290c07c9a9038a01d291ebc9f77d3eb86183162e" + }, + { + "path": "noexcept-browser/http/client/body/json_body.hpp", + "before_sha256": "d6c59ae7a2accea8284a3b893f632fea2fda989dcf4e698c75333ed7a8834e10", + "after_sha256": "48848c51144997d14ee8c0ef2d617dda18f3fed34041138b18cef025eb93e739" + }, + { + "path": "noexcept-browser/http/client/body/json_client.cpp", + "before_sha256": "61caf68abf94b792b04e5617b3e5beb93e9b37362e3c56c190febfe340e71dc8", + "after_sha256": "1204b21c5bca693bfe866fc36750586c8e341e2fcb1ab2df339d5f8dcde96b0a" + }, + { + "path": "noexcept-browser/http/client/crawl/http_crawl.cpp", + "before_sha256": "0abd9055d7ff4093b039eae39e9f0aa6ed24a3b1782043ec46da09f22f1e459a", + "after_sha256": "7d9644e93eb533c08cb197d8315bc3fd6969a980e253fc1b612722e3f22a0c47" + }, + { + "path": "noexcept-browser/http/client/crawl/urls_large_data.cpp", + "before_sha256": "fa6a93c7080518ea0b0cc941eeac0cd8661179a0c8a13b3b3389455736fa0139", + "after_sha256": "73898cbd57e6ece1ac9d214a0cb2b0bb5000d12e1ac2480e2ee10d2d95db01e7" + }, + { + "path": "noexcept-browser/http/client/crawl/urls_large_data.hpp", + "before_sha256": "40f42172d9ff2680e817fc6995cc30a219e9a6e6d7151715abc93d81c54d0b85", + "after_sha256": "d4ab3230d4b67b67c95a0852de262ca8b5e7736d57baed362a175c2c46b70207" + }, + { + "path": "noexcept-browser/http/client/methods/http_client_methods.cpp", + "before_sha256": "c7c2370f30f75a0bda4b6a38b3a47f49e2d3826a53f70c3eeccc64f3ad2a226b", + "after_sha256": "3fe2f1af5c2e69464ffc61c6d65576cc4846b8347a86ca8296fe8b0e52800c9a" + }, + { + "path": "noexcept-browser/http/client/sync/http_client_sync.cpp", + "before_sha256": "794c91db19a43e17d3a8cb2cbe7cc6ebe9d2ca80c7519733227d1948aecaa19b", + "after_sha256": "6c7c8064d40999136801f11b270de7225e0e4c1405433b71a34e306e12357d8e" + }, + { + "path": "noexcept-browser/http/client/sync-ssl/http_client_sync_ssl.cpp", + "before_sha256": "383bc6bf5576ed464c58064f6a819acd8800aa0c89d529fd42a14188d322b9d3", + "after_sha256": "79b462fa4ffbd12cbf87f9eb69864471726b434a1247b200ef72e91e861fc57f" + }, + { + "path": "noexcept-browser/websocket/client/async/websocket_client_async.cpp", + "before_sha256": "3143231d34ee72200e252a60e698ba03880ed3aa48252214a7fcb1544bfcf7d6", + "after_sha256": "e7613412161ac93c0c7a1533bbf4ed00e9dac94c9b47e7e306692b18d95cb05f" + }, + { + "path": "noexcept-browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp", + "before_sha256": "a0869933a0373fb2f59646d9d41f940e78c5d09ddf7470252f6b92ad6da93f47", + "after_sha256": "7f79aa45c5f31c2b24ab6099c199eda43a891b262e9859e9346a4ca58c1fc3fc" + }, + { + "path": "noexcept-browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp", + "before_sha256": "8b46c191bee7170723f3e575eb2dd8d65e87de4cd3cf169eccf5c19637e1d76f", + "after_sha256": "8a98b79531501303c5390aa8354590db3749996b9bd910517b8f38c827084eec" + }, + { + "path": "noexcept-browser/websocket/client/awaitable/websocket_client_awaitable.cpp", + "before_sha256": "962a2311386c72bbe765bd7bf93ffbcac7ab8271997d15edf79653e7391e176f", + "after_sha256": "3351a067598ef5889fc1a8764b756649442b12ea5ffb49ebb1987df78613e8df" + }, + { + "path": "noexcept-browser/websocket/client/sync/websocket_client_sync.cpp", + "before_sha256": "cb69b0f4cb671154407582c57731c6091c0a6b8be2660d0c0c06967aaa9235d8", + "after_sha256": "42c61ae65929e82440cd28c54f456344a20b7343aefba3824e1ed84cd218dab6" + }, + { + "path": "noexcept-browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp", + "before_sha256": "d4b3a089cbe4df99d71fc47a4910dcc180987bfc8be303e1dc2bd0b62a570adf", + "after_sha256": "1a54607baf0d7ef3b208c8517e76e94a3885fec4ec7ac23a78e756967b579712" + } + ] +} diff --git a/example/applications/browser.patch b/example/applications/browser.patch index 48300e1..b5a8883 100644 --- a/example/applications/browser.patch +++ b/example/applications/browser.patch @@ -289,7 +289,7 @@ return EXIT_FAILURE; } auto const host = argv[1]; -@@ -236,23 +195,49 @@ +@@ -236,23 +195,53 @@ auto const target = argv[3]; int version = argc == 5 && !std::strcmp("1.0", argv[4]) ? 10 : 11; @@ -325,10 +325,14 @@ + +int main() { + const auto port = emscripten::val::global("beastSecurePort").as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "localhost", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { -+ std::vector storage{"http-client-async-ssl-system-executor", "127.0.0.1", port, ++ std::vector storage{"http-client-async-ssl-system-executor", "localhost", port, + "/http"}; + std::vector arguments; + for (auto& value : storage) @@ -642,7 +646,7 @@ // Verify the remote server's certificate ctx.set_verify_mode(ssl::verify_peer); -@@ -243,14 +202,36 @@ +@@ -243,14 +202,40 @@ // Launch the asynchronous operation // The session is constructed with a strand to // ensure that handlers do not execute concurrently. @@ -666,10 +670,14 @@ + +int main() { + const auto port = emscripten::val::global("beastSecurePort").as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "localhost", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { -+ std::vector storage{"http-client-async-ssl", "127.0.0.1", port, "/http"}; ++ std::vector storage{"http-client-async-ssl", "localhost", port, "/http"}; + std::vector arguments; + for (auto& value : storage) + arguments.push_back(value.data()); @@ -903,7 +911,7 @@ return EXIT_FAILURE; } auto const host = argv[1]; -@@ -176,14 +153,39 @@ +@@ -176,14 +153,43 @@ int version = argc == 5 && !std::strcmp("1.0", argv[4]) ? 10 : 11; // The io_context is required for all I/O @@ -927,8 +935,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { + std::vector storage{"http-client-async", "127.0.0.1", port, "/http"}; + std::vector arguments; @@ -1170,19 +1182,19 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -188,11 +182,34 @@ +@@ -187,12 +181,35 @@ + } #else - +- -int -main(int, char*[]) -{ -+int application_main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } - - #endif +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; ++#error "This application requires its declared Asio backend" ++ ++#endif + +#include +#include @@ -1190,10 +1202,14 @@ + +int main() { + const auto port = emscripten::val::global("beastSecurePort").as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "localhost", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { -+ std::vector storage{"http-client-awaitable-ssl", "127.0.0.1", port, "/http"}; ++ std::vector storage{"http-client-awaitable-ssl", "localhost", port, "/http"}; + std::vector arguments; + for (auto& value : storage) + arguments.push_back(value.data()); @@ -1207,7 +1223,9 @@ + } + std::cout << "application http-client-awaitable-ssl: passed\n"; + return 0; -+} + } +- +-#endif --- upstream/http/client/awaitable/http_client_awaitable.cpp +++ browser/http/client/awaitable/http_client_awaitable.cpp @@ -1,3 +1,20 @@ @@ -1383,17 +1401,18 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -135,11 +141,34 @@ +@@ -134,12 +140,35 @@ + } #else - +- -int -main(int, char*[]) -{ -+int application_main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" #endif + @@ -1403,8 +1422,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { + std::vector storage{"http-client-awaitable", "127.0.0.1", port, "/http"}; + std::vector arguments; @@ -1656,7 +1679,7 @@ // This buffer is used for reading and must be persisted beast::flat_buffer buffer; -@@ -56,6 +72,30 @@ +@@ -56,6 +72,34 @@ beast::error_code ec; stream.socket().shutdown(tcp::socket::shutdown_both, ec); @@ -1670,8 +1693,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { + std::vector storage{"json_client"}; + std::vector arguments; @@ -2080,7 +2107,7 @@ using clock_type = chrono::system_clock; clock_type::time_point when_; -@@ -327,79 +257,60 @@ +@@ -327,79 +257,64 @@ public: using duration = clock_type::duration; @@ -2182,8 +2209,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { + std::vector storage{"http-crawl", "2"}; + std::vector arguments; @@ -12540,7 +12571,7 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -223,3 +212,28 @@ +@@ -223,3 +212,32 @@ } //] @@ -12551,8 +12582,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + for (const auto* method : {"get", "head", "post", "put", "patch", "delete"}) { + std::vector storage{"http-client-methods", method}; + std::vector arguments; @@ -12691,7 +12726,7 @@ // Send the HTTP request to the remote host http::write(stream, req); -@@ -127,13 +134,36 @@ +@@ -127,13 +134,40 @@ // Therefore, if we see a short read here, it has occurred // after the message has been completed, so it is safe to ignore it. @@ -12714,10 +12749,14 @@ + +int main() { + const auto port = emscripten::val::global("beastSecurePort").as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "localhost", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { -+ std::vector storage{"http-client-sync-ssl", "127.0.0.1", port, "/http"}; ++ std::vector storage{"http-client-sync-ssl", "localhost", port, "/http"}; + std::vector arguments; + for (auto& value : storage) + arguments.push_back(value.data()); @@ -12840,7 +12879,7 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -103,3 +114,28 @@ +@@ -103,3 +114,32 @@ } //] @@ -12851,8 +12890,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { + std::vector storage{"http-client-sync", "127.0.0.1", port, "/http"}; + std::vector arguments; @@ -13165,7 +13208,7 @@ return fail(ec, "close"); // If we get here then the connection is closed gracefully -@@ -236,38 +186,61 @@ +@@ -236,38 +186,65 @@ //------------------------------------------------------------------------------ @@ -13221,10 +13264,14 @@ + +int main() { + const auto port = emscripten::val::global("beastSecurePort").as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "localhost", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { -+ std::vector storage{"websocket-client-async-ssl-system-executor", "127.0.0.1", ++ std::vector storage{"websocket-client-async-ssl-system-executor", "localhost", + port, "Beast fixture echo"}; + std::vector arguments; + for (auto& value : storage) @@ -13554,7 +13601,7 @@ return EXIT_FAILURE; } auto const host = argv[1]; -@@ -244,23 +192,49 @@ +@@ -244,23 +192,53 @@ auto const text = argv[3]; // The io_context is required for all I/O @@ -13589,10 +13636,14 @@ + +int main() { + const auto port = emscripten::val::global("beastSecurePort").as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "localhost", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { -+ std::vector storage{"websocket-client-async-ssl", "127.0.0.1", port, ++ std::vector storage{"websocket-client-async-ssl", "localhost", port, + "Beast fixture echo"}; + std::vector arguments; + for (auto& value : storage) @@ -13879,7 +13930,7 @@ return EXIT_FAILURE; } auto const host = argv[1]; -@@ -210,14 +170,40 @@ +@@ -210,14 +170,44 @@ auto const text = argv[3]; // The io_context is required for all I/O @@ -13903,8 +13954,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { + std::vector storage{"websocket-client-async", "127.0.0.1", port, + "Beast fixture echo"}; @@ -14090,17 +14145,18 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -138,11 +135,35 @@ +@@ -137,12 +134,36 @@ + } #else - +- -int -main(int, char*[]) -{ -+int application_main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" #endif + @@ -14110,8 +14166,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { + std::vector storage{"websocket-client-awaitable", "127.0.0.1", port, + "Beast fixture echo"}; @@ -14266,7 +14326,7 @@ // Perform the websocket handshake ws.handshake(host, "/"); -@@ -119,11 +121,35 @@ +@@ -119,11 +121,39 @@ // The make_printable() function helps print a ConstBufferSequence std::cout << beast::make_printable(buffer.data()) << std::endl; @@ -14286,10 +14346,14 @@ + +int main() { + const auto port = emscripten::val::global("beastSecurePort").as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "localhost", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { -+ std::vector storage{"websocket-client-sync-ssl", "127.0.0.1", port, ++ std::vector storage{"websocket-client-sync-ssl", "localhost", port, + "Beast fixture echo"}; + std::vector arguments; + for (auto& value : storage) @@ -14425,7 +14489,7 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -103,3 +109,29 @@ +@@ -103,3 +109,33 @@ } //] @@ -14436,8 +14500,12 @@ + +int main() { + const auto port = emscripten::val::global("location")["port"].as(); -+ setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1); -+ setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1); ++ if (setenv("WEBCPP_BEAST_FIXTURE_HOST", "127.0.0.1", 1) != 0) { ++ return 1; ++ } ++ if (setenv("WEBCPP_BEAST_FIXTURE_PORT", port.c_str(), 1) != 0) { ++ return 1; ++ } + { + std::vector storage{"websocket-client-sync", "127.0.0.1", port, + "Beast fixture echo"}; diff --git a/example/applications/browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp b/example/applications/browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp index f2c97b0..776a9b9 100644 --- a/example/applications/browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp +++ b/example/applications/browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -31,19 +31,19 @@ // //------------------------------------------------------------------------------ -#include -#include #include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -65,14 +65,14 @@ class session : public std::enable_shared_from_this { // ensure that handlers do not execute concurrently. // Value parameters retain the upstream callback and coroutine ownership contract. // NOLINTNEXTLINE(performance-unnecessary-value-param) - session(net::strand strand, ssl::context& ctx) + session(net::strand strand, ssl::context& ctx) : resolver_(strand), stream_(strand, ctx) {} public: // Delegate construction to a prive constructor to be able to use // the same strand for both I/O object. explicit session(webcpp::asio::io_context& ioc, ssl::context& ctx) - : session(net::make_strand(boost::asio::any_io_executor(ioc.get_executor())), ctx) {} + : session(net::make_strand(webcpp::asio::any_io_executor(ioc.get_executor())), ctx) {} // Start the asynchronous operation void run(char const* host, char const* port, char const* target, int version) { diff --git a/example/applications/browser/http/client/async-ssl/http_client_async_ssl.cpp b/example/applications/browser/http/client/async-ssl/http_client_async_ssl.cpp index 384180d..219b5b2 100644 --- a/example/applications/browser/http/client/async-ssl/http_client_async_ssl.cpp +++ b/example/applications/browser/http/client/async-ssl/http_client_async_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -31,18 +31,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/browser/http/client/async/http_client_async.cpp b/example/applications/browser/http/client/async/http_client_async.cpp index e5c051e..ffe4031 100644 --- a/example/applications/browser/http/client/async/http_client_async.cpp +++ b/example/applications/browser/http/client/async/http_client_async.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -30,18 +30,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp b/example/applications/browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp index f68e309..a0d0a52 100644 --- a/example/applications/browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp +++ b/example/applications/browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -31,10 +31,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -46,7 +46,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = webcpp::asio::ssl; //------------------------------------------------------------------------------ diff --git a/example/applications/browser/http/client/awaitable/http_client_awaitable.cpp b/example/applications/browser/http/client/awaitable/http_client_awaitable.cpp index 838a5b9..339a5f6 100644 --- a/example/applications/browser/http/client/awaitable/http_client_awaitable.cpp +++ b/example/applications/browser/http/client/awaitable/http_client_awaitable.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -30,9 +30,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -43,7 +43,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/browser/http/client/body/json_body.hpp b/example/applications/browser/http/client/body/json_body.hpp index 72165e5..40891fb 100644 --- a/example/applications/browser/http/client/body/json_body.hpp +++ b/example/applications/browser/http/client/body/json_body.hpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -34,10 +34,10 @@ #define BOOST_BEAST_EXAMPLE_JSON_BODY #include -#include #include #include #include +#include #include namespace json = boost::json; @@ -46,7 +46,7 @@ struct json_body { using value_type = json::value; struct writer { - using const_buffers_type = boost::asio::const_buffer; + using const_buffers_type = webcpp::asio::const_buffer; template writer(webcpp::beast::http::header const& /*unused*/, @@ -66,7 +66,7 @@ struct json_body { ec = {}; // We serialize as much as we can with the buffer. Often that'll suffice const auto len = serializer_.read(buffer_.data(), buffer_.size()); - return std::make_pair(boost::asio::const_buffer(len.data(), len.size()), + return std::make_pair(webcpp::asio::const_buffer(len.data(), len.size()), !serializer_.done()); } diff --git a/example/applications/browser/http/client/body/json_client.cpp b/example/applications/browser/http/client/body/json_client.cpp index 7cee5fd..8771864 100644 --- a/example/applications/browser/http/client/body/json_client.cpp +++ b/example/applications/browser/http/client/body/json_client.cpp @@ -7,10 +7,10 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include #include +#include #include #include #include @@ -23,8 +23,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using webcpp::asio::ip::tcp; // from +// from +using webcpp::asio::ip::tcp; // from namespace { int application_main(int /*unused*/, char** /*unused*/) { diff --git a/example/applications/browser/http/client/crawl/http_crawl.cpp b/example/applications/browser/http/client/crawl/http_crawl.cpp index bcbc525..bc71fd7 100644 --- a/example/applications/browser/http/client/crawl/http_crawl.cpp +++ b/example/applications/browser/http/client/crawl/http_crawl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -33,11 +33,6 @@ #include "urls_large_data.hpp" #include -#include -#include -#include -#include -#include #include #include #include @@ -45,6 +40,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -53,8 +53,8 @@ namespace chrono = std::chrono; // from namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/browser/http/client/crawl/urls_large_data.cpp b/example/applications/browser/http/client/crawl/urls_large_data.cpp index 3abd545..ca90890 100644 --- a/example/applications/browser/http/client/crawl/urls_large_data.cpp +++ b/example/applications/browser/http/client/crawl/urls_large_data.cpp @@ -8,10 +8,10 @@ // Upstream authors and their original notice follow. #include "urls_large_data.hpp" -#include #include #include #include +#include #include #include #include diff --git a/example/applications/browser/http/client/crawl/urls_large_data.hpp b/example/applications/browser/http/client/crawl/urls_large_data.hpp index 1cca132..e93c8f6 100644 --- a/example/applications/browser/http/client/crawl/urls_large_data.hpp +++ b/example/applications/browser/http/client/crawl/urls_large_data.hpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include diff --git a/example/applications/browser/http/client/methods/http_client_methods.cpp b/example/applications/browser/http/client/methods/http_client_methods.cpp index ebac4d5..4c9bce5 100644 --- a/example/applications/browser/http/client/methods/http_client_methods.cpp +++ b/example/applications/browser/http/client/methods/http_client_methods.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -33,17 +33,17 @@ //[example_http_client_methods -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using webcpp::asio::ip::tcp; // from +// from +using webcpp::asio::ip::tcp; // from // perform a get request namespace { diff --git a/example/applications/browser/http/client/sync-ssl/http_client_sync_ssl.cpp b/example/applications/browser/http/client/sync-ssl/http_client_sync_ssl.cpp index db0085d..08263f1 100644 --- a/example/applications/browser/http/client/sync-ssl/http_client_sync_ssl.cpp +++ b/example/applications/browser/http/client/sync-ssl/http_client_sync_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -31,18 +31,18 @@ // //------------------------------------------------------------------------------ -#include -#include #include #include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +// from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/browser/http/client/sync/http_client_sync.cpp b/example/applications/browser/http/client/sync/http_client_sync.cpp index 0cff7ff..8678869 100644 --- a/example/applications/browser/http/client/sync/http_client_sync.cpp +++ b/example/applications/browser/http/client/sync/http_client_sync.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -32,17 +32,17 @@ //[example_http_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using webcpp::asio::ip::tcp; // from +// from +using webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp b/example/applications/browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp index 19cf053..392728e 100644 --- a/example/applications/browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp +++ b/example/applications/browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -34,20 +34,20 @@ #include -#include -#include #include #include #include #include #include +#include +#include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -69,14 +69,14 @@ class session : public std::enable_shared_from_this { // ensure that handlers do not execute concurrently. // Value parameters retain the upstream callback and coroutine ownership contract. // NOLINTNEXTLINE(performance-unnecessary-value-param) - session(net::strand ex, ssl::context& ctx) + session(net::strand ex, ssl::context& ctx) : resolver_(ex), ws_(ex, ctx) {} public: // Delegate construction to a prive constructor to be able to use // the same strand for both I/O objects. explicit session(webcpp::asio::io_context& ioc, ssl::context& ctx) - : session(net::make_strand(boost::asio::any_io_executor(ioc.get_executor())), ctx) {} + : session(net::make_strand(webcpp::asio::any_io_executor(ioc.get_executor())), ctx) {} // Start the asynchronous operation void run(char const* host, char const* port, char const* text) { diff --git a/example/applications/browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp b/example/applications/browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp index c917ba3..4bc2b53 100644 --- a/example/applications/browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp +++ b/example/applications/browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -34,19 +34,19 @@ #include -#include #include #include #include #include #include +#include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/browser/websocket/client/async/websocket_client_async.cpp b/example/applications/browser/websocket/client/async/websocket_client_async.cpp index e6fbf07..e179e4d 100644 --- a/example/applications/browser/websocket/client/async/websocket_client_async.cpp +++ b/example/applications/browser/websocket/client/async/websocket_client_async.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -31,19 +31,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/browser/websocket/client/awaitable/websocket_client_awaitable.cpp b/example/applications/browser/websocket/client/awaitable/websocket_client_awaitable.cpp index f2c31b8..26ed0ec 100644 --- a/example/applications/browser/websocket/client/awaitable/websocket_client_awaitable.cpp +++ b/example/applications/browser/websocket/client/awaitable/websocket_client_awaitable.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -31,9 +31,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -44,7 +44,7 @@ namespace beast = webcpp::beast; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp b/example/applications/browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp index 05a5d24..37819ca 100644 --- a/example/applications/browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp +++ b/example/applications/browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -34,19 +34,19 @@ #include -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/browser/websocket/client/sync/websocket_client_sync.cpp b/example/applications/browser/websocket/client/sync/websocket_client_sync.cpp index e01fe28..63e2d8e 100644 --- a/example/applications/browser/websocket/client/sync/websocket_client_sync.cpp +++ b/example/applications/browser/websocket/client/sync/websocket_client_sync.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -33,18 +33,18 @@ //[example_websocket_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/fixture_resolver.hpp b/example/applications/fixture_resolver.hpp index c9ad7c6..6873aa9 100644 --- a/example/applications/fixture_resolver.hpp +++ b/example/applications/fixture_resolver.hpp @@ -7,22 +7,22 @@ #ifndef WEBCPP_BEAST_APPLICATION_FIXTURE_RESOLVER_HPP #define WEBCPP_BEAST_APPLICATION_FIXTURE_RESOLVER_HPP -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include +#include namespace webcpp_fixture { // The application's DNS dependency is explicit: this fixture only resolves its local peer. // It does not claim WASI provides an asynchronous DNS worker or a system executor. class resolver { public: - using executor_type = boost::asio::any_io_executor; - using results_type = boost::asio::ip::basic_resolver_results; + using executor_type = webcpp::asio::any_io_executor; + using results_type = webcpp::asio::ip::basic_resolver_results; explicit resolver(executor_type executor) : executor_(std::move(executor)) {} @@ -35,24 +35,24 @@ class resolver { static results_type resolve(std::string_view host, std::string_view port, boost::system::error_code& ec) { if (host != "localhost" && host != "127.0.0.1") { - ec = boost::asio::error::host_not_found; + ec = webcpp::asio::error::host_not_found; return {}; } unsigned value = 0; for (const char digit : port) { if (digit < '0' || digit > '9' || value > 6553) { - ec = boost::asio::error::service_not_found; + ec = webcpp::asio::error::service_not_found; return {}; } value = (value * 10) + static_cast(digit - '0'); } if (port.empty() || value > 65535) { - ec = boost::asio::error::service_not_found; + ec = webcpp::asio::error::service_not_found; return {}; } ec.clear(); return results_type::create( - {boost::asio::ip::address_v4::loopback(), static_cast(value)}, + {webcpp::asio::ip::address_v4::loopback(), static_cast(value)}, std::string(host), std::string(port)); } @@ -65,16 +65,16 @@ class resolver { return result; } - template > + template > auto async_resolve(std::string_view host, std::string_view port, Token&& token = {}) { - return boost::asio::async_initiate( + return webcpp::asio::async_initiate( // Value parameters retain the upstream callback and coroutine ownership contract. // NOLINTNEXTLINE(performance-unnecessary-value-param) [this](auto handler, std::string name, std::string service) { boost::system::error_code ec; auto result = resolve(name, service, ec); - boost::asio::post(executor_, - boost::asio::append(std::move(handler), ec, std::move(result))); + webcpp::asio::post(executor_, + webcpp::asio::append(std::move(handler), ec, std::move(result))); }, token, std::string(host), std::string(port)); } diff --git a/example/applications/host-clients/json_body.hpp b/example/applications/host-clients/json_body.hpp index d62ec9d..aac4412 100644 --- a/example/applications/host-clients/json_body.hpp +++ b/example/applications/host-clients/json_body.hpp @@ -26,10 +26,10 @@ #define BOOST_BEAST_EXAMPLE_JSON_BODY #include -#include #include #include #include +#include #include namespace json = boost::json; @@ -38,10 +38,10 @@ struct json_body { using value_type = json::value; struct writer { - using const_buffers_type = boost::asio::const_buffer; + using const_buffers_type = webcpp::asio::const_buffer; template - writer(boost::beast::http::header const& /*unused*/, + writer(webcpp::beast::http::header const& /*unused*/, value_type const& body) { // The serializer holds a pointer to the value, so all we need to do is to reset it. serializer_.reset(&body); @@ -58,7 +58,7 @@ struct json_body { ec = {}; // We serialize as much as we can with the buffer. Often that'll suffice const auto len = serializer_.read(buffer_.data(), buffer_.size()); - return std::make_pair(boost::asio::const_buffer(len.data(), len.size()), + return std::make_pair(webcpp::asio::const_buffer(len.data(), len.size()), !serializer_.done()); } @@ -70,7 +70,7 @@ struct json_body { struct reader { template - reader(boost::beast::http::header& /*unused*/, value_type& body) + reader(webcpp::beast::http::header& /*unused*/, value_type& body) : body_(body) {} void init(boost::optional const& content_length, diff --git a/example/applications/noexcept-browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp b/example/applications/noexcept-browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp index 0be86b0..3b63a41 100644 --- a/example/applications/noexcept-browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp +++ b/example/applications/noexcept-browser/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -32,19 +32,19 @@ // //------------------------------------------------------------------------------ -#include -#include #include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -66,14 +66,14 @@ class session : public std::enable_shared_from_this { // ensure that handlers do not execute concurrently. // Value parameters retain the upstream callback and coroutine ownership contract. // NOLINTNEXTLINE(performance-unnecessary-value-param) - session(net::strand strand, ssl::context& ctx) + session(net::strand strand, ssl::context& ctx) : resolver_(strand), stream_(strand, ctx) {} public: // Delegate construction to a prive constructor to be able to use // the same strand for both I/O object. explicit session(webcpp::asio::io_context& ioc, ssl::context& ctx) - : session(net::make_strand(boost::asio::any_io_executor(ioc.get_executor())), ctx) {} + : session(net::make_strand(webcpp::asio::any_io_executor(ioc.get_executor())), ctx) {} // Start the asynchronous operation void run(char const* host, char const* port, char const* target, int version) { diff --git a/example/applications/noexcept-browser/http/client/async-ssl/http_client_async_ssl.cpp b/example/applications/noexcept-browser/http/client/async-ssl/http_client_async_ssl.cpp index 1d7718d..10636c3 100644 --- a/example/applications/noexcept-browser/http/client/async-ssl/http_client_async_ssl.cpp +++ b/example/applications/noexcept-browser/http/client/async-ssl/http_client_async_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -32,18 +32,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-browser/http/client/async/http_client_async.cpp b/example/applications/noexcept-browser/http/client/async/http_client_async.cpp index 5e1d6f1..554dc8f 100644 --- a/example/applications/noexcept-browser/http/client/async/http_client_async.cpp +++ b/example/applications/noexcept-browser/http/client/async/http_client_async.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -31,18 +31,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp b/example/applications/noexcept-browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp index d67b78d..d93edba 100644 --- a/example/applications/noexcept-browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp +++ b/example/applications/noexcept-browser/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -32,10 +32,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -47,7 +47,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = webcpp::asio::ssl; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-browser/http/client/awaitable/http_client_awaitable.cpp b/example/applications/noexcept-browser/http/client/awaitable/http_client_awaitable.cpp index 7141d2b..a0e5b3e 100644 --- a/example/applications/noexcept-browser/http/client/awaitable/http_client_awaitable.cpp +++ b/example/applications/noexcept-browser/http/client/awaitable/http_client_awaitable.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -31,9 +31,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -44,7 +44,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/noexcept-browser/http/client/body/json_body.hpp b/example/applications/noexcept-browser/http/client/body/json_body.hpp index 2bfab8b..8d372f9 100644 --- a/example/applications/noexcept-browser/http/client/body/json_body.hpp +++ b/example/applications/noexcept-browser/http/client/body/json_body.hpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -35,10 +35,10 @@ #define BOOST_BEAST_EXAMPLE_JSON_BODY #include -#include #include #include #include +#include #include namespace json = boost::json; @@ -47,7 +47,7 @@ struct json_body { using value_type = json::value; struct writer { - using const_buffers_type = boost::asio::const_buffer; + using const_buffers_type = webcpp::asio::const_buffer; template writer(webcpp::beast::http::header const& /*unused*/, @@ -67,7 +67,7 @@ struct json_body { ec = {}; // We serialize as much as we can with the buffer. Often that'll suffice const auto len = serializer_.read(buffer_.data(), buffer_.size()); - return std::make_pair(boost::asio::const_buffer(len.data(), len.size()), + return std::make_pair(webcpp::asio::const_buffer(len.data(), len.size()), !serializer_.done()); } diff --git a/example/applications/noexcept-browser/http/client/body/json_client.cpp b/example/applications/noexcept-browser/http/client/body/json_client.cpp index 5e8d08d..cf2dac9 100644 --- a/example/applications/noexcept-browser/http/client/body/json_client.cpp +++ b/example/applications/noexcept-browser/http/client/body/json_client.cpp @@ -7,10 +7,10 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include #include +#include #include #include #include @@ -24,8 +24,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using webcpp::asio::ip::tcp; // from +// from +using webcpp::asio::ip::tcp; // from namespace { int application_main(int /*unused*/, char** /*unused*/) { diff --git a/example/applications/noexcept-browser/http/client/crawl/http_crawl.cpp b/example/applications/noexcept-browser/http/client/crawl/http_crawl.cpp index 19079e8..bbe6cdc 100644 --- a/example/applications/noexcept-browser/http/client/crawl/http_crawl.cpp +++ b/example/applications/noexcept-browser/http/client/crawl/http_crawl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -34,11 +34,6 @@ #include "urls_large_data.hpp" #include -#include -#include -#include -#include -#include #include #include #include @@ -46,6 +41,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -54,8 +54,8 @@ namespace chrono = std::chrono; // from namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-browser/http/client/crawl/urls_large_data.cpp b/example/applications/noexcept-browser/http/client/crawl/urls_large_data.cpp index 969d6db..77fa9e9 100644 --- a/example/applications/noexcept-browser/http/client/crawl/urls_large_data.cpp +++ b/example/applications/noexcept-browser/http/client/crawl/urls_large_data.cpp @@ -8,10 +8,10 @@ // Upstream authors and their original notice follow. #include "urls_large_data.hpp" -#include #include #include #include +#include #include #include #include diff --git a/example/applications/noexcept-browser/http/client/crawl/urls_large_data.hpp b/example/applications/noexcept-browser/http/client/crawl/urls_large_data.hpp index b0ad468..5932f24 100644 --- a/example/applications/noexcept-browser/http/client/crawl/urls_large_data.hpp +++ b/example/applications/noexcept-browser/http/client/crawl/urls_large_data.hpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include diff --git a/example/applications/noexcept-browser/http/client/methods/http_client_methods.cpp b/example/applications/noexcept-browser/http/client/methods/http_client_methods.cpp index 3776676..c800e1e 100644 --- a/example/applications/noexcept-browser/http/client/methods/http_client_methods.cpp +++ b/example/applications/noexcept-browser/http/client/methods/http_client_methods.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -34,17 +34,17 @@ //[example_http_client_methods -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using webcpp::asio::ip::tcp; // from +// from +using webcpp::asio::ip::tcp; // from // perform a get request namespace { diff --git a/example/applications/noexcept-browser/http/client/sync-ssl/http_client_sync_ssl.cpp b/example/applications/noexcept-browser/http/client/sync-ssl/http_client_sync_ssl.cpp index 67dcfbc..1a834af 100644 --- a/example/applications/noexcept-browser/http/client/sync-ssl/http_client_sync_ssl.cpp +++ b/example/applications/noexcept-browser/http/client/sync-ssl/http_client_sync_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -32,18 +32,18 @@ // //------------------------------------------------------------------------------ -#include -#include #include #include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +// from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/noexcept-browser/http/client/sync/http_client_sync.cpp b/example/applications/noexcept-browser/http/client/sync/http_client_sync.cpp index ea74716..c4a0707 100644 --- a/example/applications/noexcept-browser/http/client/sync/http_client_sync.cpp +++ b/example/applications/noexcept-browser/http/client/sync/http_client_sync.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -33,17 +33,17 @@ //[example_http_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using webcpp::asio::ip::tcp; // from +// from +using webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/noexcept-browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp b/example/applications/noexcept-browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp index caad897..b88d12b 100644 --- a/example/applications/noexcept-browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp +++ b/example/applications/noexcept-browser/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -35,20 +35,20 @@ #include -#include -#include #include #include #include #include #include +#include +#include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -70,14 +70,14 @@ class session : public std::enable_shared_from_this { // ensure that handlers do not execute concurrently. // Value parameters retain the upstream callback and coroutine ownership contract. // NOLINTNEXTLINE(performance-unnecessary-value-param) - session(net::strand ex, ssl::context& ctx) + session(net::strand ex, ssl::context& ctx) : resolver_(ex), ws_(ex, ctx) {} public: // Delegate construction to a prive constructor to be able to use // the same strand for both I/O objects. explicit session(webcpp::asio::io_context& ioc, ssl::context& ctx) - : session(net::make_strand(boost::asio::any_io_executor(ioc.get_executor())), ctx) {} + : session(net::make_strand(webcpp::asio::any_io_executor(ioc.get_executor())), ctx) {} // Start the asynchronous operation void run(char const* host, char const* port, char const* text) { diff --git a/example/applications/noexcept-browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp b/example/applications/noexcept-browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp index eb4fe28..0226645 100644 --- a/example/applications/noexcept-browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp +++ b/example/applications/noexcept-browser/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -35,19 +35,19 @@ #include -#include #include #include #include #include #include +#include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-browser/websocket/client/async/websocket_client_async.cpp b/example/applications/noexcept-browser/websocket/client/async/websocket_client_async.cpp index b6dccbd..2b11815 100644 --- a/example/applications/noexcept-browser/websocket/client/async/websocket_client_async.cpp +++ b/example/applications/noexcept-browser/websocket/client/async/websocket_client_async.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -32,19 +32,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-browser/websocket/client/awaitable/websocket_client_awaitable.cpp b/example/applications/noexcept-browser/websocket/client/awaitable/websocket_client_awaitable.cpp index a04ee4e..4fc2f2f 100644 --- a/example/applications/noexcept-browser/websocket/client/awaitable/websocket_client_awaitable.cpp +++ b/example/applications/noexcept-browser/websocket/client/awaitable/websocket_client_awaitable.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -32,9 +32,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -45,7 +45,7 @@ namespace beast = webcpp::beast; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/noexcept-browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp b/example/applications/noexcept-browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp index 96099b2..191e32c 100644 --- a/example/applications/noexcept-browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp +++ b/example/applications/noexcept-browser/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -35,19 +35,19 @@ #include -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = webcpp::asio::ssl; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/noexcept-browser/websocket/client/sync/websocket_client_sync.cpp b/example/applications/noexcept-browser/websocket/client/sync/websocket_client_sync.cpp index a73cace..5f4f4f6 100644 --- a/example/applications/noexcept-browser/websocket/client/sync/websocket_client_sync.cpp +++ b/example/applications/noexcept-browser/websocket/client/sync/websocket_client_sync.cpp @@ -7,9 +7,9 @@ // Generated by example/applications/tools/prepare.py. Edit the generator. // Upstream authors and their original notice follow. -#include #include #include +#include #include #include #include @@ -34,18 +34,18 @@ //[example_websocket_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/noexcept-native/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp b/example/applications/noexcept-native/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp index eb15c16..004f9a2 100644 --- a/example/applications/noexcept-native/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp +++ b/example/applications/noexcept-native/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp @@ -35,8 +35,7 @@ #include "common/server_certificate.hpp" -#include -#include +#include #include #include @@ -52,8 +51,8 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; -namespace ssl = boost::asio::ssl; +namespace net = webcpp::asio; +namespace ssl = webcpp::asio::ssl; using executor_type = net::strand; using stream_type = beast::tcp_stream::rebind_executor::other; diff --git a/example/applications/noexcept-native/advanced/server-flex/advanced_server_flex.cpp b/example/applications/noexcept-native/advanced/server-flex/advanced_server_flex.cpp index d7926d4..2370900 100644 --- a/example/applications/noexcept-native/advanced/server-flex/advanced_server_flex.cpp +++ b/example/applications/noexcept-native/advanced/server-flex/advanced_server_flex.cpp @@ -35,12 +35,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include -#include -#include #include #include #include @@ -50,14 +44,20 @@ #include #include #include +#include +#include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/advanced/server/advanced_server.cpp b/example/applications/noexcept-native/advanced/server/advanced_server.cpp index bf2ed20..db53cc2 100644 --- a/example/applications/noexcept-native/advanced/server/advanced_server.cpp +++ b/example/applications/noexcept-native/advanced/server/advanced_server.cpp @@ -32,10 +32,6 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include -#include #include #include #include @@ -46,13 +42,17 @@ #include #include #include +#include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/common/root_certificates.hpp b/example/applications/noexcept-native/common/root_certificates.hpp index f210458..86cdcb0 100644 --- a/example/applications/noexcept-native/common/root_certificates.hpp +++ b/example/applications/noexcept-native/common/root_certificates.hpp @@ -28,8 +28,8 @@ #ifndef BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP #define BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP -#include #include +#include /* PLEASE READ @@ -56,7 +56,7 @@ tl;dr: root_certificates.hpp should not be used in production code */ -namespace ssl = boost::asio::ssl; // from +namespace ssl = webcpp::asio::ssl; // from namespace detail { @@ -3958,7 +3958,7 @@ inline void load_root_certificates(ssl::context& ctx, boost::system::error_code& static_cast( // The ec output and the returned reference carry the same operation status. // NOLINTNEXTLINE(bugprone-unused-return-value) - ctx.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()), ec)); + ctx.add_certificate_authority(webcpp::asio::buffer(cert.data(), cert.size()), ec)); if (ec) { return; } diff --git a/example/applications/noexcept-native/common/server_certificate.hpp b/example/applications/noexcept-native/common/server_certificate.hpp index af78066..260a1a7 100644 --- a/example/applications/noexcept-native/common/server_certificate.hpp +++ b/example/applications/noexcept-native/common/server_certificate.hpp @@ -28,10 +28,10 @@ #ifndef BOOST_BEAST_EXAMPLE_COMMON_SERVER_CERTIFICATE_HPP #define BOOST_BEAST_EXAMPLE_COMMON_SERVER_CERTIFICATE_HPP -#include -#include #include #include +#include +#include /* Load a signed certificate into the ssl context, and configure the context for use with a server. @@ -42,11 +42,11 @@ depending on your environment Please see the documentation accompanying the Beast certificate for more details. */ -inline void load_server_certificate(boost::asio::ssl::context& ctx) { +inline void load_server_certificate(webcpp::asio::ssl::context& ctx) { if (auto const* path = std::getenv("WEBCPP_BEAST_FIXTURE_CERT")) { ctx.use_certificate_chain_file(path); ctx.use_private_key_file(std::getenv("WEBCPP_BEAST_FIXTURE_KEY"), - boost::asio::ssl::context::pem); + webcpp::asio::ssl::context::pem); return; } @@ -123,17 +123,18 @@ inline void load_server_certificate(boost::asio::ssl::context& ctx) { "-----END DH PARAMETERS-----\n"; ctx.set_password_callback( - [](std::size_t, boost::asio::ssl::context_base::password_purpose) { return "test"; }); + [](std::size_t, webcpp::asio::ssl::context_base::password_purpose) { return "test"; }); - ctx.set_options(boost::asio::ssl::context::default_workarounds | - boost::asio::ssl::context::no_sslv2 | boost::asio::ssl::context::single_dh_use); + ctx.set_options(webcpp::asio::ssl::context::default_workarounds | + webcpp::asio::ssl::context::no_sslv2 | + webcpp::asio::ssl::context::single_dh_use); - ctx.use_certificate_chain(boost::asio::buffer(cert.data(), cert.size())); + ctx.use_certificate_chain(webcpp::asio::buffer(cert.data(), cert.size())); - ctx.use_private_key(boost::asio::buffer(key.data(), key.size()), - boost::asio::ssl::context::file_format::pem); + ctx.use_private_key(webcpp::asio::buffer(key.data(), key.size()), + webcpp::asio::ssl::context::file_format::pem); - ctx.use_tmp_dh(boost::asio::buffer(dh.data(), dh.size())); + ctx.use_tmp_dh(webcpp::asio::buffer(dh.data(), dh.size())); } #endif diff --git a/example/applications/noexcept-native/doc/http_examples.hpp b/example/applications/noexcept-native/doc/http_examples.hpp index 2095a30..19c4edb 100644 --- a/example/applications/noexcept-native/doc/http_examples.hpp +++ b/example/applications/noexcept-native/doc/http_examples.hpp @@ -38,7 +38,7 @@ // The documentation assumes the webcpp::beast::http namespace -namespace boost::beast::http { +namespace webcpp::beast::http { //------------------------------------------------------------------------------ // @@ -71,7 +71,7 @@ void send_expect_100_continue(SyncStream& stream, DynamicBuffer& buffer, request>& req, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // Insert or replace the Expect field @@ -125,7 +125,7 @@ template void receive_expect_100_continue(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // Declare a parser for a request with a string body @@ -217,8 +217,8 @@ void send_cgi_response(SyncReadStream& input, SyncWriteStream& output, error_cod do { // Read a buffer from the child process std::array buffer{}; - auto bytes_transferred = input.read_some(boost::asio::buffer(buffer), ec); - if (ec == boost::asio::error::eof) { + auto bytes_transferred = input.read_some(webcpp::asio::buffer(buffer), ec); + if (ec == webcpp::asio::error::eof) { ec = {}; // `nullptr` indicates there is no buffer @@ -270,7 +270,7 @@ void send_cgi_response(SyncReadStream& input, SyncWriteStream& output, error_cod template void do_server_head(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // We deliver this payload for all GET requests @@ -352,7 +352,7 @@ response do_head_request(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { // Do some type checking to be a good citizen static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // The interfaces we are using are low level and do not @@ -550,10 +550,10 @@ class write_ostream_helper { std::size_t bytes_transferred = 0; // Loop over the buffer sequence - for (auto it = boost::asio::buffer_sequence_begin(buffers); - it != boost::asio::buffer_sequence_end(buffers); ++it) { + for (auto it = webcpp::asio::buffer_sequence_begin(buffers); + it != webcpp::asio::buffer_sequence_end(buffers); ++it) { // This is the next buffer in the sequence - boost::asio::const_buffer const buffer = *it; + webcpp::asio::const_buffer const buffer = *it; // Write it to the std::ostream if (buffer.size() > @@ -947,4 +947,4 @@ void print_chunked_body(std::ostream& os, SyncReadStream& stream, DynamicBuffer& //] -} // namespace boost::beast::http +} // namespace webcpp::beast::http diff --git a/example/applications/noexcept-native/doc/ssl/client.cpp b/example/applications/noexcept-native/doc/ssl/client.cpp index 823a1b6..4ab692f 100644 --- a/example/applications/noexcept-native/doc/ssl/client.cpp +++ b/example/applications/noexcept-native/doc/ssl/client.cpp @@ -25,8 +25,7 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include +#include #include #include @@ -35,7 +34,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = net::ssl; namespace { diff --git a/example/applications/noexcept-native/doc/ssl/server.cpp b/example/applications/noexcept-native/doc/ssl/server.cpp index fc19ff2..e12f85c 100644 --- a/example/applications/noexcept-native/doc/ssl/server.cpp +++ b/example/applications/noexcept-native/doc/ssl/server.cpp @@ -25,8 +25,7 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include +#include #include #include @@ -35,7 +34,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = net::ssl; namespace { diff --git a/example/applications/noexcept-native/echo-op/echo_op.cpp b/example/applications/noexcept-native/echo-op/echo_op.cpp index a2ce491..62c484c 100644 --- a/example/applications/noexcept-native/echo-op/echo_op.cpp +++ b/example/applications/noexcept-native/echo-op/echo_op.cpp @@ -24,14 +24,13 @@ // Official repository: https://github.com/boostorg/beast // -#include #include #include #include #include #include -namespace net = boost::asio; +namespace net = webcpp::asio; namespace beast = webcpp::beast; //[example_core_echo_op_1 @@ -116,7 +115,7 @@ class echo_op; // This example uses the Asio's stackless "fauxroutines", implemented // using a macro-based solution. It makes the code easier to write and // easier to read. This include file defines the necessary macros and types. -#include +#include // Read a line and echo it back // @@ -144,10 +143,10 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to net::async_completion init(token); - // The helper macro BOOST_ASIO_HANDLER_TYPE converts the completion + // The helper macro WEBCPP_ASIO_HANDLER_TYPE converts the completion // token type into a concrete handler type of the correct signature. - using handler_type = BOOST_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); + using handler_type = WEBCPP_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); // The class template `async_base` holds the caller's completion // handler for us, and provides all of the boilerplate for forwarding @@ -175,7 +174,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to // NOLINTNEXTLINE(misc-multiple-inheritance) // Asio operation state combines completion ownership with coroutine resume state. // NOLINTNEXTLINE(misc-multiple-inheritance) - struct echo_op : base_type, boost::asio::coroutine { + struct echo_op : base_type, webcpp::asio::coroutine { AsyncStream& stream; DynamicBuffer& buffer; @@ -327,7 +326,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to }; // Create the composed operation and launch it. This is a constructor - // call followed by invocation of operator(). We use BOOST_ASIO_HANDLER_TYPE + // call followed by invocation of operator(). We use WEBCPP_ASIO_HANDLER_TYPE // to convert the completion token into the correct handler type, // allowing user-defined specializations of the async_result template // to be used. @@ -343,7 +342,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to } // Including this file undefines the macros used by the stackless fauxroutines. -#include +#include //] @@ -371,7 +370,7 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } - namespace net = boost::asio; + namespace net = webcpp::asio; auto const address = net::ip::make_address(argv[1]); auto const port = static_cast(webcpp_fixture::integer(argv[2])); diff --git a/example/applications/noexcept-native/http/client/async-local/http_client_async_local.cpp b/example/applications/noexcept-native/http/client/async-local/http_client_async_local.cpp index bc59e52..301a249 100644 --- a/example/applications/noexcept-native/http/client/async-local/http_client_async_local.cpp +++ b/example/applications/noexcept-native/http/client/async-local/http_client_async_local.cpp @@ -31,7 +31,7 @@ // //------------------------------------------------------------------------------ -#include +#include #include #include @@ -43,8 +43,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp b/example/applications/noexcept-native/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp index 9995baf..0aa9363 100644 --- a/example/applications/noexcept-native/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp +++ b/example/applications/noexcept-native/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp @@ -33,19 +33,19 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/http/client/async-ssl/http_client_async_ssl.cpp b/example/applications/noexcept-native/http/client/async-ssl/http_client_async_ssl.cpp index 9f7026c..7aee7bd 100644 --- a/example/applications/noexcept-native/http/client/async-ssl/http_client_async_ssl.cpp +++ b/example/applications/noexcept-native/http/client/async-ssl/http_client_async_ssl.cpp @@ -33,18 +33,18 @@ #include "common/root_certificates.hpp" -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/http/client/async/http_client_async.cpp b/example/applications/noexcept-native/http/client/async/http_client_async.cpp index 1f54524..82a87b4 100644 --- a/example/applications/noexcept-native/http/client/async/http_client_async.cpp +++ b/example/applications/noexcept-native/http/client/async/http_client_async.cpp @@ -30,18 +30,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp b/example/applications/noexcept-native/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp index 6638b17..0050b36 100644 --- a/example/applications/noexcept-native/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp +++ b/example/applications/noexcept-native/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp @@ -31,11 +31,11 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include "common/root_certificates.hpp" @@ -48,8 +48,8 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; -namespace ssl = boost::asio::ssl; +namespace net = webcpp::asio; +namespace ssl = webcpp::asio::ssl; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/http/client/awaitable/http_client_awaitable.cpp b/example/applications/noexcept-native/http/client/awaitable/http_client_awaitable.cpp index 98c689d..4812119 100644 --- a/example/applications/noexcept-native/http/client/awaitable/http_client_awaitable.cpp +++ b/example/applications/noexcept-native/http/client/awaitable/http_client_awaitable.cpp @@ -30,9 +30,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -43,7 +43,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/noexcept-native/http/client/body/json_body.hpp b/example/applications/noexcept-native/http/client/body/json_body.hpp index 19ff218..63e5c1b 100644 --- a/example/applications/noexcept-native/http/client/body/json_body.hpp +++ b/example/applications/noexcept-native/http/client/body/json_body.hpp @@ -34,10 +34,10 @@ #define BOOST_BEAST_EXAMPLE_JSON_BODY #include -#include #include #include #include +#include #include namespace json = boost::json; @@ -46,7 +46,7 @@ struct json_body { using value_type = json::value; struct writer { - using const_buffers_type = boost::asio::const_buffer; + using const_buffers_type = webcpp::asio::const_buffer; template writer(webcpp::beast::http::header const& /*unused*/, @@ -66,7 +66,7 @@ struct json_body { ec = {}; // We serialize as much as we can with the buffer. Often that'll suffice const auto len = serializer_.read(buffer_.data(), buffer_.size()); - return std::make_pair(boost::asio::const_buffer(len.data(), len.size()), + return std::make_pair(webcpp::asio::const_buffer(len.data(), len.size()), !serializer_.done()); } diff --git a/example/applications/noexcept-native/http/client/body/json_client.cpp b/example/applications/noexcept-native/http/client/body/json_client.cpp index 3a57b02..91027cb 100644 --- a/example/applications/noexcept-native/http/client/body/json_client.cpp +++ b/example/applications/noexcept-native/http/client/body/json_client.cpp @@ -23,8 +23,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from int main(int /*unused*/, char** /*unused*/) { // Our test endpoint for testing the json diff --git a/example/applications/noexcept-native/http/client/coro-ssl/http_client_coro_ssl.cpp b/example/applications/noexcept-native/http/client/coro-ssl/http_client_coro_ssl.cpp index 1e24957..2fb19e7 100644 --- a/example/applications/noexcept-native/http/client/coro-ssl/http_client_coro_ssl.cpp +++ b/example/applications/noexcept-native/http/client/coro-ssl/http_client_coro_ssl.cpp @@ -33,21 +33,21 @@ #include "common/root_certificates.hpp" -#include -#include #include #include #include #include #include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -183,7 +183,7 @@ int main(int argc, char** argv) { ctx.set_verify_mode(ssl::verify_peer); // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, std::bind(&do_session, std::string(host), std::string(port), std::string(target), version, std::ref(ioc), std::ref(ctx), std::placeholders::_1), diff --git a/example/applications/noexcept-native/http/client/coro/http_client_coro.cpp b/example/applications/noexcept-native/http/client/coro/http_client_coro.cpp index 4fc12b5..9cba96a 100644 --- a/example/applications/noexcept-native/http/client/coro/http_client_coro.cpp +++ b/example/applications/noexcept-native/http/client/coro/http_client_coro.cpp @@ -30,19 +30,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -135,7 +135,7 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc; // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, std::bind(&do_session, std::string(host), std::string(port), std::string(target), version, std::ref(ioc), std::placeholders::_1), diff --git a/example/applications/noexcept-native/http/client/crawl/http_crawl.cpp b/example/applications/noexcept-native/http/client/crawl/http_crawl.cpp index 7cb28c7..daf1f46 100644 --- a/example/applications/noexcept-native/http/client/crawl/http_crawl.cpp +++ b/example/applications/noexcept-native/http/client/crawl/http_crawl.cpp @@ -33,11 +33,6 @@ #include "urls_large_data.hpp" #include -#include -#include -#include -#include -#include #include #include #include @@ -48,13 +43,18 @@ #include #include #include +#include +#include +#include +#include +#include #include namespace chrono = std::chrono; // from namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/http/client/methods/http_client_methods.cpp b/example/applications/noexcept-native/http/client/methods/http_client_methods.cpp index 2b5d0d0..c408032 100644 --- a/example/applications/noexcept-native/http/client/methods/http_client_methods.cpp +++ b/example/applications/noexcept-native/http/client/methods/http_client_methods.cpp @@ -32,17 +32,17 @@ //[example_http_client_methods -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from // perform a get request namespace { diff --git a/example/applications/noexcept-native/http/client/sync-ssl/http_client_sync_ssl.cpp b/example/applications/noexcept-native/http/client/sync-ssl/http_client_sync_ssl.cpp index 6a7fea1..b1f912e 100644 --- a/example/applications/noexcept-native/http/client/sync-ssl/http_client_sync_ssl.cpp +++ b/example/applications/noexcept-native/http/client/sync-ssl/http_client_sync_ssl.cpp @@ -33,18 +33,18 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = net::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = net::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/noexcept-native/http/client/sync/http_client_sync.cpp b/example/applications/noexcept-native/http/client/sync/http_client_sync.cpp index 96451a7..4a1b19a 100644 --- a/example/applications/noexcept-native/http/client/sync/http_client_sync.cpp +++ b/example/applications/noexcept-native/http/client/sync/http_client_sync.cpp @@ -32,17 +32,17 @@ //[example_http_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/noexcept-native/http/server/async-local/http_server_async_local.cpp b/example/applications/noexcept-native/http/server/async-local/http_server_async_local.cpp index 021a2fa..fec95a2 100644 --- a/example/applications/noexcept-native/http/server/async-local/http_server_async_local.cpp +++ b/example/applications/noexcept-native/http/server/async-local/http_server_async_local.cpp @@ -31,10 +31,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include #include +#include +#include +#include #include #include @@ -49,8 +49,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/http/server/async-ssl/http_server_async_ssl.cpp b/example/applications/noexcept-native/http/server/async-ssl/http_server_async_ssl.cpp index cdcf6f7..18a0c87 100644 --- a/example/applications/noexcept-native/http/server/async-ssl/http_server_async_ssl.cpp +++ b/example/applications/noexcept-native/http/server/async-ssl/http_server_async_ssl.cpp @@ -34,9 +34,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include @@ -44,13 +41,16 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/http/server/async/http_server_async.cpp b/example/applications/noexcept-native/http/server/async/http_server_async.cpp index 3dfb361..ec6e869 100644 --- a/example/applications/noexcept-native/http/server/async/http_server_async.cpp +++ b/example/applications/noexcept-native/http/server/async/http_server_async.cpp @@ -31,8 +31,6 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include @@ -41,12 +39,14 @@ #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/http/server/awaitable/http_server_awaitable.cpp b/example/applications/noexcept-native/http/server/awaitable/http_server_awaitable.cpp index 6105689..984cb3d 100644 --- a/example/applications/noexcept-native/http/server/awaitable/http_server_awaitable.cpp +++ b/example/applications/noexcept-native/http/server/awaitable/http_server_awaitable.cpp @@ -30,11 +30,11 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include @@ -49,7 +49,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/http/server/coro-ssl/http_server_coro_ssl.cpp b/example/applications/noexcept-native/http/server/coro-ssl/http_server_coro_ssl.cpp index 12e98b3..22d474a 100644 --- a/example/applications/noexcept-native/http/server/coro-ssl/http_server_coro_ssl.cpp +++ b/example/applications/noexcept-native/http/server/coro-ssl/http_server_coro_ssl.cpp @@ -34,9 +34,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include @@ -45,14 +42,17 @@ #include #include #include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. beast::string_view mime_type(beast::string_view path) { @@ -340,13 +340,13 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e if (ec) fail(ec, "accept"); else - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), std::bind(&do_session, ssl::stream(std::move(socket), ctx), doc_root, std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } @@ -375,20 +375,20 @@ int main(int argc, char** argv) { load_server_certificate(ctx); // Spawn a listening port - boost::asio::spawn(ioc, - std::bind(&do_listen, std::ref(ioc), std::ref(ctx), - tcp::endpoint{address, port}, doc_root, std::placeholders::_1), - // on completion, spawn will call this function - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) - webcpp_fixture::fail_stop(); - }); + webcpp::asio::spawn(ioc, + std::bind(&do_listen, std::ref(ioc), std::ref(ctx), + tcp::endpoint{address, port}, doc_root, std::placeholders::_1), + // on completion, spawn will call this function + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) + webcpp_fixture::fail_stop(); + }); // Run the I/O service on the requested number of threads std::vector v; diff --git a/example/applications/noexcept-native/http/server/coro/http_server_coro.cpp b/example/applications/noexcept-native/http/server/coro/http_server_coro.cpp index 4f72585..a1eb9c1 100644 --- a/example/applications/noexcept-native/http/server/coro/http_server_coro.cpp +++ b/example/applications/noexcept-native/http/server/coro/http_server_coro.cpp @@ -31,9 +31,6 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include @@ -42,13 +39,16 @@ #include #include #include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. beast::string_view mime_type(beast::string_view path) { @@ -304,12 +304,12 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, if (ec) fail(ec, "accept"); else - boost::asio::spawn(acceptor.get_executor(), - std::bind(&do_session, beast::tcp_stream(std::move(socket)), - doc_root, std::placeholders::_1), - // we ignore the result of the session, - // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::spawn(acceptor.get_executor(), + std::bind(&do_session, beast::tcp_stream(std::move(socket)), + doc_root, std::placeholders::_1), + // we ignore the result of the session, + // most errors are handled with error_code + webcpp::asio::detached); } } @@ -332,20 +332,20 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc{threads}; // Spawn a listening port - boost::asio::spawn(ioc, - std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, doc_root, - std::placeholders::_1), - // on completion, spawn will call this function - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) - webcpp_fixture::fail_stop(); - }); + webcpp::asio::spawn(ioc, + std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, doc_root, + std::placeholders::_1), + // on completion, spawn will call this function + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) + webcpp_fixture::fail_stop(); + }); // Run the I/O service on the requested number of threads std::vector v; diff --git a/example/applications/noexcept-native/http/server/fast/http_server_fast.cpp b/example/applications/noexcept-native/http/server/fast/http_server_fast.cpp index 271d6d0..24ef22d 100644 --- a/example/applications/noexcept-native/http/server/fast/http_server_fast.cpp +++ b/example/applications/noexcept-native/http/server/fast/http_server_fast.cpp @@ -32,7 +32,6 @@ #include "fields_alloc.hpp" -#include #include #include #include @@ -44,8 +43,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/http/server/flex/http_server_flex.cpp b/example/applications/noexcept-native/http/server/flex/http_server_flex.cpp index 076965e..47e9e74 100644 --- a/example/applications/noexcept-native/http/server/flex/http_server_flex.cpp +++ b/example/applications/noexcept-native/http/server/flex/http_server_flex.cpp @@ -34,22 +34,22 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/http/server/small/http_server_small.cpp b/example/applications/noexcept-native/http/server/small/http_server_small.cpp index 511e4b5..747eae6 100644 --- a/example/applications/noexcept-native/http/server/small/http_server_small.cpp +++ b/example/applications/noexcept-native/http/server/small/http_server_small.cpp @@ -30,7 +30,6 @@ // //------------------------------------------------------------------------------ -#include #include #include #include @@ -41,8 +40,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from namespace { namespace my_program_state { diff --git a/example/applications/noexcept-native/http/server/stackless-ssl/http_server_stackless_ssl.cpp b/example/applications/noexcept-native/http/server/stackless-ssl/http_server_stackless_ssl.cpp index 4cb4f76..8a538b6 100644 --- a/example/applications/noexcept-native/http/server/stackless-ssl/http_server_stackless_ssl.cpp +++ b/example/applications/noexcept-native/http/server/stackless-ssl/http_server_stackless_ssl.cpp @@ -34,10 +34,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include @@ -46,13 +42,17 @@ #include #include #include +#include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -285,7 +285,7 @@ void fail(beast::error_code ec, char const* what) { // Handles an HTTP server connection // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { ssl::stream stream_; beast::flat_buffer buffer_; std::shared_ptr doc_root_; @@ -309,7 +309,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -401,7 +401,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -409,7 +409,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; ssl::context& ctx_; tcp::acceptor acceptor_; @@ -471,7 +471,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -497,7 +497,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/http/server/stackless/http_server_stackless.cpp b/example/applications/noexcept-native/http/server/stackless/http_server_stackless.cpp index 816e51f..3ae7872 100644 --- a/example/applications/noexcept-native/http/server/stackless/http_server_stackless.cpp +++ b/example/applications/noexcept-native/http/server/stackless/http_server_stackless.cpp @@ -31,9 +31,6 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include @@ -42,12 +39,15 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -259,7 +259,7 @@ void fail(beast::error_code ec, char const* what) { // Handles an HTTP server connection // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { beast::tcp_stream stream_; beast::flat_buffer buffer_; std::shared_ptr doc_root_; @@ -282,7 +282,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -348,7 +348,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -356,7 +356,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -416,7 +416,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -440,7 +440,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/http/server/sync-ssl/http_server_sync_ssl.cpp b/example/applications/noexcept-native/http/server/sync-ssl/http_server_sync_ssl.cpp index c1b5369..c366d69 100644 --- a/example/applications/noexcept-native/http/server/sync-ssl/http_server_sync_ssl.cpp +++ b/example/applications/noexcept-native/http/server/sync-ssl/http_server_sync_ssl.cpp @@ -33,22 +33,22 @@ #include "common/server_certificate.hpp" -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-native/http/server/sync/http_server_sync.cpp b/example/applications/noexcept-native/http/server/sync/http_server_sync.cpp index abe4627..efda23f 100644 --- a/example/applications/noexcept-native/http/server/sync/http_server_sync.cpp +++ b/example/applications/noexcept-native/http/server/sync/http_server_sync.cpp @@ -30,19 +30,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/client/async-local/websocket_client_async_local.cpp b/example/applications/noexcept-native/websocket/client/async-local/websocket_client_async_local.cpp index 49e062c..a5cc28a 100644 --- a/example/applications/noexcept-native/websocket/client/async-local/websocket_client_async_local.cpp +++ b/example/applications/noexcept-native/websocket/client/async-local/websocket_client_async_local.cpp @@ -32,8 +32,8 @@ // //------------------------------------------------------------------------------ -#include -#include +#include +#include #include #include @@ -46,8 +46,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp b/example/applications/noexcept-native/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp index c8bff59..feb08f1 100644 --- a/example/applications/noexcept-native/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp +++ b/example/applications/noexcept-native/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp @@ -34,22 +34,22 @@ #include "common/root_certificates.hpp" -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/client/async-ssl/websocket_client_async_ssl.cpp b/example/applications/noexcept-native/websocket/client/async-ssl/websocket_client_async_ssl.cpp index ab86e69..814914c 100644 --- a/example/applications/noexcept-native/websocket/client/async-ssl/websocket_client_async_ssl.cpp +++ b/example/applications/noexcept-native/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -34,21 +34,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/client/async/websocket_client_async.cpp b/example/applications/noexcept-native/websocket/client/async/websocket_client_async.cpp index 92b94ac..1bb23f4 100644 --- a/example/applications/noexcept-native/websocket/client/async/websocket_client_async.cpp +++ b/example/applications/noexcept-native/websocket/client/async/websocket_client_async.cpp @@ -31,19 +31,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/client/awaitable/websocket_client_awaitable.cpp b/example/applications/noexcept-native/websocket/client/awaitable/websocket_client_awaitable.cpp index 3c2f122..48a162e 100644 --- a/example/applications/noexcept-native/websocket/client/awaitable/websocket_client_awaitable.cpp +++ b/example/applications/noexcept-native/websocket/client/awaitable/websocket_client_awaitable.cpp @@ -31,9 +31,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -45,7 +45,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/noexcept-native/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp b/example/applications/noexcept-native/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp index 7615d0e..f145b28 100644 --- a/example/applications/noexcept-native/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp +++ b/example/applications/noexcept-native/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp @@ -34,22 +34,22 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -173,7 +173,7 @@ int main(int argc, char** argv) { load_root_certificates(ctx); // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, std::bind(&do_session, std::string(host), std::string(port), std::string(text), std::ref(ioc), std::ref(ctx), std::placeholders::_1), diff --git a/example/applications/noexcept-native/websocket/client/coro/websocket_client_coro.cpp b/example/applications/noexcept-native/websocket/client/coro/websocket_client_coro.cpp index 55f0a6d..b7e08df 100644 --- a/example/applications/noexcept-native/websocket/client/coro/websocket_client_coro.cpp +++ b/example/applications/noexcept-native/websocket/client/coro/websocket_client_coro.cpp @@ -31,19 +31,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -141,20 +141,20 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc; // Launch the asynchronous operation - boost::asio::spawn(ioc, - std::bind(&do_session, std::string(host), std::string(port), - std::string(text), std::ref(ioc), std::placeholders::_1), - // on completion, spawn will call this function - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) - webcpp_fixture::fail_stop(); - }); + webcpp::asio::spawn(ioc, + std::bind(&do_session, std::string(host), std::string(port), + std::string(text), std::ref(ioc), std::placeholders::_1), + // on completion, spawn will call this function + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) + webcpp_fixture::fail_stop(); + }); // Run the I/O service. The call will return when // the socket is closed. diff --git a/example/applications/noexcept-native/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp b/example/applications/noexcept-native/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp index b73de02..f777fd3 100644 --- a/example/applications/noexcept-native/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp +++ b/example/applications/noexcept-native/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp @@ -34,21 +34,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include -#include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/noexcept-native/websocket/client/sync/websocket_client_sync.cpp b/example/applications/noexcept-native/websocket/client/sync/websocket_client_sync.cpp index e466a80..3184fdf 100644 --- a/example/applications/noexcept-native/websocket/client/sync/websocket_client_sync.cpp +++ b/example/applications/noexcept-native/websocket/client/sync/websocket_client_sync.cpp @@ -33,18 +33,18 @@ //[example_websocket_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/noexcept-native/websocket/server/async-local/websocket_server_async_local.cpp b/example/applications/noexcept-native/websocket/server/async-local/websocket_server_async_local.cpp index cdd6950..5f72150 100644 --- a/example/applications/noexcept-native/websocket/server/async-local/websocket_server_async_local.cpp +++ b/example/applications/noexcept-native/websocket/server/async-local/websocket_server_async_local.cpp @@ -32,9 +32,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -50,8 +50,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/server/async-ssl/websocket_server_async_ssl.cpp b/example/applications/noexcept-native/websocket/server/async-ssl/websocket_server_async_ssl.cpp index f8f6f98..b151d84 100644 --- a/example/applications/noexcept-native/websocket/server/async-ssl/websocket_server_async_ssl.cpp +++ b/example/applications/noexcept-native/websocket/server/async-ssl/websocket_server_async_ssl.cpp @@ -35,24 +35,24 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/server/async/websocket_server_async.cpp b/example/applications/noexcept-native/websocket/server/async/websocket_server_async.cpp index e6eb729..d8a3012 100644 --- a/example/applications/noexcept-native/websocket/server/async/websocket_server_async.cpp +++ b/example/applications/noexcept-native/websocket/server/async/websocket_server_async.cpp @@ -32,8 +32,6 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include @@ -41,13 +39,15 @@ #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/server/awaitable/websocket_server_awaitable.cpp b/example/applications/noexcept-native/websocket/server/awaitable/websocket_server_awaitable.cpp index 1f4161d..8fe6033 100644 --- a/example/applications/noexcept-native/websocket/server/awaitable/websocket_server_awaitable.cpp +++ b/example/applications/noexcept-native/websocket/server/awaitable/websocket_server_awaitable.cpp @@ -31,10 +31,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -49,7 +49,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Echoes back all received WebSocket messages namespace { diff --git a/example/applications/noexcept-native/websocket/server/chat-multi/main.cpp b/example/applications/noexcept-native/websocket/server/chat-multi/main.cpp index 4ce5d9f..1883b4d 100644 --- a/example/applications/noexcept-native/websocket/server/chat-multi/main.cpp +++ b/example/applications/noexcept-native/websocket/server/chat-multi/main.cpp @@ -39,10 +39,10 @@ #include "listener.hpp" #include "shared_state.hpp" -#include #include #include #include +#include // The process entry point retains its standard char** argv signature. // NOLINTNEXTLINE(misc-const-correctness) diff --git a/example/applications/noexcept-native/websocket/server/chat-multi/net.hpp b/example/applications/noexcept-native/websocket/server/chat-multi/net.hpp index b3acfe9..74b8132 100644 --- a/example/applications/noexcept-native/websocket/server/chat-multi/net.hpp +++ b/example/applications/noexcept-native/websocket/server/chat-multi/net.hpp @@ -27,9 +27,7 @@ #ifndef BOOST_BEAST_EXAMPLE_WEBSOCKET_CHAT_MULTI_NET_HPP #define BOOST_BEAST_EXAMPLE_WEBSOCKET_CHAT_MULTI_NET_HPP -#include - -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from #endif diff --git a/example/applications/noexcept-native/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp b/example/applications/noexcept-native/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp index f5fc7de..b975788 100644 --- a/example/applications/noexcept-native/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp +++ b/example/applications/noexcept-native/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp @@ -35,25 +35,25 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -148,14 +148,14 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e if (ec) fail(ec, "accept"); else - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), std::bind(&do_session, websocket::stream>(std::move(socket), ctx), std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } @@ -183,20 +183,20 @@ int main(int argc, char** argv) { load_server_certificate(ctx); // Spawn a listening port - boost::asio::spawn(ioc, - std::bind(&do_listen, std::ref(ioc), std::ref(ctx), - tcp::endpoint{address, port}, std::placeholders::_1), - // on completion, spawn will call this function - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) - webcpp_fixture::fail_stop(); - }); + webcpp::asio::spawn(ioc, + std::bind(&do_listen, std::ref(ioc), std::ref(ctx), + tcp::endpoint{address, port}, std::placeholders::_1), + // on completion, spawn will call this function + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) + webcpp_fixture::fail_stop(); + }); // Run the I/O service on the requested number of threads std::vector v; diff --git a/example/applications/noexcept-native/websocket/server/coro/websocket_server_coro.cpp b/example/applications/noexcept-native/websocket/server/coro/websocket_server_coro.cpp index ed910f7..4a44cb8 100644 --- a/example/applications/noexcept-native/websocket/server/coro/websocket_server_coro.cpp +++ b/example/applications/noexcept-native/websocket/server/coro/websocket_server_coro.cpp @@ -32,8 +32,6 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include @@ -41,14 +39,16 @@ #include #include #include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -130,13 +130,13 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, net::yield if (ec) fail(ec, "accept"); else - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), std::bind(&do_session, websocket::stream(std::move(socket)), std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } @@ -158,7 +158,7 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc(threads); // Spawn a listening port - boost::asio::spawn( + webcpp::asio::spawn( ioc, std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, std::placeholders::_1), // on completion, spawn will call this function diff --git a/example/applications/noexcept-native/websocket/server/fast/websocket_server_fast.cpp b/example/applications/noexcept-native/websocket/server/fast/websocket_server_fast.cpp index d5fb270..c288027 100644 --- a/example/applications/noexcept-native/websocket/server/fast/websocket_server_fast.cpp +++ b/example/applications/noexcept-native/websocket/server/fast/websocket_server_fast.cpp @@ -45,9 +45,6 @@ */ #include -#include -#include -#include #include #include #include @@ -56,6 +53,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -63,8 +63,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -335,11 +335,11 @@ void do_coro_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, continue; } - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), std::bind(&do_coro_session, websocket::stream(std::move(socket)), std::placeholders::_1), - boost::asio::detached); + webcpp::asio::detached); } } @@ -378,11 +378,11 @@ int main(int argc, char** argv) { ->run(); // Create coro port - boost::asio::spawn(ioc, - std::bind(&do_coro_listen, std::ref(ioc), - tcp::endpoint{address, static_cast(port + 2u)}, - std::placeholders::_1), - boost::asio::detached); + webcpp::asio::spawn(ioc, + std::bind(&do_coro_listen, std::ref(ioc), + tcp::endpoint{address, static_cast(port + 2u)}, + std::placeholders::_1), + webcpp::asio::detached); // Run the I/O service on the requested number of threads std::vector v; diff --git a/example/applications/noexcept-native/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp b/example/applications/noexcept-native/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp index cf12752..29b57b1 100644 --- a/example/applications/noexcept-native/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp +++ b/example/applications/noexcept-native/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp @@ -35,11 +35,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include -#include #include #include #include @@ -47,14 +42,19 @@ #include #include #include +#include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -67,7 +67,7 @@ void fail(beast::error_code ec, char const* what) { // Echoes back all received WebSocket messages // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { websocket::stream> ws_; beast::flat_buffer buffer_; @@ -86,7 +86,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -174,7 +174,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -182,7 +182,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; ssl::context& ctx_; tcp::acceptor acceptor_; @@ -238,7 +238,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -264,7 +264,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/server/stackless/websocket_server_stackless.cpp b/example/applications/noexcept-native/websocket/server/stackless/websocket_server_stackless.cpp index b8d4ac2..4c3c0a3 100644 --- a/example/applications/noexcept-native/websocket/server/stackless/websocket_server_stackless.cpp +++ b/example/applications/noexcept-native/websocket/server/stackless/websocket_server_stackless.cpp @@ -32,9 +32,6 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include @@ -42,13 +39,16 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -61,7 +61,7 @@ void fail(beast::error_code ec, char const* what) { // Echoes back all received WebSocket messages // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { websocket::stream ws_; beast::flat_buffer buffer_; @@ -80,7 +80,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -147,7 +147,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -155,7 +155,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -210,7 +210,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -236,7 +236,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp b/example/applications/noexcept-native/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp index 58a8d4b..5d65617 100644 --- a/example/applications/noexcept-native/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp +++ b/example/applications/noexcept-native/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp @@ -35,22 +35,22 @@ #include "common/server_certificate.hpp" -#include -#include -#include #include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-native/websocket/server/sync/websocket_server_sync.cpp b/example/applications/noexcept-native/websocket/server/sync/websocket_server_sync.cpp index 76cabdc..735869f 100644 --- a/example/applications/noexcept-native/websocket/server/sync/websocket_server_sync.cpp +++ b/example/applications/noexcept-native/websocket/server/sync/websocket_server_sync.cpp @@ -32,19 +32,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp b/example/applications/noexcept-single/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp index 05807c3..df7907e 100644 --- a/example/applications/noexcept-single/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp +++ b/example/applications/noexcept-single/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp @@ -36,18 +36,18 @@ #include "common/server_certificate.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -63,8 +63,8 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; -namespace ssl = boost::asio::ssl; +namespace net = webcpp::asio; +namespace ssl = webcpp::asio::ssl; using executor_type = net::strand; using stream_type = beast::tcp_stream::rebind_executor::other; diff --git a/example/applications/noexcept-single/advanced/server-flex/advanced_server_flex.cpp b/example/applications/noexcept-single/advanced/server-flex/advanced_server_flex.cpp index 2e0ff3d..b288c94 100644 --- a/example/applications/noexcept-single/advanced/server-flex/advanced_server_flex.cpp +++ b/example/applications/noexcept-single/advanced/server-flex/advanced_server_flex.cpp @@ -35,14 +35,12 @@ #include "common/server_certificate.hpp" -#include -#include -#include +#include +#include #include +#include #include -#include -#include #include #include #include @@ -50,15 +48,17 @@ #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/advanced/server/advanced_server.cpp b/example/applications/noexcept-single/advanced/server/advanced_server.cpp index 2d549f5..d662cb3 100644 --- a/example/applications/noexcept-single/advanced/server/advanced_server.cpp +++ b/example/applications/noexcept-single/advanced/server/advanced_server.cpp @@ -32,12 +32,11 @@ // //------------------------------------------------------------------------------ -#include -#include +#include +#include #include #include -#include #include #include #include @@ -46,14 +45,15 @@ #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/common/root_certificates.hpp b/example/applications/noexcept-single/common/root_certificates.hpp index af6048d..2148599 100644 --- a/example/applications/noexcept-single/common/root_certificates.hpp +++ b/example/applications/noexcept-single/common/root_certificates.hpp @@ -29,8 +29,8 @@ #ifndef BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP #define BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP -#include #include +#include /* PLEASE READ @@ -57,7 +57,7 @@ tl;dr: root_certificates.hpp should not be used in production code */ -namespace ssl = boost::asio::ssl; // from +namespace ssl = webcpp::asio::ssl; // from namespace detail { @@ -3959,7 +3959,7 @@ inline void load_root_certificates(ssl::context& ctx, boost::system::error_code& static_cast( // The ec output and the returned reference carry the same operation status. // NOLINTNEXTLINE(bugprone-unused-return-value) - ctx.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()), ec)); + ctx.add_certificate_authority(webcpp::asio::buffer(cert.data(), cert.size()), ec)); if (ec) { return; } diff --git a/example/applications/noexcept-single/common/server_certificate.hpp b/example/applications/noexcept-single/common/server_certificate.hpp index ff0fe0a..d15abec 100644 --- a/example/applications/noexcept-single/common/server_certificate.hpp +++ b/example/applications/noexcept-single/common/server_certificate.hpp @@ -29,10 +29,10 @@ #ifndef BOOST_BEAST_EXAMPLE_COMMON_SERVER_CERTIFICATE_HPP #define BOOST_BEAST_EXAMPLE_COMMON_SERVER_CERTIFICATE_HPP -#include -#include #include #include +#include +#include /* Load a signed certificate into the ssl context, and configure the context for use with a server. @@ -43,11 +43,11 @@ depending on your environment Please see the documentation accompanying the Beast certificate for more details. */ -inline void load_server_certificate(boost::asio::ssl::context& ctx) { +inline void load_server_certificate(webcpp::asio::ssl::context& ctx) { if (auto const* path = std::getenv("WEBCPP_BEAST_FIXTURE_CERT")) { ctx.use_certificate_chain_file(path); ctx.use_private_key_file(std::getenv("WEBCPP_BEAST_FIXTURE_KEY"), - boost::asio::ssl::context::pem); + webcpp::asio::ssl::context::pem); return; } @@ -124,17 +124,18 @@ inline void load_server_certificate(boost::asio::ssl::context& ctx) { "-----END DH PARAMETERS-----\n"; ctx.set_password_callback( - [](std::size_t, boost::asio::ssl::context_base::password_purpose) { return "test"; }); + [](std::size_t, webcpp::asio::ssl::context_base::password_purpose) { return "test"; }); - ctx.set_options(boost::asio::ssl::context::default_workarounds | - boost::asio::ssl::context::no_sslv2 | boost::asio::ssl::context::single_dh_use); + ctx.set_options(webcpp::asio::ssl::context::default_workarounds | + webcpp::asio::ssl::context::no_sslv2 | + webcpp::asio::ssl::context::single_dh_use); - ctx.use_certificate_chain(boost::asio::buffer(cert.data(), cert.size())); + ctx.use_certificate_chain(webcpp::asio::buffer(cert.data(), cert.size())); - ctx.use_private_key(boost::asio::buffer(key.data(), key.size()), - boost::asio::ssl::context::file_format::pem); + ctx.use_private_key(webcpp::asio::buffer(key.data(), key.size()), + webcpp::asio::ssl::context::file_format::pem); - ctx.use_tmp_dh(boost::asio::buffer(dh.data(), dh.size())); + ctx.use_tmp_dh(webcpp::asio::buffer(dh.data(), dh.size())); } #endif diff --git a/example/applications/noexcept-single/doc/http_examples.hpp b/example/applications/noexcept-single/doc/http_examples.hpp index f0705f2..5e502a8 100644 --- a/example/applications/noexcept-single/doc/http_examples.hpp +++ b/example/applications/noexcept-single/doc/http_examples.hpp @@ -71,7 +71,7 @@ void send_expect_100_continue(SyncStream& stream, DynamicBuffer& buffer, request>& req, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // Insert or replace the Expect field @@ -123,7 +123,7 @@ template void receive_expect_100_continue(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // Declare a parser for a request with a string body @@ -212,8 +212,8 @@ void send_cgi_response(SyncReadStream& input, SyncWriteStream& output, error_cod do { // Read a buffer from the child process char buffer[2048]; - auto bytes_transferred = input.read_some(boost::asio::buffer(buffer, sizeof(buffer)), ec); - if (ec == boost::asio::error::eof) { + auto bytes_transferred = input.read_some(webcpp::asio::buffer(buffer, sizeof(buffer)), ec); + if (ec == webcpp::asio::error::eof) { ec = {}; // `nullptr` indicates there is no buffer @@ -263,7 +263,7 @@ void send_cgi_response(SyncReadStream& input, SyncWriteStream& output, error_cod template void do_server_head(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // We deliver this payload for all GET requests @@ -343,7 +343,7 @@ response do_head_request(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { // Do some type checking to be a good citizen static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // The interfaces we are using are low level and do not @@ -531,10 +531,10 @@ class write_ostream_helper { std::size_t bytes_transferred = 0; // Loop over the buffer sequence - for (auto it = boost::asio::buffer_sequence_begin(buffers); - it != boost::asio::buffer_sequence_end(buffers); ++it) { + for (auto it = webcpp::asio::buffer_sequence_begin(buffers); + it != webcpp::asio::buffer_sequence_end(buffers); ++it) { // This is the next buffer in the sequence - boost::asio::const_buffer const buffer = *it; + webcpp::asio::const_buffer const buffer = *it; // Write it to the std::ostream os_.write(reinterpret_cast(buffer.data()), buffer.size()); diff --git a/example/applications/noexcept-single/doc/ssl/client.cpp b/example/applications/noexcept-single/doc/ssl/client.cpp index d6a773c..53fdb3c 100644 --- a/example/applications/noexcept-single/doc/ssl/client.cpp +++ b/example/applications/noexcept-single/doc/ssl/client.cpp @@ -26,18 +26,18 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -46,7 +46,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = net::ssl; namespace { diff --git a/example/applications/noexcept-single/doc/ssl/server.cpp b/example/applications/noexcept-single/doc/ssl/server.cpp index ce98a2a..83bab6e 100644 --- a/example/applications/noexcept-single/doc/ssl/server.cpp +++ b/example/applications/noexcept-single/doc/ssl/server.cpp @@ -26,18 +26,18 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -46,7 +46,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = net::ssl; namespace { diff --git a/example/applications/noexcept-single/echo-op/echo_op.cpp b/example/applications/noexcept-single/echo-op/echo_op.cpp index 2882bd7..ca566ed 100644 --- a/example/applications/noexcept-single/echo-op/echo_op.cpp +++ b/example/applications/noexcept-single/echo-op/echo_op.cpp @@ -25,24 +25,24 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -namespace net = boost::asio; +namespace net = webcpp::asio; namespace beast = webcpp::beast; //[example_core_echo_op_1 @@ -127,7 +127,7 @@ class echo_op; // This example uses the Asio's stackless "fauxroutines", implemented // using a macro-based solution. It makes the code easier to write and // easier to read. This include file defines the necessary macros and types. -#include +#include // Read a line and echo it back // @@ -155,10 +155,10 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to net::async_completion init(token); - // The helper macro BOOST_ASIO_HANDLER_TYPE converts the completion + // The helper macro WEBCPP_ASIO_HANDLER_TYPE converts the completion // token type into a concrete handler type of the correct signature. - using handler_type = BOOST_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); + using handler_type = WEBCPP_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); // The class template `async_base` holds the caller's completion // handler for us, and provides all of the boilerplate for forwarding @@ -186,7 +186,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to // NOLINTNEXTLINE(misc-multiple-inheritance) // Asio operation state combines completion ownership with coroutine resume state. // NOLINTNEXTLINE(misc-multiple-inheritance) - struct echo_op : base_type, boost::asio::coroutine { + struct echo_op : base_type, webcpp::asio::coroutine { AsyncStream& stream; DynamicBuffer& buffer; @@ -338,7 +338,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to }; // Create the composed operation and launch it. This is a constructor - // call followed by invocation of operator(). We use BOOST_ASIO_HANDLER_TYPE + // call followed by invocation of operator(). We use WEBCPP_ASIO_HANDLER_TYPE // to convert the completion token into the correct handler type, // allowing user-defined specializations of the async_result template // to be used. @@ -354,7 +354,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to } // Including this file undefines the macros used by the stackless fauxroutines. -#include +#include //] @@ -382,7 +382,7 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } - namespace net = boost::asio; + namespace net = webcpp::asio; auto const address = net::ip::make_address(argv[1]); auto const port = static_cast(webcpp_fixture::integer(argv[2])); diff --git a/example/applications/noexcept-single/http/client/async-local/http_client_async_local.cpp b/example/applications/noexcept-single/http/client/async-local/http_client_async_local.cpp index 1345cff..46bf4b6 100644 --- a/example/applications/noexcept-single/http/client/async-local/http_client_async_local.cpp +++ b/example/applications/noexcept-single/http/client/async-local/http_client_async_local.cpp @@ -32,7 +32,7 @@ // //------------------------------------------------------------------------------ -#include +#include #include #include @@ -44,8 +44,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp b/example/applications/noexcept-single/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp index 5fa055f..7cdd414 100644 --- a/example/applications/noexcept-single/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp +++ b/example/applications/noexcept-single/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp @@ -34,19 +34,19 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -66,14 +66,14 @@ class session : public std::enable_shared_from_this { // Objects are constructed with a strand to // ensure that handlers do not execute concurrently. - session(net::strand strand, ssl::context& ctx) + session(net::strand strand, ssl::context& ctx) : resolver_(strand), stream_(strand, ctx) {} public: // Delegate construction to a prive constructor to be able to use // the same strand for both I/O object. explicit session(webcpp::asio::io_context& ioc, ssl::context& ctx) - : session(net::make_strand(boost::asio::any_io_executor(ioc.get_executor())), ctx) {} + : session(net::make_strand(webcpp::asio::any_io_executor(ioc.get_executor())), ctx) {} // Start the asynchronous operation void run(char const* host, char const* port, char const* target, int version) { diff --git a/example/applications/noexcept-single/http/client/async-ssl/http_client_async_ssl.cpp b/example/applications/noexcept-single/http/client/async-ssl/http_client_async_ssl.cpp index a069f2b..e7ea49f 100644 --- a/example/applications/noexcept-single/http/client/async-ssl/http_client_async_ssl.cpp +++ b/example/applications/noexcept-single/http/client/async-ssl/http_client_async_ssl.cpp @@ -34,18 +34,18 @@ #include "common/root_certificates.hpp" -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/http/client/async/http_client_async.cpp b/example/applications/noexcept-single/http/client/async/http_client_async.cpp index 8096dc5..83d5b6d 100644 --- a/example/applications/noexcept-single/http/client/async/http_client_async.cpp +++ b/example/applications/noexcept-single/http/client/async/http_client_async.cpp @@ -31,18 +31,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp b/example/applications/noexcept-single/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp index 5e780a8..765c6ad 100644 --- a/example/applications/noexcept-single/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp +++ b/example/applications/noexcept-single/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp @@ -32,11 +32,11 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include "common/root_certificates.hpp" @@ -49,8 +49,8 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; -namespace ssl = boost::asio::ssl; +namespace net = webcpp::asio; +namespace ssl = webcpp::asio::ssl; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/http/client/awaitable/http_client_awaitable.cpp b/example/applications/noexcept-single/http/client/awaitable/http_client_awaitable.cpp index a14b8a6..d433826 100644 --- a/example/applications/noexcept-single/http/client/awaitable/http_client_awaitable.cpp +++ b/example/applications/noexcept-single/http/client/awaitable/http_client_awaitable.cpp @@ -31,9 +31,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -44,7 +44,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/noexcept-single/http/client/body/json_body.hpp b/example/applications/noexcept-single/http/client/body/json_body.hpp index 6810a55..3c3cb31 100644 --- a/example/applications/noexcept-single/http/client/body/json_body.hpp +++ b/example/applications/noexcept-single/http/client/body/json_body.hpp @@ -35,10 +35,10 @@ #define BOOST_BEAST_EXAMPLE_JSON_BODY #include -#include #include #include #include +#include #include namespace json = boost::json; @@ -47,7 +47,7 @@ struct json_body { using value_type = json::value; struct writer { - using const_buffers_type = boost::asio::const_buffer; + using const_buffers_type = webcpp::asio::const_buffer; template writer(webcpp::beast::http::header const& /*unused*/, @@ -67,7 +67,7 @@ struct json_body { ec = {}; // We serialize as much as we can with the buffer. Often that'll suffice const auto len = serializer_.read(buffer_.data(), buffer_.size()); - return std::make_pair(boost::asio::const_buffer(len.data(), len.size()), + return std::make_pair(webcpp::asio::const_buffer(len.data(), len.size()), !serializer_.done()); } diff --git a/example/applications/noexcept-single/http/client/body/json_client.cpp b/example/applications/noexcept-single/http/client/body/json_client.cpp index f63d312..5955879 100644 --- a/example/applications/noexcept-single/http/client/body/json_client.cpp +++ b/example/applications/noexcept-single/http/client/body/json_client.cpp @@ -24,8 +24,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from int main(int /*unused*/, char** /*unused*/) { // Our test endpoint for testing the json diff --git a/example/applications/noexcept-single/http/client/coro-ssl/http_client_coro_ssl.cpp b/example/applications/noexcept-single/http/client/coro-ssl/http_client_coro_ssl.cpp index d46ea3f..6e8392b 100644 --- a/example/applications/noexcept-single/http/client/coro-ssl/http_client_coro_ssl.cpp +++ b/example/applications/noexcept-single/http/client/coro-ssl/http_client_coro_ssl.cpp @@ -34,21 +34,21 @@ #include "common/root_certificates.hpp" -#include -#include #include #include #include #include #include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -184,7 +184,7 @@ int main(int argc, char** argv) { ctx.set_verify_mode(ssl::verify_peer); // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, std::bind(&do_session, std::string(host), std::string(port), std::string(target), version, std::ref(ioc), std::ref(ctx), std::placeholders::_1), diff --git a/example/applications/noexcept-single/http/client/coro/http_client_coro.cpp b/example/applications/noexcept-single/http/client/coro/http_client_coro.cpp index fea9d67..216282a 100644 --- a/example/applications/noexcept-single/http/client/coro/http_client_coro.cpp +++ b/example/applications/noexcept-single/http/client/coro/http_client_coro.cpp @@ -31,19 +31,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -136,7 +136,7 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc; // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, std::bind(&do_session, std::string(host), std::string(port), std::string(target), version, std::ref(ioc), std::placeholders::_1), diff --git a/example/applications/noexcept-single/http/client/crawl/http_crawl.cpp b/example/applications/noexcept-single/http/client/crawl/http_crawl.cpp index 354875c..55686d8 100644 --- a/example/applications/noexcept-single/http/client/crawl/http_crawl.cpp +++ b/example/applications/noexcept-single/http/client/crawl/http_crawl.cpp @@ -34,11 +34,6 @@ #include "urls_large_data.hpp" #include -#include -#include -#include -#include -#include #include #include #include @@ -46,6 +41,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -54,8 +54,8 @@ namespace chrono = std::chrono; // from namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/http/client/methods/http_client_methods.cpp b/example/applications/noexcept-single/http/client/methods/http_client_methods.cpp index 096b6c8..d282f3f 100644 --- a/example/applications/noexcept-single/http/client/methods/http_client_methods.cpp +++ b/example/applications/noexcept-single/http/client/methods/http_client_methods.cpp @@ -33,17 +33,17 @@ //[example_http_client_methods -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from // perform a get request namespace { diff --git a/example/applications/noexcept-single/http/client/sync-ssl/http_client_sync_ssl.cpp b/example/applications/noexcept-single/http/client/sync-ssl/http_client_sync_ssl.cpp index bf1059c..d17a7fc 100644 --- a/example/applications/noexcept-single/http/client/sync-ssl/http_client_sync_ssl.cpp +++ b/example/applications/noexcept-single/http/client/sync-ssl/http_client_sync_ssl.cpp @@ -34,18 +34,18 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = net::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = net::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/noexcept-single/http/client/sync/http_client_sync.cpp b/example/applications/noexcept-single/http/client/sync/http_client_sync.cpp index 7191389..33715b3 100644 --- a/example/applications/noexcept-single/http/client/sync/http_client_sync.cpp +++ b/example/applications/noexcept-single/http/client/sync/http_client_sync.cpp @@ -33,17 +33,17 @@ //[example_http_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/noexcept-single/http/server/async-local/http_server_async_local.cpp b/example/applications/noexcept-single/http/server/async-local/http_server_async_local.cpp index f4203f9..f255cea 100644 --- a/example/applications/noexcept-single/http/server/async-local/http_server_async_local.cpp +++ b/example/applications/noexcept-single/http/server/async-local/http_server_async_local.cpp @@ -32,10 +32,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include #include +#include +#include +#include #include #include @@ -50,8 +50,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/http/server/async-ssl/http_server_async_ssl.cpp b/example/applications/noexcept-single/http/server/async-ssl/http_server_async_ssl.cpp index f01a75c..0a7f6e0 100644 --- a/example/applications/noexcept-single/http/server/async-ssl/http_server_async_ssl.cpp +++ b/example/applications/noexcept-single/http/server/async-ssl/http_server_async_ssl.cpp @@ -35,23 +35,23 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/http/server/async/http_server_async.cpp b/example/applications/noexcept-single/http/server/async/http_server_async.cpp index d0b4393..052b398 100644 --- a/example/applications/noexcept-single/http/server/async/http_server_async.cpp +++ b/example/applications/noexcept-single/http/server/async/http_server_async.cpp @@ -32,22 +32,22 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include #include #include #include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/http/server/awaitable/http_server_awaitable.cpp b/example/applications/noexcept-single/http/server/awaitable/http_server_awaitable.cpp index 4ca2cff..02220ad 100644 --- a/example/applications/noexcept-single/http/server/awaitable/http_server_awaitable.cpp +++ b/example/applications/noexcept-single/http/server/awaitable/http_server_awaitable.cpp @@ -31,11 +31,11 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include @@ -50,7 +50,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/http/server/coro-ssl/http_server_coro_ssl.cpp b/example/applications/noexcept-single/http/server/coro-ssl/http_server_coro_ssl.cpp index 8faff66..8b1cd6e 100644 --- a/example/applications/noexcept-single/http/server/coro-ssl/http_server_coro_ssl.cpp +++ b/example/applications/noexcept-single/http/server/coro-ssl/http_server_coro_ssl.cpp @@ -35,15 +35,15 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include #include @@ -51,9 +51,9 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. beast::string_view mime_type(beast::string_view path) { @@ -341,13 +341,13 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e if (ec) fail(ec, "accept"); else - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), std::bind(&do_session, ssl::stream(std::move(socket), ctx), doc_root, std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } @@ -376,20 +376,20 @@ int main(int argc, char** argv) { load_server_certificate(ctx); // Spawn a listening port - boost::asio::spawn(ioc, - std::bind(&do_listen, std::ref(ioc), std::ref(ctx), - tcp::endpoint{address, port}, doc_root, std::placeholders::_1), - // on completion, spawn will call this function - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) - webcpp_fixture::fail_stop(); - }); + webcpp::asio::spawn(ioc, + std::bind(&do_listen, std::ref(ioc), std::ref(ctx), + tcp::endpoint{address, port}, doc_root, std::placeholders::_1), + // on completion, spawn will call this function + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) + webcpp_fixture::fail_stop(); + }); // Run the I/O service on the requested number of threads ioc.run(); // lint-run: drives the application's network operations diff --git a/example/applications/noexcept-single/http/server/coro/http_server_coro.cpp b/example/applications/noexcept-single/http/server/coro/http_server_coro.cpp index c8dc14e..f85465b 100644 --- a/example/applications/noexcept-single/http/server/coro/http_server_coro.cpp +++ b/example/applications/noexcept-single/http/server/coro/http_server_coro.cpp @@ -32,15 +32,15 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include #include @@ -48,8 +48,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. beast::string_view mime_type(beast::string_view path) { @@ -305,12 +305,12 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, if (ec) fail(ec, "accept"); else - boost::asio::spawn(acceptor.get_executor(), - std::bind(&do_session, beast::tcp_stream(std::move(socket)), - doc_root, std::placeholders::_1), - // we ignore the result of the session, - // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::spawn(acceptor.get_executor(), + std::bind(&do_session, beast::tcp_stream(std::move(socket)), + doc_root, std::placeholders::_1), + // we ignore the result of the session, + // most errors are handled with error_code + webcpp::asio::detached); } } @@ -333,20 +333,20 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc{threads}; // Spawn a listening port - boost::asio::spawn(ioc, - std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, doc_root, - std::placeholders::_1), - // on completion, spawn will call this function - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) - webcpp_fixture::fail_stop(); - }); + webcpp::asio::spawn(ioc, + std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, doc_root, + std::placeholders::_1), + // on completion, spawn will call this function + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) + webcpp_fixture::fail_stop(); + }); // Run the I/O service on the requested number of threads ioc.run(); // lint-run: drives the application's network operations diff --git a/example/applications/noexcept-single/http/server/fast/http_server_fast.cpp b/example/applications/noexcept-single/http/server/fast/http_server_fast.cpp index cdf03fa..39b0a0f 100644 --- a/example/applications/noexcept-single/http/server/fast/http_server_fast.cpp +++ b/example/applications/noexcept-single/http/server/fast/http_server_fast.cpp @@ -33,17 +33,6 @@ #include "fields_alloc.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -51,12 +40,23 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/http/server/flex/http_server_flex.cpp b/example/applications/noexcept-single/http/server/flex/http_server_flex.cpp index c93219e..120d4dc 100644 --- a/example/applications/noexcept-single/http/server/flex/http_server_flex.cpp +++ b/example/applications/noexcept-single/http/server/flex/http_server_flex.cpp @@ -35,21 +35,21 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/http/server/small/http_server_small.cpp b/example/applications/noexcept-single/http/server/small/http_server_small.cpp index e819fc4..a1fdfd7 100644 --- a/example/applications/noexcept-single/http/server/small/http_server_small.cpp +++ b/example/applications/noexcept-single/http/server/small/http_server_small.cpp @@ -31,29 +31,29 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from namespace { namespace my_program_state { diff --git a/example/applications/noexcept-single/http/server/stackless-ssl/http_server_stackless_ssl.cpp b/example/applications/noexcept-single/http/server/stackless-ssl/http_server_stackless_ssl.cpp index 8996b5d..d58d17c 100644 --- a/example/applications/noexcept-single/http/server/stackless-ssl/http_server_stackless_ssl.cpp +++ b/example/applications/noexcept-single/http/server/stackless-ssl/http_server_stackless_ssl.cpp @@ -35,25 +35,25 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -286,7 +286,7 @@ void fail(beast::error_code ec, char const* what) { // Handles an HTTP server connection // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { ssl::stream stream_; beast::flat_buffer buffer_; std::shared_ptr doc_root_; @@ -310,7 +310,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -402,7 +402,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -410,7 +410,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; ssl::context& ctx_; tcp::acceptor acceptor_; @@ -472,7 +472,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -498,7 +498,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/http/server/stackless/http_server_stackless.cpp b/example/applications/noexcept-single/http/server/stackless/http_server_stackless.cpp index c94f167..3f9ade7 100644 --- a/example/applications/noexcept-single/http/server/stackless/http_server_stackless.cpp +++ b/example/applications/noexcept-single/http/server/stackless/http_server_stackless.cpp @@ -32,23 +32,23 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -260,7 +260,7 @@ void fail(beast::error_code ec, char const* what) { // Handles an HTTP server connection // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { beast::tcp_stream stream_; beast::flat_buffer buffer_; std::shared_ptr doc_root_; @@ -283,7 +283,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -349,7 +349,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -357,7 +357,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -417,7 +417,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -441,7 +441,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/http/server/sync-ssl/http_server_sync_ssl.cpp b/example/applications/noexcept-single/http/server/sync-ssl/http_server_sync_ssl.cpp index 5d96f9d..02f5b12 100644 --- a/example/applications/noexcept-single/http/server/sync-ssl/http_server_sync_ssl.cpp +++ b/example/applications/noexcept-single/http/server/sync-ssl/http_server_sync_ssl.cpp @@ -34,21 +34,21 @@ #include "common/server_certificate.hpp" -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/noexcept-single/http/server/sync/http_server_sync.cpp b/example/applications/noexcept-single/http/server/sync/http_server_sync.cpp index 6f843ef..ecfe757 100644 --- a/example/applications/noexcept-single/http/server/sync/http_server_sync.cpp +++ b/example/applications/noexcept-single/http/server/sync/http_server_sync.cpp @@ -31,18 +31,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/client/async-local/websocket_client_async_local.cpp b/example/applications/noexcept-single/websocket/client/async-local/websocket_client_async_local.cpp index 57d5b49..703164a 100644 --- a/example/applications/noexcept-single/websocket/client/async-local/websocket_client_async_local.cpp +++ b/example/applications/noexcept-single/websocket/client/async-local/websocket_client_async_local.cpp @@ -33,8 +33,8 @@ // //------------------------------------------------------------------------------ -#include -#include +#include +#include #include #include @@ -47,8 +47,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp b/example/applications/noexcept-single/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp index e2230d7..cdce2fa 100644 --- a/example/applications/noexcept-single/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp +++ b/example/applications/noexcept-single/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp @@ -35,22 +35,22 @@ #include "common/root_certificates.hpp" -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -70,14 +70,14 @@ class session : public std::enable_shared_from_this { // Objects are constructed with a strand to // ensure that handlers do not execute concurrently. - session(net::strand ex, ssl::context& ctx) + session(net::strand ex, ssl::context& ctx) : resolver_(ex), ws_(ex, ctx) {} public: // Delegate construction to a prive constructor to be able to use // the same strand for both I/O objects. explicit session(webcpp::asio::io_context& ioc, ssl::context& ctx) - : session(net::make_strand(boost::asio::any_io_executor(ioc.get_executor())), ctx) {} + : session(net::make_strand(webcpp::asio::any_io_executor(ioc.get_executor())), ctx) {} // Start the asynchronous operation void run(char const* host, char const* port, char const* text) { diff --git a/example/applications/noexcept-single/websocket/client/async-ssl/websocket_client_async_ssl.cpp b/example/applications/noexcept-single/websocket/client/async-ssl/websocket_client_async_ssl.cpp index 9316135..9b5def4 100644 --- a/example/applications/noexcept-single/websocket/client/async-ssl/websocket_client_async_ssl.cpp +++ b/example/applications/noexcept-single/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -35,21 +35,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/client/async/websocket_client_async.cpp b/example/applications/noexcept-single/websocket/client/async/websocket_client_async.cpp index 54f434a..a942230 100644 --- a/example/applications/noexcept-single/websocket/client/async/websocket_client_async.cpp +++ b/example/applications/noexcept-single/websocket/client/async/websocket_client_async.cpp @@ -32,19 +32,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/client/awaitable/websocket_client_awaitable.cpp b/example/applications/noexcept-single/websocket/client/awaitable/websocket_client_awaitable.cpp index e81d13e..e0318e0 100644 --- a/example/applications/noexcept-single/websocket/client/awaitable/websocket_client_awaitable.cpp +++ b/example/applications/noexcept-single/websocket/client/awaitable/websocket_client_awaitable.cpp @@ -32,9 +32,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -46,7 +46,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/noexcept-single/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp b/example/applications/noexcept-single/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp index cce1e10..fc7c9d7 100644 --- a/example/applications/noexcept-single/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp +++ b/example/applications/noexcept-single/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp @@ -35,22 +35,22 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -174,7 +174,7 @@ int main(int argc, char** argv) { load_root_certificates(ctx); // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, std::bind(&do_session, std::string(host), std::string(port), std::string(text), std::ref(ioc), std::ref(ctx), std::placeholders::_1), diff --git a/example/applications/noexcept-single/websocket/client/coro/websocket_client_coro.cpp b/example/applications/noexcept-single/websocket/client/coro/websocket_client_coro.cpp index a6ecac5..9bef562 100644 --- a/example/applications/noexcept-single/websocket/client/coro/websocket_client_coro.cpp +++ b/example/applications/noexcept-single/websocket/client/coro/websocket_client_coro.cpp @@ -32,19 +32,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -142,20 +142,20 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc; // Launch the asynchronous operation - boost::asio::spawn(ioc, - std::bind(&do_session, std::string(host), std::string(port), - std::string(text), std::ref(ioc), std::placeholders::_1), - // on completion, spawn will call this function - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) - webcpp_fixture::fail_stop(); - }); + webcpp::asio::spawn(ioc, + std::bind(&do_session, std::string(host), std::string(port), + std::string(text), std::ref(ioc), std::placeholders::_1), + // on completion, spawn will call this function + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) + webcpp_fixture::fail_stop(); + }); // Run the I/O service. The call will return when // the socket is closed. diff --git a/example/applications/noexcept-single/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp b/example/applications/noexcept-single/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp index 84f9d5c..96fa8fe 100644 --- a/example/applications/noexcept-single/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp +++ b/example/applications/noexcept-single/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp @@ -35,21 +35,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include -#include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/noexcept-single/websocket/client/sync/websocket_client_sync.cpp b/example/applications/noexcept-single/websocket/client/sync/websocket_client_sync.cpp index 2b81742..004db91 100644 --- a/example/applications/noexcept-single/websocket/client/sync/websocket_client_sync.cpp +++ b/example/applications/noexcept-single/websocket/client/sync/websocket_client_sync.cpp @@ -34,18 +34,18 @@ //[example_websocket_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/noexcept-single/websocket/server/async-local/websocket_server_async_local.cpp b/example/applications/noexcept-single/websocket/server/async-local/websocket_server_async_local.cpp index d9dc040..75bba65 100644 --- a/example/applications/noexcept-single/websocket/server/async-local/websocket_server_async_local.cpp +++ b/example/applications/noexcept-single/websocket/server/async-local/websocket_server_async_local.cpp @@ -33,9 +33,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -51,8 +51,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/server/async-ssl/websocket_server_async_ssl.cpp b/example/applications/noexcept-single/websocket/server/async-ssl/websocket_server_async_ssl.cpp index d544ef9..7a85bcc 100644 --- a/example/applications/noexcept-single/websocket/server/async-ssl/websocket_server_async_ssl.cpp +++ b/example/applications/noexcept-single/websocket/server/async-ssl/websocket_server_async_ssl.cpp @@ -36,24 +36,24 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/server/async/websocket_server_async.cpp b/example/applications/noexcept-single/websocket/server/async/websocket_server_async.cpp index 1c6363a..a5f95e6 100644 --- a/example/applications/noexcept-single/websocket/server/async/websocket_server_async.cpp +++ b/example/applications/noexcept-single/websocket/server/async/websocket_server_async.cpp @@ -33,13 +33,13 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include #include #include +#include +#include #include #include @@ -47,8 +47,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/server/awaitable/websocket_server_awaitable.cpp b/example/applications/noexcept-single/websocket/server/awaitable/websocket_server_awaitable.cpp index 69891ef..ab5959d 100644 --- a/example/applications/noexcept-single/websocket/server/awaitable/websocket_server_awaitable.cpp +++ b/example/applications/noexcept-single/websocket/server/awaitable/websocket_server_awaitable.cpp @@ -32,10 +32,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -50,7 +50,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Echoes back all received WebSocket messages namespace { diff --git a/example/applications/noexcept-single/websocket/server/chat-multi/net.hpp b/example/applications/noexcept-single/websocket/server/chat-multi/net.hpp index ca25c6c..bf8655d 100644 --- a/example/applications/noexcept-single/websocket/server/chat-multi/net.hpp +++ b/example/applications/noexcept-single/websocket/server/chat-multi/net.hpp @@ -28,20 +28,19 @@ #ifndef BOOST_BEAST_EXAMPLE_WEBSOCKET_CHAT_MULTI_NET_HPP #define BOOST_BEAST_EXAMPLE_WEBSOCKET_CHAT_MULTI_NET_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from #endif diff --git a/example/applications/noexcept-single/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp b/example/applications/noexcept-single/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp index bb678e4..873b176 100644 --- a/example/applications/noexcept-single/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp +++ b/example/applications/noexcept-single/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp @@ -36,25 +36,25 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -149,14 +149,14 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e if (ec) fail(ec, "accept"); else - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), std::bind(&do_session, websocket::stream>(std::move(socket), ctx), std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } @@ -184,20 +184,20 @@ int main(int argc, char** argv) { load_server_certificate(ctx); // Spawn a listening port - boost::asio::spawn(ioc, - std::bind(&do_listen, std::ref(ioc), std::ref(ctx), - tcp::endpoint{address, port}, std::placeholders::_1), - // on completion, spawn will call this function - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) - webcpp_fixture::fail_stop(); - }); + webcpp::asio::spawn(ioc, + std::bind(&do_listen, std::ref(ioc), std::ref(ctx), + tcp::endpoint{address, port}, std::placeholders::_1), + // on completion, spawn will call this function + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) + webcpp_fixture::fail_stop(); + }); // Run the I/O service on the requested number of threads ioc.run(); // lint-run: drives the application's network operations diff --git a/example/applications/noexcept-single/websocket/server/coro/websocket_server_coro.cpp b/example/applications/noexcept-single/websocket/server/coro/websocket_server_coro.cpp index fc193e6..74b099a 100644 --- a/example/applications/noexcept-single/websocket/server/coro/websocket_server_coro.cpp +++ b/example/applications/noexcept-single/websocket/server/coro/websocket_server_coro.cpp @@ -33,13 +33,13 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include #include #include +#include +#include #include #include @@ -48,8 +48,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -131,13 +131,13 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, net::yield if (ec) fail(ec, "accept"); else - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), std::bind(&do_session, websocket::stream(std::move(socket)), std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } @@ -159,7 +159,7 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc(threads); // Spawn a listening port - boost::asio::spawn( + webcpp::asio::spawn( ioc, std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, std::placeholders::_1), // on completion, spawn will call this function diff --git a/example/applications/noexcept-single/websocket/server/fast/websocket_server_fast.cpp b/example/applications/noexcept-single/websocket/server/fast/websocket_server_fast.cpp index eb24976..aea706a 100644 --- a/example/applications/noexcept-single/websocket/server/fast/websocket_server_fast.cpp +++ b/example/applications/noexcept-single/websocket/server/fast/websocket_server_fast.cpp @@ -46,15 +46,15 @@ */ #include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include #include #include @@ -64,8 +64,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -289,11 +289,11 @@ void do_coro_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, continue; } - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), std::bind(&do_coro_session, websocket::stream(std::move(socket)), std::placeholders::_1), - boost::asio::detached); + webcpp::asio::detached); } } @@ -329,11 +329,11 @@ int main(int argc, char** argv) { ->run(); // Create coro port - boost::asio::spawn(ioc, - std::bind(&do_coro_listen, std::ref(ioc), - tcp::endpoint{address, static_cast(port + 2u)}, - std::placeholders::_1), - boost::asio::detached); + webcpp::asio::spawn(ioc, + std::bind(&do_coro_listen, std::ref(ioc), + tcp::endpoint{address, static_cast(port + 2u)}, + std::placeholders::_1), + webcpp::asio::detached); // Run the I/O service on the requested number of threads ioc.run(); // lint-run: drives the application's network operations diff --git a/example/applications/noexcept-single/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp b/example/applications/noexcept-single/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp index ae1cf04..262c275 100644 --- a/example/applications/noexcept-single/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp +++ b/example/applications/noexcept-single/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp @@ -36,26 +36,26 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include -#include #include #include #include #include #include +#include +#include +#include +#include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -68,7 +68,7 @@ void fail(beast::error_code ec, char const* what) { // Echoes back all received WebSocket messages // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { websocket::stream> ws_; beast::flat_buffer buffer_; @@ -87,7 +87,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -175,7 +175,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -183,7 +183,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; ssl::context& ctx_; tcp::acceptor acceptor_; @@ -239,7 +239,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -265,7 +265,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/server/stackless/websocket_server_stackless.cpp b/example/applications/noexcept-single/websocket/server/stackless/websocket_server_stackless.cpp index 39064d9..9445a54 100644 --- a/example/applications/noexcept-single/websocket/server/stackless/websocket_server_stackless.cpp +++ b/example/applications/noexcept-single/websocket/server/stackless/websocket_server_stackless.cpp @@ -33,14 +33,14 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include #include @@ -48,8 +48,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -62,7 +62,7 @@ void fail(beast::error_code ec, char const* what) { // Echoes back all received WebSocket messages // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { websocket::stream ws_; beast::flat_buffer buffer_; @@ -81,7 +81,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -148,7 +148,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -156,7 +156,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -211,7 +211,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -237,7 +237,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp b/example/applications/noexcept-single/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp index 23f1c41..fe4e47a 100644 --- a/example/applications/noexcept-single/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp +++ b/example/applications/noexcept-single/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp @@ -36,21 +36,21 @@ #include "common/server_certificate.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/noexcept-single/websocket/server/sync/websocket_server_sync.cpp b/example/applications/noexcept-single/websocket/server/sync/websocket_server_sync.cpp index a9ff76e..d3c188e 100644 --- a/example/applications/noexcept-single/websocket/server/sync/websocket_server_sync.cpp +++ b/example/applications/noexcept-single/websocket/server/sync/websocket_server_sync.cpp @@ -33,18 +33,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp b/example/applications/port/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp index 10d3933..6415720 100644 --- a/example/applications/port/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp +++ b/example/applications/port/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp @@ -34,8 +34,7 @@ #include "common/server_certificate.hpp" -#include -#include +#include #include #include @@ -51,8 +50,8 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; -namespace ssl = boost::asio::ssl; +namespace net = webcpp::asio; +namespace ssl = webcpp::asio::ssl; using executor_type = net::strand; using stream_type = beast::tcp_stream::rebind_executor::other; diff --git a/example/applications/port/advanced/server-flex/advanced_server_flex.cpp b/example/applications/port/advanced/server-flex/advanced_server_flex.cpp index 543a23b..f4ba692 100644 --- a/example/applications/port/advanced/server-flex/advanced_server_flex.cpp +++ b/example/applications/port/advanced/server-flex/advanced_server_flex.cpp @@ -34,12 +34,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include -#include -#include #include #include #include @@ -49,14 +43,20 @@ #include #include #include +#include +#include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/advanced/server/advanced_server.cpp b/example/applications/port/advanced/server/advanced_server.cpp index c4576d5..ac2f856 100644 --- a/example/applications/port/advanced/server/advanced_server.cpp +++ b/example/applications/port/advanced/server/advanced_server.cpp @@ -31,10 +31,6 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include -#include #include #include #include @@ -45,13 +41,17 @@ #include #include #include +#include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/common/root_certificates.hpp b/example/applications/port/common/root_certificates.hpp index 2e3fb7b..57feee7 100644 --- a/example/applications/port/common/root_certificates.hpp +++ b/example/applications/port/common/root_certificates.hpp @@ -27,8 +27,8 @@ #ifndef BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP #define BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP -#include #include +#include /* PLEASE READ @@ -55,7 +55,7 @@ tl;dr: root_certificates.hpp should not be used in production code */ -namespace ssl = boost::asio::ssl; // from +namespace ssl = webcpp::asio::ssl; // from namespace detail { @@ -3957,7 +3957,7 @@ inline void load_root_certificates(ssl::context& ctx, boost::system::error_code& static_cast( // The ec output and the returned reference carry the same operation status. // NOLINTNEXTLINE(bugprone-unused-return-value) - ctx.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()), ec)); + ctx.add_certificate_authority(webcpp::asio::buffer(cert.data(), cert.size()), ec)); if (ec) { return; } diff --git a/example/applications/port/common/server_certificate.hpp b/example/applications/port/common/server_certificate.hpp index ef15c16..fa2dedb 100644 --- a/example/applications/port/common/server_certificate.hpp +++ b/example/applications/port/common/server_certificate.hpp @@ -27,10 +27,10 @@ #ifndef BOOST_BEAST_EXAMPLE_COMMON_SERVER_CERTIFICATE_HPP #define BOOST_BEAST_EXAMPLE_COMMON_SERVER_CERTIFICATE_HPP -#include -#include #include #include +#include +#include /* Load a signed certificate into the ssl context, and configure the context for use with a server. @@ -41,11 +41,11 @@ depending on your environment Please see the documentation accompanying the Beast certificate for more details. */ -inline void load_server_certificate(boost::asio::ssl::context& ctx) { +inline void load_server_certificate(webcpp::asio::ssl::context& ctx) { if (auto const* path = std::getenv("WEBCPP_BEAST_FIXTURE_CERT")) { ctx.use_certificate_chain_file(path); ctx.use_private_key_file(std::getenv("WEBCPP_BEAST_FIXTURE_KEY"), - boost::asio::ssl::context::pem); + webcpp::asio::ssl::context::pem); return; } @@ -122,17 +122,18 @@ inline void load_server_certificate(boost::asio::ssl::context& ctx) { "-----END DH PARAMETERS-----\n"; ctx.set_password_callback( - [](std::size_t, boost::asio::ssl::context_base::password_purpose) { return "test"; }); + [](std::size_t, webcpp::asio::ssl::context_base::password_purpose) { return "test"; }); - ctx.set_options(boost::asio::ssl::context::default_workarounds | - boost::asio::ssl::context::no_sslv2 | boost::asio::ssl::context::single_dh_use); + ctx.set_options(webcpp::asio::ssl::context::default_workarounds | + webcpp::asio::ssl::context::no_sslv2 | + webcpp::asio::ssl::context::single_dh_use); - ctx.use_certificate_chain(boost::asio::buffer(cert.data(), cert.size())); + ctx.use_certificate_chain(webcpp::asio::buffer(cert.data(), cert.size())); - ctx.use_private_key(boost::asio::buffer(key.data(), key.size()), - boost::asio::ssl::context::file_format::pem); + ctx.use_private_key(webcpp::asio::buffer(key.data(), key.size()), + webcpp::asio::ssl::context::file_format::pem); - ctx.use_tmp_dh(boost::asio::buffer(dh.data(), dh.size())); + ctx.use_tmp_dh(webcpp::asio::buffer(dh.data(), dh.size())); } #endif diff --git a/example/applications/port/doc/http_examples.hpp b/example/applications/port/doc/http_examples.hpp index 74cade2..82348e9 100644 --- a/example/applications/port/doc/http_examples.hpp +++ b/example/applications/port/doc/http_examples.hpp @@ -37,7 +37,7 @@ // The documentation assumes the webcpp::beast::http namespace -namespace boost::beast::http { +namespace webcpp::beast::http { //------------------------------------------------------------------------------ // @@ -70,7 +70,7 @@ void send_expect_100_continue(SyncStream& stream, DynamicBuffer& buffer, request>& req, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // Insert or replace the Expect field @@ -124,7 +124,7 @@ template void receive_expect_100_continue(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // Declare a parser for a request with a string body @@ -216,8 +216,8 @@ void send_cgi_response(SyncReadStream& input, SyncWriteStream& output, error_cod do { // Read a buffer from the child process std::array buffer{}; - auto bytes_transferred = input.read_some(boost::asio::buffer(buffer), ec); - if (ec == boost::asio::error::eof) { + auto bytes_transferred = input.read_some(webcpp::asio::buffer(buffer), ec); + if (ec == webcpp::asio::error::eof) { ec = {}; // `nullptr` indicates there is no buffer @@ -269,7 +269,7 @@ void send_cgi_response(SyncReadStream& input, SyncWriteStream& output, error_cod template void do_server_head(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // We deliver this payload for all GET requests @@ -351,7 +351,7 @@ response do_head_request(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { // Do some type checking to be a good citizen static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // The interfaces we are using are low level and do not @@ -549,10 +549,10 @@ class write_ostream_helper { std::size_t bytes_transferred = 0; // Loop over the buffer sequence - for (auto it = boost::asio::buffer_sequence_begin(buffers); - it != boost::asio::buffer_sequence_end(buffers); ++it) { + for (auto it = webcpp::asio::buffer_sequence_begin(buffers); + it != webcpp::asio::buffer_sequence_end(buffers); ++it) { // This is the next buffer in the sequence - boost::asio::const_buffer const buffer = *it; + webcpp::asio::const_buffer const buffer = *it; // Write it to the std::ostream if (buffer.size() > @@ -946,4 +946,4 @@ void print_chunked_body(std::ostream& os, SyncReadStream& stream, DynamicBuffer& //] -} // namespace boost::beast::http +} // namespace webcpp::beast::http diff --git a/example/applications/port/doc/ssl/client.cpp b/example/applications/port/doc/ssl/client.cpp index d127f81..e86c5e2 100644 --- a/example/applications/port/doc/ssl/client.cpp +++ b/example/applications/port/doc/ssl/client.cpp @@ -24,8 +24,7 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include +#include #include #include @@ -34,7 +33,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = net::ssl; namespace { diff --git a/example/applications/port/doc/ssl/server.cpp b/example/applications/port/doc/ssl/server.cpp index e1f3c48..f95cad1 100644 --- a/example/applications/port/doc/ssl/server.cpp +++ b/example/applications/port/doc/ssl/server.cpp @@ -24,8 +24,7 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include +#include #include #include @@ -34,7 +33,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = net::ssl; namespace { diff --git a/example/applications/port/echo-op/echo_op.cpp b/example/applications/port/echo-op/echo_op.cpp index 0b5f115..920ead2 100644 --- a/example/applications/port/echo-op/echo_op.cpp +++ b/example/applications/port/echo-op/echo_op.cpp @@ -23,14 +23,13 @@ // Official repository: https://github.com/boostorg/beast // -#include #include #include #include #include #include -namespace net = boost::asio; +namespace net = webcpp::asio; namespace beast = webcpp::beast; namespace { @@ -114,7 +113,7 @@ class echo_op; // This example uses the Asio's stackless "fauxroutines", implemented // using a macro-based solution. It makes the code easier to write and // easier to read. This include file defines the necessary macros and types. -#include +#include // Read a line and echo it back // @@ -140,10 +139,10 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to net::async_completion init(token); - // The helper macro BOOST_ASIO_HANDLER_TYPE converts the completion + // The helper macro WEBCPP_ASIO_HANDLER_TYPE converts the completion // token type into a concrete handler type of the correct signature. - using handler_type = BOOST_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); + using handler_type = WEBCPP_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); // The class template `async_base` holds the caller's completion // handler for us, and provides all of the boilerplate for forwarding @@ -169,7 +168,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to // Asio operation state combines completion ownership with coroutine resume state. // NOLINTNEXTLINE(misc-multiple-inheritance) - struct echo_op : base_type, boost::asio::coroutine { + struct echo_op : base_type, webcpp::asio::coroutine { AsyncStream& stream_state; DynamicBuffer& buffer_state; @@ -314,7 +313,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to }; // Create the composed operation and launch it. This is a constructor - // call followed by invocation of operator(). We use BOOST_ASIO_HANDLER_TYPE + // call followed by invocation of operator(). We use WEBCPP_ASIO_HANDLER_TYPE // to convert the completion token into the correct handler type, // allowing user-defined specializations of the async_result template // to be used. @@ -330,7 +329,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to } // Including this file undefines the macros used by the stackless fauxroutines. -#include +#include //] @@ -358,7 +357,7 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } - namespace net = boost::asio; + namespace net = webcpp::asio; auto const address = net::ip::make_address(argv[1]); auto const port = static_cast(webcpp_fixture::integer(argv[2])); diff --git a/example/applications/port/http/client/async-local/http_client_async_local.cpp b/example/applications/port/http/client/async-local/http_client_async_local.cpp index 50cbf6e..9f208e2 100644 --- a/example/applications/port/http/client/async-local/http_client_async_local.cpp +++ b/example/applications/port/http/client/async-local/http_client_async_local.cpp @@ -30,7 +30,7 @@ // //------------------------------------------------------------------------------ -#include +#include #include #include @@ -42,8 +42,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp b/example/applications/port/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp index 1652f15..ee151a9 100644 --- a/example/applications/port/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp +++ b/example/applications/port/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp @@ -32,19 +32,19 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/http/client/async-ssl/http_client_async_ssl.cpp b/example/applications/port/http/client/async-ssl/http_client_async_ssl.cpp index 0bce32f..28e3f2c 100644 --- a/example/applications/port/http/client/async-ssl/http_client_async_ssl.cpp +++ b/example/applications/port/http/client/async-ssl/http_client_async_ssl.cpp @@ -32,18 +32,18 @@ #include "common/root_certificates.hpp" -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/http/client/async/http_client_async.cpp b/example/applications/port/http/client/async/http_client_async.cpp index dd5bc53..f6b5497 100644 --- a/example/applications/port/http/client/async/http_client_async.cpp +++ b/example/applications/port/http/client/async/http_client_async.cpp @@ -29,18 +29,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp b/example/applications/port/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp index 531734f..e131cd7 100644 --- a/example/applications/port/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp +++ b/example/applications/port/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp @@ -30,11 +30,11 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include "common/root_certificates.hpp" @@ -47,8 +47,8 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; -namespace ssl = boost::asio::ssl; +namespace net = webcpp::asio; +namespace ssl = webcpp::asio::ssl; //------------------------------------------------------------------------------ diff --git a/example/applications/port/http/client/awaitable/http_client_awaitable.cpp b/example/applications/port/http/client/awaitable/http_client_awaitable.cpp index 6a1b1a7..ca26aca 100644 --- a/example/applications/port/http/client/awaitable/http_client_awaitable.cpp +++ b/example/applications/port/http/client/awaitable/http_client_awaitable.cpp @@ -29,9 +29,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -42,7 +42,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/port/http/client/body/json_body.hpp b/example/applications/port/http/client/body/json_body.hpp index 211d74b..17f9c6e 100644 --- a/example/applications/port/http/client/body/json_body.hpp +++ b/example/applications/port/http/client/body/json_body.hpp @@ -33,10 +33,10 @@ #define BOOST_BEAST_EXAMPLE_JSON_BODY #include -#include #include #include #include +#include #include namespace json = boost::json; @@ -45,7 +45,7 @@ struct json_body { using value_type = json::value; struct writer { - using const_buffers_type = boost::asio::const_buffer; + using const_buffers_type = webcpp::asio::const_buffer; template writer(webcpp::beast::http::header const& /*unused*/, @@ -65,7 +65,7 @@ struct json_body { ec = {}; // We serialize as much as we can with the buffer. Often that'll suffice const auto len = serializer_.read(buffer_.data(), buffer_.size()); - return std::make_pair(boost::asio::const_buffer(len.data(), len.size()), + return std::make_pair(webcpp::asio::const_buffer(len.data(), len.size()), !serializer_.done()); } diff --git a/example/applications/port/http/client/body/json_client.cpp b/example/applications/port/http/client/body/json_client.cpp index 0185145..169f6e6 100644 --- a/example/applications/port/http/client/body/json_client.cpp +++ b/example/applications/port/http/client/body/json_client.cpp @@ -22,8 +22,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from int main(int /*unused*/, char** /*unused*/) { // Our test endpoint for testing the json diff --git a/example/applications/port/http/client/coro-ssl/http_client_coro_ssl.cpp b/example/applications/port/http/client/coro-ssl/http_client_coro_ssl.cpp index 00bcc7c..9beda15 100644 --- a/example/applications/port/http/client/coro-ssl/http_client_coro_ssl.cpp +++ b/example/applications/port/http/client/coro-ssl/http_client_coro_ssl.cpp @@ -32,19 +32,19 @@ #include "common/root_certificates.hpp" -#include -#include #include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -209,7 +209,7 @@ int main(int argc, char** argv) { ctx.set_verify_mode(ssl::verify_peer); // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) diff --git a/example/applications/port/http/client/coro/http_client_coro.cpp b/example/applications/port/http/client/coro/http_client_coro.cpp index f6d84e4..f49e5a9 100644 --- a/example/applications/port/http/client/coro/http_client_coro.cpp +++ b/example/applications/port/http/client/coro/http_client_coro.cpp @@ -29,17 +29,17 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -159,7 +159,7 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc; // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) diff --git a/example/applications/port/http/client/crawl/http_crawl.cpp b/example/applications/port/http/client/crawl/http_crawl.cpp index 9addcb9..bdf1a10 100644 --- a/example/applications/port/http/client/crawl/http_crawl.cpp +++ b/example/applications/port/http/client/crawl/http_crawl.cpp @@ -32,11 +32,6 @@ #include "urls_large_data.hpp" #include -#include -#include -#include -#include -#include #include #include #include @@ -47,13 +42,18 @@ #include #include #include +#include +#include +#include +#include +#include #include namespace chrono = std::chrono; // from namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/http/client/methods/http_client_methods.cpp b/example/applications/port/http/client/methods/http_client_methods.cpp index 23aff1a..69d99a2 100644 --- a/example/applications/port/http/client/methods/http_client_methods.cpp +++ b/example/applications/port/http/client/methods/http_client_methods.cpp @@ -31,17 +31,17 @@ //[example_http_client_methods -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from // perform a get request namespace { diff --git a/example/applications/port/http/client/sync-ssl/http_client_sync_ssl.cpp b/example/applications/port/http/client/sync-ssl/http_client_sync_ssl.cpp index b8f5ec8..111051f 100644 --- a/example/applications/port/http/client/sync-ssl/http_client_sync_ssl.cpp +++ b/example/applications/port/http/client/sync-ssl/http_client_sync_ssl.cpp @@ -32,18 +32,18 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = net::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = net::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/port/http/client/sync/http_client_sync.cpp b/example/applications/port/http/client/sync/http_client_sync.cpp index db3a8c9..86426d6 100644 --- a/example/applications/port/http/client/sync/http_client_sync.cpp +++ b/example/applications/port/http/client/sync/http_client_sync.cpp @@ -31,17 +31,17 @@ //[example_http_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/port/http/server/async-local/http_server_async_local.cpp b/example/applications/port/http/server/async-local/http_server_async_local.cpp index 09411bf..d4f6c88 100644 --- a/example/applications/port/http/server/async-local/http_server_async_local.cpp +++ b/example/applications/port/http/server/async-local/http_server_async_local.cpp @@ -30,10 +30,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include #include +#include +#include +#include #include #include @@ -48,8 +48,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/http/server/async-ssl/http_server_async_ssl.cpp b/example/applications/port/http/server/async-ssl/http_server_async_ssl.cpp index 1c643f2..6718955 100644 --- a/example/applications/port/http/server/async-ssl/http_server_async_ssl.cpp +++ b/example/applications/port/http/server/async-ssl/http_server_async_ssl.cpp @@ -33,9 +33,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include @@ -43,13 +40,16 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/http/server/async/http_server_async.cpp b/example/applications/port/http/server/async/http_server_async.cpp index 03427bd..d519d7b 100644 --- a/example/applications/port/http/server/async/http_server_async.cpp +++ b/example/applications/port/http/server/async/http_server_async.cpp @@ -30,8 +30,6 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include @@ -40,12 +38,14 @@ #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/http/server/awaitable/http_server_awaitable.cpp b/example/applications/port/http/server/awaitable/http_server_awaitable.cpp index 3eeaaa7..4f02fda 100644 --- a/example/applications/port/http/server/awaitable/http_server_awaitable.cpp +++ b/example/applications/port/http/server/awaitable/http_server_awaitable.cpp @@ -29,11 +29,11 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include @@ -48,7 +48,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/http/server/coro-ssl/http_server_coro_ssl.cpp b/example/applications/port/http/server/coro-ssl/http_server_coro_ssl.cpp index 5a13397..e80ec93 100644 --- a/example/applications/port/http/server/coro-ssl/http_server_coro_ssl.cpp +++ b/example/applications/port/http/server/coro-ssl/http_server_coro_ssl.cpp @@ -33,9 +33,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include @@ -43,13 +40,16 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -420,7 +420,7 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e if (ec) { fail(ec, "accept"); } else { - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) @@ -428,7 +428,7 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e doc_root, std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } } @@ -460,25 +460,25 @@ int main(int argc, char** argv) { load_server_certificate(ctx); // Spawn a listening port - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_listen, std::ref(ioc), std::ref(ctx), - tcp::endpoint{address, port}, doc_root, std::placeholders::_1), - // on completion, spawn will call this function - // Value parameters retain the upstream callback and coroutine ownership - // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) { - std::rethrow_exception(ex); - } - }); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_listen, std::ref(ioc), std::ref(ctx), + tcp::endpoint{address, port}, doc_root, std::placeholders::_1), + // on completion, spawn will call this function + // Value parameters retain the upstream callback and coroutine ownership + // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) { + std::rethrow_exception(ex); + } + }); // Run the I/O service on the requested number of threads std::vector v; diff --git a/example/applications/port/http/server/coro/http_server_coro.cpp b/example/applications/port/http/server/coro/http_server_coro.cpp index 3e18c7d..e2fa349 100644 --- a/example/applications/port/http/server/coro/http_server_coro.cpp +++ b/example/applications/port/http/server/coro/http_server_coro.cpp @@ -30,9 +30,6 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include @@ -40,12 +37,15 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -376,14 +376,14 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, if (ec) { fail(ec, "accept"); } else { - boost::asio::spawn(acceptor.get_executor(), - // The concrete bound signature selects the upstream Asio - // spawn/completion overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_session, beast::tcp_stream(std::move(socket)), - doc_root, std::placeholders::_1), - // we ignore the result of the session, - // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::spawn(acceptor.get_executor(), + // The concrete bound signature selects the upstream Asio + // spawn/completion overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_session, beast::tcp_stream(std::move(socket)), + doc_root, std::placeholders::_1), + // we ignore the result of the session, + // most errors are handled with error_code + webcpp::asio::detached); } } } @@ -409,25 +409,25 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc{threads}; // Spawn a listening port - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, doc_root, - std::placeholders::_1), - // on completion, spawn will call this function - // Value parameters retain the upstream callback and coroutine ownership - // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) { - std::rethrow_exception(ex); - } - }); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, doc_root, + std::placeholders::_1), + // on completion, spawn will call this function + // Value parameters retain the upstream callback and coroutine ownership + // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) { + std::rethrow_exception(ex); + } + }); // Run the I/O service on the requested number of threads std::vector v; diff --git a/example/applications/port/http/server/fast/http_server_fast.cpp b/example/applications/port/http/server/fast/http_server_fast.cpp index 3bb7dfc..772e118 100644 --- a/example/applications/port/http/server/fast/http_server_fast.cpp +++ b/example/applications/port/http/server/fast/http_server_fast.cpp @@ -31,7 +31,6 @@ #include "fields_alloc.hpp" -#include #include #include #include @@ -43,8 +42,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/http/server/flex/http_server_flex.cpp b/example/applications/port/http/server/flex/http_server_flex.cpp index 30de359..b1152a9 100644 --- a/example/applications/port/http/server/flex/http_server_flex.cpp +++ b/example/applications/port/http/server/flex/http_server_flex.cpp @@ -33,22 +33,22 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/http/server/small/http_server_small.cpp b/example/applications/port/http/server/small/http_server_small.cpp index f5a7e60..fdedf38 100644 --- a/example/applications/port/http/server/small/http_server_small.cpp +++ b/example/applications/port/http/server/small/http_server_small.cpp @@ -29,7 +29,6 @@ // //------------------------------------------------------------------------------ -#include #include #include #include @@ -40,8 +39,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from namespace { namespace my_program_state { diff --git a/example/applications/port/http/server/stackless-ssl/http_server_stackless_ssl.cpp b/example/applications/port/http/server/stackless-ssl/http_server_stackless_ssl.cpp index ceb474d..8f36a74 100644 --- a/example/applications/port/http/server/stackless-ssl/http_server_stackless_ssl.cpp +++ b/example/applications/port/http/server/stackless-ssl/http_server_stackless_ssl.cpp @@ -33,10 +33,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include @@ -45,13 +41,17 @@ #include #include #include +#include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -284,7 +284,7 @@ void fail(beast::error_code ec, char const* what) { // Handles an HTTP server connection // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { ssl::stream stream_; beast::flat_buffer buffer_; std::shared_ptr doc_root_; @@ -308,7 +308,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -400,7 +400,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -408,7 +408,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; ssl::context& ctx_; tcp::acceptor acceptor_; @@ -470,7 +470,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -496,7 +496,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/port/http/server/stackless/http_server_stackless.cpp b/example/applications/port/http/server/stackless/http_server_stackless.cpp index 306d60e..547089c 100644 --- a/example/applications/port/http/server/stackless/http_server_stackless.cpp +++ b/example/applications/port/http/server/stackless/http_server_stackless.cpp @@ -30,9 +30,6 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include @@ -41,12 +38,15 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -258,7 +258,7 @@ void fail(beast::error_code ec, char const* what) { // Handles an HTTP server connection // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { beast::tcp_stream stream_; beast::flat_buffer buffer_; std::shared_ptr doc_root_; @@ -281,7 +281,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -347,7 +347,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -355,7 +355,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -415,7 +415,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -439,7 +439,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/port/http/server/sync-ssl/http_server_sync_ssl.cpp b/example/applications/port/http/server/sync-ssl/http_server_sync_ssl.cpp index 89a0493..d0b817c 100644 --- a/example/applications/port/http/server/sync-ssl/http_server_sync_ssl.cpp +++ b/example/applications/port/http/server/sync-ssl/http_server_sync_ssl.cpp @@ -32,22 +32,22 @@ #include "common/server_certificate.hpp" -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/port/http/server/sync/http_server_sync.cpp b/example/applications/port/http/server/sync/http_server_sync.cpp index 42d2ab8..e8a6ceb 100644 --- a/example/applications/port/http/server/sync/http_server_sync.cpp +++ b/example/applications/port/http/server/sync/http_server_sync.cpp @@ -29,19 +29,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/client/async-local/websocket_client_async_local.cpp b/example/applications/port/websocket/client/async-local/websocket_client_async_local.cpp index afb2465..6a33733 100644 --- a/example/applications/port/websocket/client/async-local/websocket_client_async_local.cpp +++ b/example/applications/port/websocket/client/async-local/websocket_client_async_local.cpp @@ -31,8 +31,8 @@ // //------------------------------------------------------------------------------ -#include -#include +#include +#include #include #include @@ -45,8 +45,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp b/example/applications/port/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp index 24d58b1..3a5c561 100644 --- a/example/applications/port/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp +++ b/example/applications/port/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp @@ -33,22 +33,22 @@ #include "common/root_certificates.hpp" -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/client/async-ssl/websocket_client_async_ssl.cpp b/example/applications/port/websocket/client/async-ssl/websocket_client_async_ssl.cpp index 95c3132..e3efd2a 100644 --- a/example/applications/port/websocket/client/async-ssl/websocket_client_async_ssl.cpp +++ b/example/applications/port/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -33,21 +33,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/client/async/websocket_client_async.cpp b/example/applications/port/websocket/client/async/websocket_client_async.cpp index c017118..c11fd5d 100644 --- a/example/applications/port/websocket/client/async/websocket_client_async.cpp +++ b/example/applications/port/websocket/client/async/websocket_client_async.cpp @@ -30,19 +30,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/client/awaitable/websocket_client_awaitable.cpp b/example/applications/port/websocket/client/awaitable/websocket_client_awaitable.cpp index 65f8ac6..7c3ebb4 100644 --- a/example/applications/port/websocket/client/awaitable/websocket_client_awaitable.cpp +++ b/example/applications/port/websocket/client/awaitable/websocket_client_awaitable.cpp @@ -30,9 +30,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -44,7 +44,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/port/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp b/example/applications/port/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp index a236de1..9436a3f 100644 --- a/example/applications/port/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp +++ b/example/applications/port/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp @@ -33,21 +33,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -205,7 +205,7 @@ int main(int argc, char** argv) { load_root_certificates(ctx); // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) diff --git a/example/applications/port/websocket/client/coro/websocket_client_coro.cpp b/example/applications/port/websocket/client/coro/websocket_client_coro.cpp index 463c9d0..b067707 100644 --- a/example/applications/port/websocket/client/coro/websocket_client_coro.cpp +++ b/example/applications/port/websocket/client/coro/websocket_client_coro.cpp @@ -30,18 +30,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -168,25 +168,25 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc; // Launch the asynchronous operation - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_session, std::string(host), std::string(port), - std::string(text), std::ref(ioc), std::placeholders::_1), - // on completion, spawn will call this function - // Value parameters retain the upstream callback and coroutine ownership - // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) { - std::rethrow_exception(ex); - } - }); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_session, std::string(host), std::string(port), + std::string(text), std::ref(ioc), std::placeholders::_1), + // on completion, spawn will call this function + // Value parameters retain the upstream callback and coroutine ownership + // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) { + std::rethrow_exception(ex); + } + }); // Run the I/O service. The call will return when // the socket is closed. diff --git a/example/applications/port/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp b/example/applications/port/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp index c6d2c67..10b7689 100644 --- a/example/applications/port/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp +++ b/example/applications/port/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp @@ -33,21 +33,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include -#include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/port/websocket/client/sync/websocket_client_sync.cpp b/example/applications/port/websocket/client/sync/websocket_client_sync.cpp index 8a747a4..ec63917 100644 --- a/example/applications/port/websocket/client/sync/websocket_client_sync.cpp +++ b/example/applications/port/websocket/client/sync/websocket_client_sync.cpp @@ -32,18 +32,18 @@ //[example_websocket_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/port/websocket/server/async-local/websocket_server_async_local.cpp b/example/applications/port/websocket/server/async-local/websocket_server_async_local.cpp index 4fc36ca..352bf85 100644 --- a/example/applications/port/websocket/server/async-local/websocket_server_async_local.cpp +++ b/example/applications/port/websocket/server/async-local/websocket_server_async_local.cpp @@ -31,9 +31,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -49,8 +49,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/server/async-ssl/websocket_server_async_ssl.cpp b/example/applications/port/websocket/server/async-ssl/websocket_server_async_ssl.cpp index 958cfc5..744e8ff 100644 --- a/example/applications/port/websocket/server/async-ssl/websocket_server_async_ssl.cpp +++ b/example/applications/port/websocket/server/async-ssl/websocket_server_async_ssl.cpp @@ -34,24 +34,24 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/server/async/websocket_server_async.cpp b/example/applications/port/websocket/server/async/websocket_server_async.cpp index ebf049b..c24455f 100644 --- a/example/applications/port/websocket/server/async/websocket_server_async.cpp +++ b/example/applications/port/websocket/server/async/websocket_server_async.cpp @@ -31,8 +31,6 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include @@ -40,13 +38,15 @@ #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/server/awaitable/websocket_server_awaitable.cpp b/example/applications/port/websocket/server/awaitable/websocket_server_awaitable.cpp index d6f05d3..3c754b6 100644 --- a/example/applications/port/websocket/server/awaitable/websocket_server_awaitable.cpp +++ b/example/applications/port/websocket/server/awaitable/websocket_server_awaitable.cpp @@ -30,10 +30,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -48,7 +48,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Echoes back all received WebSocket messages namespace { diff --git a/example/applications/port/websocket/server/chat-multi/main.cpp b/example/applications/port/websocket/server/chat-multi/main.cpp index 1659676..4ab9791 100644 --- a/example/applications/port/websocket/server/chat-multi/main.cpp +++ b/example/applications/port/websocket/server/chat-multi/main.cpp @@ -38,10 +38,10 @@ #include "listener.hpp" #include "shared_state.hpp" -#include #include #include #include +#include // The process entry point retains its standard char** argv signature. // NOLINTNEXTLINE(misc-const-correctness) diff --git a/example/applications/port/websocket/server/chat-multi/net.hpp b/example/applications/port/websocket/server/chat-multi/net.hpp index 8a95669..4c2e912 100644 --- a/example/applications/port/websocket/server/chat-multi/net.hpp +++ b/example/applications/port/websocket/server/chat-multi/net.hpp @@ -26,9 +26,7 @@ #ifndef BOOST_BEAST_EXAMPLE_WEBSOCKET_CHAT_MULTI_NET_HPP #define BOOST_BEAST_EXAMPLE_WEBSOCKET_CHAT_MULTI_NET_HPP -#include - -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from #endif diff --git a/example/applications/port/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp b/example/applications/port/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp index 00273b8..37f04a6 100644 --- a/example/applications/port/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp +++ b/example/applications/port/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp @@ -34,24 +34,24 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -195,7 +195,7 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e if (ec) { fail(ec, "accept"); } else { - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) @@ -204,7 +204,7 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } } @@ -235,25 +235,25 @@ int main(int argc, char** argv) { load_server_certificate(ctx); // Spawn a listening port - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_listen, std::ref(ioc), std::ref(ctx), - tcp::endpoint{address, port}, std::placeholders::_1), - // on completion, spawn will call this function - // Value parameters retain the upstream callback and coroutine ownership - // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) { - std::rethrow_exception(ex); - } - }); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_listen, std::ref(ioc), std::ref(ctx), + tcp::endpoint{address, port}, std::placeholders::_1), + // on completion, spawn will call this function + // Value parameters retain the upstream callback and coroutine ownership + // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) { + std::rethrow_exception(ex); + } + }); // Run the I/O service on the requested number of threads std::vector v; diff --git a/example/applications/port/websocket/server/coro/websocket_server_coro.cpp b/example/applications/port/websocket/server/coro/websocket_server_coro.cpp index cead08a..c3b2d6d 100644 --- a/example/applications/port/websocket/server/coro/websocket_server_coro.cpp +++ b/example/applications/port/websocket/server/coro/websocket_server_coro.cpp @@ -31,8 +31,6 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include @@ -40,13 +38,15 @@ #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -173,7 +173,7 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, if (ec) { fail(ec, "accept"); } else { - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) @@ -181,7 +181,7 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } } @@ -206,7 +206,7 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc(threads); // Spawn a listening port - boost::asio::spawn( + webcpp::asio::spawn( ioc, // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) diff --git a/example/applications/port/websocket/server/fast/websocket_server_fast.cpp b/example/applications/port/websocket/server/fast/websocket_server_fast.cpp index 5661a7e..e50d109 100644 --- a/example/applications/port/websocket/server/fast/websocket_server_fast.cpp +++ b/example/applications/port/websocket/server/fast/websocket_server_fast.cpp @@ -44,9 +44,6 @@ */ #include -#include -#include -#include #include #include #include @@ -54,13 +51,16 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -421,13 +421,13 @@ void do_coro_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, continue; } - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) std::bind(&do_coro_session, websocket::stream(std::move(socket)), std::placeholders::_1), - boost::asio::detached); + webcpp::asio::detached); } } @@ -468,13 +468,13 @@ int main(int argc, char** argv) { ->run(); // Create coro port - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_coro_listen, std::ref(ioc), - tcp::endpoint{address, static_cast(port + 2u)}, - std::placeholders::_1), - boost::asio::detached); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_coro_listen, std::ref(ioc), + tcp::endpoint{address, static_cast(port + 2u)}, + std::placeholders::_1), + webcpp::asio::detached); // Run the I/O service on the requested number of threads std::vector v; diff --git a/example/applications/port/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp b/example/applications/port/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp index 058793f..062d764 100644 --- a/example/applications/port/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp +++ b/example/applications/port/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp @@ -34,11 +34,6 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include -#include #include #include #include @@ -46,14 +41,19 @@ #include #include #include +#include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -66,7 +66,7 @@ void fail(beast::error_code ec, char const* what) { // Echoes back all received WebSocket messages // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { websocket::stream> ws_; beast::flat_buffer buffer_; @@ -85,7 +85,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -173,7 +173,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -181,7 +181,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; ssl::context& ctx_; tcp::acceptor acceptor_; @@ -237,7 +237,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -263,7 +263,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/server/stackless/websocket_server_stackless.cpp b/example/applications/port/websocket/server/stackless/websocket_server_stackless.cpp index 536a4f6..c74a997 100644 --- a/example/applications/port/websocket/server/stackless/websocket_server_stackless.cpp +++ b/example/applications/port/websocket/server/stackless/websocket_server_stackless.cpp @@ -31,9 +31,6 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include @@ -41,13 +38,16 @@ #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -60,7 +60,7 @@ void fail(beast::error_code ec, char const* what) { // Echoes back all received WebSocket messages // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { websocket::stream ws_; beast::flat_buffer buffer_; @@ -79,7 +79,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -146,7 +146,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -154,7 +154,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -209,7 +209,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -235,7 +235,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp b/example/applications/port/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp index dbe90bd..d29815b 100644 --- a/example/applications/port/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp +++ b/example/applications/port/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp @@ -33,22 +33,22 @@ #include "common/server_certificate.hpp" -#include -#include -#include #include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/port/websocket/server/sync/websocket_server_sync.cpp b/example/applications/port/websocket/server/sync/websocket_server_sync.cpp index 1a313db..ff3f8c4 100644 --- a/example/applications/port/websocket/server/sync/websocket_server_sync.cpp +++ b/example/applications/port/websocket/server/sync/websocket_server_sync.cpp @@ -30,19 +30,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/streams/websocket-channel.hpp b/example/applications/streams/websocket-channel.hpp index 4e41bf6..8808558 100644 --- a/example/applications/streams/websocket-channel.hpp +++ b/example/applications/streams/websocket-channel.hpp @@ -7,21 +7,21 @@ #ifndef WEBCPP_BEAST_EXAMPLE_SUPPLIED_WEBSOCKET_CHANNEL_HPP #define WEBCPP_BEAST_EXAMPLE_SUPPLIED_WEBSOCKET_CHANNEL_HPP -#include -#include -#include #include #include +#include +#include +#include #include #ifdef __wasip2__ -#include -#include -#include +#include +#include +#include #include namespace webcpp::asio::wasi { -inline void teardown(boost::beast::role_type /*unused*/, stdio_stream& /*unused*/, +inline void teardown(webcpp::beast::role_type /*unused*/, stdio_stream& /*unused*/, boost::system::error_code& error) { error.clear(); } @@ -29,7 +29,7 @@ inline void teardown(boost::beast::role_type /*unused*/, stdio_stream& /*unused* struct teardown_operation { template void operator()(Self& self) { - boost::asio::post(boost::asio::append(std::move(self), boost::system::error_code{})); + webcpp::asio::post(webcpp::asio::append(std::move(self), boost::system::error_code{})); } template @@ -39,8 +39,8 @@ struct teardown_operation { }; template -void async_teardown(boost::beast::role_type /*role*/, stdio_stream& stream, Handler&& handler) { - boost::asio::async_compose( +void async_teardown(webcpp::beast::role_type /*role*/, stdio_stream& stream, Handler&& handler) { + webcpp::asio::async_compose( teardown_operation{}, handler, stream.get_executor()); } @@ -54,11 +54,11 @@ namespace supplied_example { // The executor exists for the upstream WebSocket object's associated state. // This example performs explicit synchronous I/O on caller-provided CLI streams. class channel { - boost::asio::io_context::executor_type executor_; + webcpp::asio::io_context::executor_type executor_; webcpp::beast::wasi::stdio_stream stream_; public: - using executor_type = boost::asio::io_context::executor_type; + using executor_type = webcpp::asio::io_context::executor_type; explicit channel(executor_type executor) : executor_(std::move(executor)) {} @@ -68,7 +68,7 @@ class channel { std::size_t read_some(const Buffers& buffers, boost::system::error_code& error) { const auto count = stream_.read_some(buffers, error); if (error == webcpp::beast::http::error::end_of_stream) { - error = boost::asio::error::eof; + error = webcpp::asio::error::eof; } return count; } @@ -101,7 +101,7 @@ class channel { // The channel is borrowed: WebSocket close completes its handshake without // inventing socket shutdown semantics or closing the caller's descriptors. -inline void teardown(boost::beast::role_type /*role*/, channel& /*stream*/, +inline void teardown(webcpp::beast::role_type /*role*/, channel& /*stream*/, boost::system::error_code& error) { error.clear(); } diff --git a/example/applications/streams/websocket-client-async-local.cpp b/example/applications/streams/websocket-client-async-local.cpp index bf76f6e..b6f3f36 100644 --- a/example/applications/streams/websocket-client-async-local.cpp +++ b/example/applications/streams/websocket-client-async-local.cpp @@ -19,9 +19,9 @@ #include #include "websocket-channel.hpp" #ifdef __wasip2__ -#include -#include -#include +#include +#include +#include #endif int main(int argc, const char* const* argv) { @@ -30,7 +30,7 @@ int main(int argc, const char* const* argv) { if (argc != 3) { return 64; } - boost::asio::io_context context; + webcpp::asio::io_context context; websocket::stream stream(context.get_executor()); stream.set_option(websocket::stream_base::decorator([](websocket::request_type& request) { request.set(beast::http::field::user_agent, @@ -38,17 +38,17 @@ int main(int argc, const char* const* argv) { })); #ifdef __wasip2__ int result = 1; - boost::asio::co_spawn( + webcpp::asio::co_spawn( context, - [&]() -> boost::asio::awaitable { - auto token = boost::asio::as_tuple(boost::asio::use_awaitable); + [&]() -> webcpp::asio::awaitable { + auto token = webcpp::asio::as_tuple(webcpp::asio::use_awaitable); auto [handshake_error] = co_await stream.async_handshake(argv[1], "/", token); if (handshake_error) { co_return; } stream.text(true); auto [write_error, written] = co_await stream.async_write( - boost::asio::buffer(argv[2], std::strlen(argv[2])), token); + webcpp::asio::buffer(argv[2], std::strlen(argv[2])), token); if (write_error) { result = 2; co_return; @@ -59,7 +59,7 @@ int main(int argc, const char* const* argv) { result = 3; co_return; } - const auto output = boost::beast::buffers_to_string(reply.data()); + const auto output = webcpp::beast::buffers_to_string(reply.data()); static_cast(std::fprintf(stderr, "%s\n", output.c_str())); auto [close_error] = co_await stream.async_close(websocket::close_code::normal, token); result = close_error ? 4 : 0; @@ -78,7 +78,7 @@ int main(int argc, const char* const* argv) { return 1; } stream.text(true); - stream.write(boost::asio::buffer(argv[2], std::strlen(argv[2])), error); + stream.write(webcpp::asio::buffer(argv[2], std::strlen(argv[2])), error); if (error) { return 2; } @@ -87,7 +87,7 @@ int main(int argc, const char* const* argv) { if (error) { return 3; } - const auto output = boost::beast::buffers_to_string(reply.data()); + const auto output = webcpp::beast::buffers_to_string(reply.data()); static_cast(std::fprintf(stderr, "%s\n", output.c_str())); stream.close(websocket::close_code::normal, error); return error ? 4 : 0; diff --git a/example/applications/streams/websocket-server-async-local.cpp b/example/applications/streams/websocket-server-async-local.cpp index ebe420e..d3ab5d2 100644 --- a/example/applications/streams/websocket-server-async-local.cpp +++ b/example/applications/streams/websocket-server-async-local.cpp @@ -18,15 +18,15 @@ #include #include "websocket-channel.hpp" #ifdef __wasip2__ -#include -#include -#include +#include +#include +#include #endif int main() { namespace beast = webcpp::beast; namespace websocket = beast::websocket; - boost::asio::io_context context; + webcpp::asio::io_context context; websocket::stream stream(context.get_executor()); stream.set_option(websocket::stream_base::decorator([](websocket::response_type& response) { response.set(beast::http::field::server, @@ -34,10 +34,10 @@ int main() { })); #ifdef __wasip2__ int result = 1; - boost::asio::co_spawn( + webcpp::asio::co_spawn( context, - [&]() -> boost::asio::awaitable { - auto token = boost::asio::as_tuple(boost::asio::use_awaitable); + [&]() -> webcpp::asio::awaitable { + auto token = webcpp::asio::as_tuple(webcpp::asio::use_awaitable); auto [accept_error] = co_await stream.async_accept(token); if (accept_error) { co_return; diff --git a/example/applications/tools/prepare.py b/example/applications/tools/prepare.py index 079d059..15d52be 100644 --- a/example/applications/tools/prepare.py +++ b/example/applications/tools/prepare.py @@ -8,6 +8,7 @@ import argparse import difflib +import hashlib import json import re import subprocess @@ -26,8 +27,10 @@ // Upstream authors and their original notice follow. """ -JAM_NOTICE = "\n".join("#" + line[2:] if line.startswith("//") else line - for line in NOTICE.splitlines()) + "\n" +JAM_NOTICE = ( + "\n".join("#" + line[2:] if line.startswith("//") else line for line in NOTICE.splitlines()) + + "\n" +) def write_changed(path, text): @@ -43,12 +46,16 @@ def comment(match): value = value.replace("@AsyncWriteStream", "`AsyncWriteStream`") value = value.replace("\\n", "\\\\n") return value + return re.sub(r"/\*\*.*?\*/", comment, text, flags=re.S) def require_backend(text): - return re.sub(r"#else\s*int\s+main\([^)]*\)\s*\{[^{}]*\}", - '#else\n#error "This application requires its declared Asio backend"', text) + return re.sub( + r"#else\s*int\s+main\([^)]*\)\s*\{[^{}]*\}", + '#else\n#error "This application requires its declared Asio backend"', + text, + ) def adapt_fixture(path, text): @@ -60,37 +67,49 @@ def adapt_fixture(path, text): text = require_backend(text) text = text.replace('"example/', '"') if path.name == "fields_alloc.hpp": - text = text.replace("static_pool&\n share()", - "static static_pool&\n share(static_pool& pool)") - text = text.replace("++refs_;\n return *this;", - "++pool.refs_;\n return pool;") + text = text.replace( + "static_pool&\n share()", "static static_pool&\n share(static_pool& pool)" + ) + text = text.replace( + "++refs_;\n return *this;", "++pool.refs_;\n return pool;" + ) text = text.replace("&other.pool_->share()", "&detail::static_pool::share(*other.pool_)") if path.name == "root_certificates.hpp": position = text.index("{", text.index("load_root_certificates(ssl::context& ctx,")) + 1 - text = text[:position] + """ + text = ( + text[:position] + + """ if (auto const* path = std::getenv("WEBCPP_BEAST_FIXTURE_CA")) { ctx.load_verify_file(path, ec); return; } -""" + text[position:] +""" + + text[position:] + ) if path.name == "server_certificate.hpp": position = text.index("{", text.index("load_server_certificate(")) + 1 - text = text[:position] + """ + text = ( + text[:position] + + """ if (auto const* path = std::getenv("WEBCPP_BEAST_FIXTURE_CERT")) { ctx.use_certificate_chain_file(path); ctx.use_private_key_file(std::getenv("WEBCPP_BEAST_FIXTURE_KEY"), boost::asio::ssl::context::pem); return; } -""" + text[position:] +""" + + text[position:] + ) if path.name == "json_client.cpp": - text = text.replace('"postman-echo.com"', 'webcpp_fixture::host()') - text = text.replace('resolver.resolve(host, "80")', - 'resolver.resolve(host, webcpp_fixture::port())') + text = text.replace('"postman-echo.com"', "webcpp_fixture::host()") + text = text.replace( + 'resolver.resolve(host, "80")', "resolver.resolve(host, webcpp_fixture::port())" + ) if path.name == "http_client_methods.cpp": - text = text.replace('"httpbin.cpp.al", "http"', - 'webcpp_fixture::host(), webcpp_fixture::port()') - text = text.replace('"httpbin.cpp.al"', 'webcpp_fixture::host()') + text = text.replace( + '"httpbin.cpp.al", "http"', "webcpp_fixture::host(), webcpp_fixture::port()" + ) + text = text.replace('"httpbin.cpp.al"', "webcpp_fixture::host()") if path.name == "urls_large_data.cpp": text = """#include "urls_large_data.hpp" #include @@ -100,14 +119,18 @@ def adapt_fixture(path, text): } """ if path.name == "http_crawl.cpp": - text = text.replace('"http",', 'webcpp_fixture::port(),') + text = text.replace('"http",', "webcpp_fixture::port(),") if path.as_posix().startswith("doc/ssl/"): - text = text.replace('{}, 8080', - 'net::ip::make_address("127.0.0.1"), webcpp_fixture::port_number()') - text = text.replace('tcp::v4(), 8080', 'tcp::v4(), webcpp_fixture::port_number()') + text = text.replace( + "{}, 8080", 'net::ip::make_address("127.0.0.1"), webcpp_fixture::port_number()' + ) + text = text.replace("tcp::v4(), 8080", "tcp::v4(), webcpp_fixture::port_number()") # The fixture helper is explicit in both the oracle and the port. - text = re.sub(r"([^\n]*\bioc\.run\([^\n]*)", - r"\1 // lint-run: drives the application's network operations", text) + text = re.sub( + r"([^\n]*\bioc\.run\([^\n]*)", + r"\1 // lint-run: drives the application's network operations", + text, + ) return NOTICE + '#include "fixture.hpp"\n' + text @@ -155,63 +178,176 @@ def prepare(formatter): destination = APPLICATIONS / variant / relative destination.parent.mkdir(parents=True, exist_ok=True) if original.suffix in (".cpp", ".hpp"): - result = subprocess.run([formatter, f"--assume-filename={destination}"], - input=text, text=True, capture_output=True, check=True) + result = subprocess.run( + [formatter, f"--assume-filename={destination}"], + input=text, + text=True, + capture_output=True, + check=True, + ) text = result.stdout write_changed(destination, text) if variant == "port": - deltas.extend(difflib.unified_diff(before.splitlines(True), text.splitlines(True), - fromfile=f"upstream/{relative}", tofile=f"port/{relative}")) + deltas.extend( + difflib.unified_diff( + before.splitlines(True), + text.splitlines(True), + fromfile=f"upstream/{relative}", + tofile=f"port/{relative}", + ) + ) write_changed(APPLICATIONS / "adaptations.patch", "".join(deltas)) prepare_jam(manifest) prepare_host_handlers(manifest, formatter) import prepare_wasip3 + prepare_wasip3.generate(formatter) import prepare_browser + prepare_browser.generate(formatter) import prepare_host_clients + prepare_host_clients.generate(formatter) import prepare_noexcept + prepare_noexcept.generate(formatter) - subprocess.run([sys.executable, str(APPLICATIONS / "streams/prepare.py"), formatter], - check=True) - subprocess.run([sys.executable, str(APPLICATIONS / "host-extra/prepare.py"), - "--clang-format", formatter], check=True) + subprocess.run( + [sys.executable, str(APPLICATIONS / "streams/prepare.py"), formatter], check=True + ) + subprocess.run( + [sys.executable, str(APPLICATIONS / "host-extra/prepare.py"), "--clang-format", formatter], + check=True, + ) import normalize + normalize.apply() + migrate_selected_backends(formatter) print(f"Prepared {len(manifest['applications'])} oracle/port applications") +def migrate_selected_backends(formatter): + """Apply the final explicit backend migration after existing fixture changes. + + Oracle sources remain Boost. The hash mapping records precisely which + generated sources now consume the shipped implementation. + """ + records = [] + for directory in ( + "port", + "wasip3", + "browser", + "host", + "host-clients", + "host-extra", + "streams", + "noexcept-native", + "noexcept-single", + "noexcept-browser", + ): + for path in sorted((APPLICATIONS / directory).rglob("*")): + if path.suffix not in (".cpp", ".hpp"): + continue + original = path.read_text() + text = original + for library in ("asio", "beast"): + text = text.replace(f"boost::{library}", f"webcpp::{library}") + text = text.replace(f"", f"") + # The version names the immutable protocol implementation, not an executor. + text = text.replace("", "") + # The fixture already adds this guarded umbrella. Migrating an + # original Boost umbrella must not introduce a second include. + umbrella = "#include \n" + if text.count(umbrella) > 1: + before, after = text.split(umbrella, 1) + text = before + umbrella + after.replace(umbrella, "") + text = text.replace("defined(BOOST_ASIO_HAS_CO_AWAIT)", "WEBCPP_ASIO_HAS_CO_AWAIT") + text = text.replace( + "defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)", "WEBCPP_ASIO_HAS_LOCAL_SOCKETS" + ) + text = text.replace("BOOST_ASIO_HANDLER_TYPE", "WEBCPP_ASIO_HANDLER_TYPE") + text = subprocess.run( + [formatter, f"--assume-filename={path}"], + input=text, + text=True, + capture_output=True, + check=True, + ).stdout + write_changed(path, text) + records.append( + { + "path": path.relative_to(APPLICATIONS).as_posix(), + "before_sha256": hashlib.sha256(original.encode()).hexdigest(), + "after_sha256": hashlib.sha256(text.encode()).hexdigest(), + } + ) + write_changed( + APPLICATIONS / "backend-migration.json", + json.dumps( + { + "description": ( + "Explicit namespace and include migration after fixture adaptations; oracle" + " unchanged." + ), + "files": records, + }, + indent=2, + ) + + "\n", + ) + + def prepare_jam(manifest): - lines = [JAM_NOTICE, - "# Fixtures read the environment fixed by their launching driver.\n" - "project : requirements msvc:_CRT_SECURE_NO_WARNINGS ;\n\n", - "import webcpp ;\nwebcpp.targets native ;\n", - "webcpp.original python3 ;\n"] + lines = [ + JAM_NOTICE, + ( + "# Fixtures read the environment fixed by their launching driver.\n" + "project : requirements msvc:_CRT_SECURE_NO_WARNINGS ;\n\n" + ), + "import webcpp ;\nwebcpp.targets native ;\n", + "webcpp.original python3 ;\n", + ] targets = [] for row in manifest["applications"]: for variant in ("oracle", "port"): target = f"{variant}-{row['id']}" targets.append(target) - sources = " ".join(f"../../example/applications/{variant}/{source}" - for source in row["sources"]) + sources = " ".join( + f"../../example/applications/{variant}/{source}" for source in row["sources"] + ) requirement = "/webcpp/beast//tls" if row["tls"] else "/webcpp/beast//sockets" context = " /webcpp//boost_context" if row["stackful"] else "" - lines.append(f"webcpp.drive {target} : {sources}\n" - f" : {requirement}{context} on\n" - f" ../../example/applications/{variant}\n" - " ../../example/applications multi\n" - " BOOST_ASIO_HAS_CO_AWAIT=1\n" - " BOOST_ASIO_HAS_STD_COROUTINE=1\n" - f" : driver.py : {row['id']} : native ;\n") - lines.append("webcpp.run documentation_snippets : documentation_snippets.cpp\n" - " : /webcpp/beast//sockets ../../example/applications\n" - " ../../example/applications/port : native wasip3 ;\n") - lines.append("webcpp.run context_unwind : context_unwind.cpp\n" - " : /webcpp//boost_context on ;\n") + lines.append( + f"webcpp.drive {target} : {sources}\n" + f" : {requirement}{context} on\n" + f" ../../example/applications/{variant}\n" + " ../../example/applications multi\n" + " BOOST_ASIO_HAS_CO_AWAIT=1\n" + " BOOST_ASIO_HAS_STD_COROUTINE=1\n" + f" : driver.py : {row['id']} : native ;\n" + ) + lines.append( + "webcpp.run documentation_snippets : documentation_snippets.cpp\n" + " : /webcpp/beast//sockets ../../example/applications\n" + " ../../example/applications/port : native wasip3 ;\n" + ) + lines.append( + "webcpp.run context_unwind : context_unwind.cpp\n" + " : /webcpp//boost_context on ;\n" + ) lines.append("webcpp.lane applications :\n " + "\n ".join(targets) + "\n : native ;\n") - for project in ("host", "wasip3", "browser", "streams", "chat", "host-clients", - "noexcept", "browser-noexcept", "host-extra", "host-tls"): + for project in ( + "host", + "wasip3", + "browser", + "streams", + "chat", + "host-clients", + "noexcept", + "browser-noexcept", + "host-extra", + "host-tls", + ): lines.append(f"build-project {project} ;\n") write_changed(APPLICATIONS.parents[1] / "test/applications/Jamfile", "".join(lines)) @@ -237,10 +373,14 @@ def prepare_host_handlers(manifest, formatter): while depth: depth += (source[end] == "{") - (source[end] == "}") end += 1 - body = source[start.start():end].replace("http::message_generator", "application_response") + body = source[start.start() : end].replace( + "http::message_generator", "application_response" + ) # The host owns persistence. No physical connection fields are fabricated. body = body.replace("res.keep_alive(req.keep_alive());", "") - prefix = NOTICE + """#include + prefix = ( + NOTICE + + """#include #include #include #include @@ -250,33 +390,57 @@ def prepare_host_handlers(manifest, formatter): using application_response = std::variant, http::response, http::response>; """ - text = prefix + body + """ + ) + text = ( + prefix + + body + + """ application_response handle(http::request request) { return handle_request(".", std::move(request)); } WEBCPP_BEAST_WASI_HTTP_EXPORT(handle) """ + ) destination = host / f"{row['id']}.cpp" - result = subprocess.run([formatter, f"--assume-filename={destination}"], input=text, - text=True, capture_output=True, check=True) + result = subprocess.run( + [formatter, f"--assume-filename={destination}"], + input=text, + text=True, + capture_output=True, + check=True, + ) write_changed(destination, result.stdout) generated.append(row["id"]) - (host / "mapping.json").write_text(json.dumps({ - "applications": generated, - "adaptation": "Original mime_type, path_cat and handle_request; message_generator " - "replaced by std::variant; host owns persistence and server entrypoint.", - }, indent=2) + "\n") + (host / "mapping.json").write_text( + json.dumps( + { + "applications": generated, + "adaptation": ( + "Original mime_type, path_cat and handle_request; message_generator " + "replaced by std::variant; host owns persistence and server entrypoint." + ), + }, + indent=2, + ) + + "\n" + ) project = APPLICATIONS.parents[1] / "test/applications/host" project.mkdir(exist_ok=True) - lines = [JAM_NOTICE, "import webcpp ;\nwebcpp.targets wasip2 wasip3 ;\n", - "webcpp.original python3 : .. ;\n"] + lines = [ + JAM_NOTICE, + "import webcpp ;\nwebcpp.targets wasip2 wasip3 ;\n", + "webcpp.original python3 : .. ;\n", + ] for name in generated: - lines.append(f"webcpp.drive {name} : ../../../example/applications/host/{name}.cpp\n" - " : /webcpp/beast//beast /webcpp/wasi//host-http\n" - " -mexec-model=reactor\n" - f" : driver.py : {name} : wasip2 wasip3 ;\n") - lines.append("webcpp.lane applications-host :\n " + "\n ".join(generated) + - "\n : wasip2 wasip3 ;\n") + lines.append( + f"webcpp.drive {name} : ../../../example/applications/host/{name}.cpp\n" + " : /webcpp/beast//beast /webcpp/wasi//host-http\n" + " -mexec-model=reactor\n" + f" : driver.py : {name} : wasip2 wasip3 ;\n" + ) + lines.append( + "webcpp.lane applications-host :\n " + "\n ".join(generated) + "\n : wasip2 wasip3 ;\n" + ) write_changed(project / "Jamfile", "".join(lines)) diff --git a/example/applications/tools/prepare_browser.py b/example/applications/tools/prepare_browser.py index d3f8ea2..4b3f086 100644 --- a/example/applications/tools/prepare_browser.py +++ b/example/applications/tools/prepare_browser.py @@ -26,8 +26,9 @@ def closing(text, start, left="(", right=")"): def adapt(relative, source): text = prepare_wasip3.adapt(relative, source) - text = text.replace('#include "fixture_resolver.hpp"', - "#include ") + text = text.replace( + '#include "fixture_resolver.hpp"', "#include " + ) text = text.replace("webcpp_fixture::resolver", "webcpp::asio::ip::tcp::resolver") text = text.replace("#include ", "#include ") text = text.replace("#include ", "") @@ -36,30 +37,35 @@ def adapt(relative, source): text = re.sub(r"namespace ssl\s*= net::ssl", "namespace ssl = webcpp::asio::ssl", text) text = text.replace("ssl::stream<", "beast::ssl_stream<") text = text.replace("beast::ssl_stream", "beast::ssl_stream") - text = text.replace("net::connect(beast::get_lowest_layer(ws), results)", - "beast::get_lowest_layer(ws).connect(results)") + text = text.replace( + "net::connect(beast::get_lowest_layer(ws), results)", + "beast::get_lowest_layer(ws).connect(results)", + ) text = re.sub(r"[\w.]+\.set\(\s*http::field::user_agent,.*?\);", "", text, flags=re.S) text = text.replace("ssl::context::tlsv12_client", "ssl::context::tls_client") - text = text.replace("load_root_certificates(ctx);", - "// Browser trust store owns TLS authorities.") + text = text.replace( + "load_root_certificates(ctx);", "// Browser trust store owns TLS authorities." + ) text = text.replace("websocket::stream", "websocket::stream") - text = text.replace("net::connect(ws.next_layer(), results)", - "ws.next_layer().connect(results)") + text = text.replace( + "net::connect(ws.next_layer(), results)", "ws.next_layer().connect(results)" + ) while match := re.search(r"if\s*\(\s*!\s*SSL_set_tlsext_host_name", text): call = text.index("(", text.index("SSL_set_tlsext_host_name", match.start())) call_end = closing(text, call) - stream, host = text[call + 1:call_end - 1].split(",", 1) + stream, host = text[call + 1 : call_end - 1].split(",", 1) stream = stream.replace(".native_handle()", "").strip() start = text.index("{", call_end) end = closing(text, start, "{", "}") replacement = f"beast::set_server_name({stream}, {host.strip()}).value();" - text = text[:match.start()] + replacement + text[end:] + text = text[: match.start()] + replacement + text[end:] while match := re.search(r"[\w.]+\.set_option\(\s*websocket::stream_base::decorator", text): start = text.index("(", match.start()) end = closing(text, start) - text = text[:match.start()] + "/* Browser owns handshake User-Agent. */" + text[end + 1:] - text = text.replace("ec == net::error::eof || ec == ssl::error::stream_truncated", - "ec == net::error::eof") + text = text[: match.start()] + "/* Browser owns handshake User-Agent. */" + text[end + 1 :] + text = text.replace( + "ec == net::error::eof || ec == ssl::error::stream_truncated", "ec == net::error::eof" + ) text = text.replace("ec && ec != net::error::eof && ec != ssl::error::stream_truncated", "ec") text = text.replace("ec != net::ssl::error::stream_truncated", "bool(ec)") text = text.replace("ec != ssl::error::stream_truncated", "bool(ec)") @@ -75,24 +81,29 @@ def adapt(relative, source): if operation: opening = start + expression.index("(", operation.start()) end = closing(text, opening) - text = text[:end - 1] + ", net::use_awaitable" + text[end - 1:] + text = text[: end - 1] + ", net::use_awaitable" + text[end - 1 :] cursor = end + len(", net::use_awaitable") else: cursor = stop + 1 - text = text.replace("net::as_tuple, net::use_awaitable", - "net::as_tuple(net::use_awaitable)") + text = text.replace("net::as_tuple, net::use_awaitable", "net::as_tuple(net::use_awaitable)") if relative.name == "urls_large_data.cpp": text = text.replace('"localhost"', '"127.0.0.1"') if relative.name == "http_client_methods.cpp": - text = text.replace("beast::tcp_stream & stream", - "beast::browser::http_byte_stream & stream") - text = text.replace("beast::tcp_stream stream(ioc);", "beast::tcp_stream transport(ioc);\n" - "beast::browser::http_byte_stream stream(transport);") + text = text.replace( + "beast::tcp_stream & stream", + "beast::browser::http_byte_stream & stream", + ) + text = text.replace( + "beast::tcp_stream stream(ioc);", + "beast::tcp_stream transport(ioc);\n" + "beast::browser::http_byte_stream stream(transport);", + ) text = text.replace("stream.connect(results);", "transport.connect(results);") text = text.replace("stream.socket().shutdown", "transport.socket().shutdown") - text = text.replace('#include "fixture.hpp"', - '#include "fixture.hpp"\n' - '#include ') + text = text.replace( + '#include "fixture.hpp"', + '#include "fixture.hpp"\n#include ', + ) text = re.sub(r"\bmain\s*\(", "application_main(", text) return text @@ -100,7 +111,7 @@ def adapt(relative, source): def wrapper(row): name = row["id"] host = '"localhost"' if row["tls"] else '"127.0.0.1"' - tls = "global(\"beastSecurePort\")" if row["tls"] else 'global("location")["port"]' + tls = 'global("beastSecurePort")' if row["tls"] else 'global("location")["port"]' argument = '"Beast fixture echo"' if name.startswith("websocket-") else '"/http"' expected = '"Beast fixture echo"' if name.startswith("websocket-") else '"fetch body"' arguments = f'{{"{name}", {host}, port, {argument}}}' @@ -111,8 +122,11 @@ def wrapper(row): methods = name == "http-client-methods" if methods: arguments, expected = '{"http-client-methods", method}', '"200 OK"' - begin = 'for (const auto* method : {"get", "head", "post", "put", "patch", "delete"}) {' \ - if methods else "{" + begin = ( + 'for (const auto* method : {"get", "head", "post", "put", "patch", "delete"}) {' + if methods + else "{" + ) return f""" #include #include @@ -144,8 +158,14 @@ def wrapper(row): def generate(formatter): manifest = json.loads((prepare.APPLICATIONS / "manifest.json").read_text()) - rows = [row for row in manifest["applications"] if not row["server"] and - not row["local_socket"] and not row["stackful"] and row["id"] != "doc-ssl-client"] + rows = [ + row + for row in manifest["applications"] + if not row["server"] + and not row["local_socket"] + and not row["stackful"] + and row["id"] != "doc-ssl-client" + ] needed = {source for row in rows for source in row["sources"]} needed |= {"http/client/body/json_body.hpp", "http/client/crawl/urls_large_data.hpp"} entrypoints = {row["entrypoint"]: row for row in rows} @@ -158,41 +178,72 @@ def generate(formatter): text += wrapper(entrypoints[name]) destination = prepare.APPLICATIONS / "browser" / name destination.parent.mkdir(parents=True, exist_ok=True) - text = subprocess.run([formatter, f"--assume-filename={destination}"], input=text, - text=True, capture_output=True, check=True).stdout + text = subprocess.run( + [formatter, f"--assume-filename={destination}"], + input=text, + text=True, + capture_output=True, + check=True, + ).stdout prepare.write_changed(destination, text) - deltas.extend(difflib.unified_diff(source.splitlines(True), text.splitlines(True), - fromfile=f"upstream/{name}", tofile=f"browser/{name}")) + deltas.extend( + difflib.unified_diff( + source.splitlines(True), + text.splitlines(True), + fromfile=f"upstream/{name}", + tofile=f"browser/{name}", + ) + ) (prepare.APPLICATIONS / "browser.patch").write_text("".join(deltas)) project = prepare.APPLICATIONS.parents[1] / "test/applications/browser" project.mkdir(exist_ok=True) - lines = [prepare.JAM_NOTICE, "import webcpp ;\nwebcpp.targets emscripten ;\n", - "webcpp.original node : .. ;\n"] + lines = [ + prepare.JAM_NOTICE, + "import webcpp ;\nwebcpp.targets emscripten ;\n", + "webcpp.original node : .. ;\n", + ] for row in rows: - sources = " ".join("../../../example/applications/browser/" + source - for source in row["sources"]) - lines.append(f"webcpp.variants {row['id']} : {sources}\n" - " : /webcpp/beast//browser on\n" - " ../../../example/applications/browser\n" - " ../../../example/applications single\n" - " BOOST_ASIO_HAS_CO_AWAIT=1\n" - " BOOST_ASIO_HAS_STD_COROUTINE=1 ;\n" - f"webcpp.drive run-{row['id']} : .//{row['id']}\n" - f" : {row['id']}.variants.json 120\n" - f" : run.mjs : --program {row['id']} --expected " - f'"application {row["id"]}: passed"\n' - " : emscripten ;\n") - lines.append("webcpp.lane applications-browser :\n " + - "\n ".join("run-" + row["id"] for row in rows) + "\n : emscripten ;\n") + sources = " ".join( + "../../../example/applications/browser/" + source for source in row["sources"] + ) + lines.append( + f"webcpp.variants {row['id']} : {sources}\n" + " : /webcpp/beast//browser on\n" + " ../../../example/applications/browser\n" + " ../../../example/applications\n" + " BOOST_ASIO_HAS_CO_AWAIT=1\n" + " BOOST_ASIO_HAS_STD_COROUTINE=1 ;\n" + f"webcpp.drive run-{row['id']} : .//{row['id']}\n" + f" : {row['id']}.variants.json 120\n" + " ../browser/page.html ../browser/network-worker.mjs\n" + f" : run.mjs : --program {row['id']} --expected " + f'"application {row["id"]}: passed" --host both\n' + " : emscripten ;\n" + ) + lines.append( + "webcpp.lane applications-browser :\n " + + "\n ".join("run-" + row["id"] for row in rows) + + "\n : emscripten ;\n" + ) prepare.write_changed(project / "Jamfile", "".join(lines)) - (prepare.APPLICATIONS / "browser/mapping.json").write_text(json.dumps({ - "applications": [row["id"] for row in rows], - "adaptations": ["Browser owns DNS, HTTP framing, WebSocket wire protocol and TLS trust.", - "TLS fixture trusts an ephemeral CA only in a fresh Chromium profile.", + (prepare.APPLICATIONS / "browser/mapping.json").write_text( + json.dumps( + { + "applications": [row["id"] for row in rows], + "adaptations": [ + "Browser owns DNS, HTTP framing, WebSocket wire protocol and TLS trust.", + "TLS fixture trusts an ephemeral CA only in a fresh Chromium profile.", + ( "No certificate exception is used; untrusted CA and trusted wrong-host " - "rejection controls accompany HTTPS/WSS exchanges.", - "Guest CA lists, TLS version pinning, and handshake User-Agent removed.", - "System executor and crawler threads use explicit io_context scheduling.", - "Awaitable clients retain co_await with explicit use_awaitable tokens.", - "Driver injects the local browser endpoint and validates response output."], - }, indent=2) + "\n") + "rejection controls accompany HTTPS/WSS exchanges." + ), + "Guest CA lists, TLS version pinning, and handshake User-Agent removed.", + "System executor and crawler threads use explicit io_context scheduling.", + "Awaitable clients retain co_await with explicit use_awaitable tokens.", + "Driver injects the local browser endpoint and validates response output.", + ], + }, + indent=2, + ) + + "\n" + ) diff --git a/example/applications/tools/prepare_noexcept.py b/example/applications/tools/prepare_noexcept.py index 7363532..eee469c 100644 --- a/example/applications/tools/prepare_noexcept.py +++ b/example/applications/tools/prepare_noexcept.py @@ -14,8 +14,12 @@ def masked(text): - return re.sub(r'//[^\n]*|/\*.*?\*/|"(?:\\.|[^"\\])*"|\'(?:\\.|[^\'\\])*\'', - lambda match: " " * len(match[0]), text, flags=re.S) + return re.sub( + r'//[^\n]*|/\*.*?\*/|"(?:\\.|[^"\\])*"|\'(?:\\.|[^\'\\])*\'', + lambda match: " " * len(match[0]), + text, + flags=re.S, + ) def end_block(text, opening): @@ -30,9 +34,12 @@ def end_block(text, opening): def observe_normal_close(text): if "void do_session(" not in text or "ws.read(buffer);" not in text: return text - text = text.replace('#include "failure.hpp"', - '#include "failure.hpp"\n#include "close_observation.hpp"') - return text.replace("ws.read(buffer);", """beast::error_code read_error; + text = text.replace( + '#include "failure.hpp"', '#include "failure.hpp"\n#include "close_observation.hpp"' + ) + return text.replace( + "ws.read(buffer);", + """beast::error_code read_error; ws.read(buffer, read_error); if (read_error == websocket::error::closed) { webcpp_fixture::observe_normal_close(); @@ -40,34 +47,39 @@ def observe_normal_close(text): } if (read_error) { webcpp_fixture::fail_stop(); - }""") + }""", + ) def adapt(text, browser=False): while match := re.search(r"\bcatch\s*\(", masked(text)): opening = text.index("{", match.end()) end = end_block(masked(text), opening) - text = text[:match.start()] + text[end:] + text = text[: match.start()] + text[end:] text = re.sub(r"\btry\s*(?=\{)", "", text) text = re.sub(r"std::rethrow_exception\([^;]*\)", "webcpp_fixture::fail_stop()", text) while match := re.search(r"\bthrow\b", masked(text)): end = text.index(";", match.end()) - text = text[:match.start()] + "webcpp_fixture::fail_stop()" + text[end:] - text = text.replace('#include "fixture.hpp"', - '#include "fixture.hpp"\n#include "failure.hpp"') + text = text[: match.start()] + "webcpp_fixture::fail_stop()" + text[end:] + text = text.replace('#include "fixture.hpp"', '#include "fixture.hpp"\n#include "failure.hpp"') if browser: text = text.replace("resolver.resolve(", "webcpp_fixture::resolve(resolver, ") - text = text.replace("ctx.set_verify_mode(ssl::verify_peer);", - "{ boost::system::error_code verify_error; " - "ctx.set_verify_mode(ssl::verify_peer, verify_error); " - "if (verify_error) webcpp_fixture::fail_stop(); }") + text = text.replace( + "ctx.set_verify_mode(ssl::verify_peer);", + "{ boost::system::error_code verify_error; " + "ctx.set_verify_mode(ssl::verify_peer, verify_error); " + "if (verify_error) webcpp_fixture::fail_stop(); }", + ) return observe_normal_close(text) def generate(formatter): manifest = json.loads((prepare.APPLICATIONS / "manifest.json").read_text()) - variants = (("port", "noexcept-native"), ("wasip3", "noexcept-single"), - ("browser", "noexcept-browser")) + variants = ( + ("port", "noexcept-native"), + ("wasip3", "noexcept-single"), + ("browser", "noexcept-browser"), + ) for original_variant, variant in variants: for original in sorted((prepare.APPLICATIONS / original_variant).rglob("*")): if original.suffix not in (".cpp", ".hpp"): @@ -76,14 +88,22 @@ def generate(formatter): destination = prepare.APPLICATIONS / variant / relative destination.parent.mkdir(parents=True, exist_ok=True) text = adapt(original.read_text(), original_variant == "browser") - text = subprocess.run([formatter, f"--assume-filename={destination}"], input=text, - text=True, capture_output=True, check=True).stdout + text = subprocess.run( + [formatter, f"--assume-filename={destination}"], + input=text, + text=True, + capture_output=True, + check=True, + ).stdout prepare.write_changed(destination, text) rows = [row for row in manifest["applications"] if not row["stackful"]] project = prepare.APPLICATIONS.parents[1] / "test/applications/noexcept" project.mkdir(exist_ok=True) - lines = [prepare.JAM_NOTICE, "import webcpp ;\nwebcpp.targets native wasip3 ;\n", - "webcpp.original python3 : .. ;\n"] + lines = [ + prepare.JAM_NOTICE, + "import webcpp ;\nwebcpp.targets native wasip2 wasip3 ;\n", + "webcpp.original python3 : .. ;\n", + ] native, single, cooperative, checked = [], [], [], [] for row in manifest["applications"]: modes = [("wasip3", "checked")] @@ -93,54 +113,88 @@ def generate(formatter): modes.append(("noexcept-single", "cooperative")) for variant, mode in modes: name = f"{mode}-{row['id']}" - groups = {"threaded": native, "single": single, "cooperative": cooperative, - "checked": checked} + groups = { + "threaded": native, + "single": single, + "cooperative": cooperative, + "checked": checked, + } groups[mode].append(name) - targets = ("wasip3" if mode == "cooperative" else "native" if - mode in ("threaded", "checked") or row["local_socket"] else "native wasip3") - sources = " ".join(f"../../../example/applications/{variant}/" + source - for source in row["sources"]) + targets = ( + "wasip3" + if mode == "cooperative" + else ( + "native" + if mode in ("threaded", "checked") or row["local_socket"] + else "native wasip2 wasip3" + ) + ) + sources = " ".join( + f"../../../example/applications/{variant}/" + source for source in row["sources"] + ) library = "tls" if row["tls"] else "sockets" threading = "multi" if mode in ("threaded", "cooperative") else "single" exceptions = "on" if mode == "checked" else "off" context = " /webcpp//boost_context" if row["stackful"] else "" - compile_budget = (" clang-wasip3:90\n" - if "wasip3" in targets else "") - lines.append(f"webcpp.drive {name} : {sources}\n" - f" : /webcpp/beast//{library}{context}\n" - f" {exceptions}\n" - f"{compile_budget}" - f" ../../../example/applications/{variant}\n" - f" ../../../example/applications {threading}\n" - " BOOST_ASIO_HAS_CO_AWAIT=1\n" - " BOOST_ASIO_HAS_STD_COROUTINE=1\n" - f" : ../driver.py : {row['id']} : {targets} ;\n") - lines.append("webcpp.lane applications-noexcept :\n " + "\n ".join(native) + - "\n : native ;\n") - lines.append("webcpp.lane applications-single-noexcept :\n " + "\n ".join(single) + - "\n : native wasip3 ;\n") - lines.append("webcpp.lane applications-cooperative-noexcept :\n " + - "\n ".join(cooperative) + "\n : wasip3 ;\n") - lines.append("webcpp.lane applications-single :\n " + "\n ".join(checked) + - "\n : native ;\n") + compile_budget = ( + " clang-wasip3:90\n" + if "wasip3" in targets + else "" + ) + lines.append( + f"webcpp.drive {name} : {sources}\n" + f" : /webcpp/beast//{library}{context}\n" + f" {exceptions}\n" + f"{compile_budget}" + f" ../../../example/applications/{variant}\n" + f" ../../../example/applications {threading}\n" + " BOOST_ASIO_HAS_CO_AWAIT=1\n" + " BOOST_ASIO_HAS_STD_COROUTINE=1\n" + f" : ../driver.py : {row['id']} : {targets} ;\n" + ) + lines.append( + "webcpp.lane applications-noexcept :\n " + "\n ".join(native) + "\n : native ;\n" + ) + lines.append( + "webcpp.lane applications-single-noexcept :\n " + + "\n ".join(single) + + "\n : native wasip2 wasip3 ;\n" + ) + lines.append( + "webcpp.lane applications-cooperative-noexcept :\n " + + "\n ".join(cooperative) + + "\n : wasip3 ;\n" + ) + lines.append( + "webcpp.lane applications-single :\n " + "\n ".join(checked) + "\n : native ;\n" + ) prepare.write_changed(project / "Jamfile", "".join(lines)) browser = json.loads((prepare.APPLICATIONS / "browser/mapping.json").read_text()) source_jam = (project.parent / "browser/Jamfile").read_text() source_jam = source_jam.replace("applications/browser/", "applications/noexcept-browser/") - source_jam = source_jam.replace("../../../example/applications/browser\n", - "../../../example/applications/noexcept-browser\n") + source_jam = source_jam.replace( + "../../../example/applications/browser\n", + "../../../example/applications/noexcept-browser\n", + ) source_jam = source_jam.replace("on", "off") source_jam = source_jam.replace(": run.mjs :", ": ../browser/run.mjs :") destination = project.parent / "browser-noexcept" destination.mkdir(exist_ok=True) prepare.write_changed(destination / "Jamfile", source_jam) - (prepare.APPLICATIONS / "noexcept-single/mapping.json").write_text(json.dumps({ - "applications": [row["id"] for row in rows], - "browser_applications": browser["applications"], - "adaptations": ["Explicit throw/rethrow sites terminate with a diagnostic and abort.", - "Catch blocks are removed; error_code paths and successful flows retained.", - "Sync WebSocket servers observe normal close " - "through error_code and return.", - "Boost.Context stackful source remains blocked in exception-off modes.", - "Single-thread variants additionally apply explicit WASIp3 scheduling."], - }, indent=2) + "\n") + (prepare.APPLICATIONS / "noexcept-single/mapping.json").write_text( + json.dumps( + { + "applications": [row["id"] for row in rows], + "browser_applications": browser["applications"], + "adaptations": [ + "Explicit throw/rethrow sites terminate with a diagnostic and abort.", + "Catch blocks are removed; error_code paths and successful flows retained.", + "Sync WebSocket servers observe normal close through error_code and return.", + "Boost.Context stackful source remains blocked in exception-off modes.", + "Single-thread variants additionally apply explicit WASIp3 scheduling.", + ], + }, + indent=2, + ) + + "\n" + ) diff --git a/example/applications/tools/prepare_wasip3.py b/example/applications/tools/prepare_wasip3.py index be2488e..885bd5e 100644 --- a/example/applications/tools/prepare_wasip3.py +++ b/example/applications/tools/prepare_wasip3.py @@ -119,7 +119,7 @@ def generate(formatter): not row["stackful"]] project = prepare.APPLICATIONS.parents[1] / "test/applications/wasip3" project.mkdir(exist_ok=True) - lines = [prepare.JAM_NOTICE, "import webcpp ;\nwebcpp.targets wasip3 ;\n", + lines = [prepare.JAM_NOTICE, "import webcpp ;\nwebcpp.targets wasip2 wasip3 ;\n", "webcpp.original python3 : .. ;\n"] for row in rows: sources = " ".join("../../../example/applications/wasip3/" + source @@ -132,7 +132,9 @@ def generate(formatter): " ../../../example/applications single\n" " BOOST_ASIO_HAS_CO_AWAIT=1\n" " BOOST_ASIO_HAS_STD_COROUTINE=1\n" - f" : ../driver.py : {row['id']} : wasip3 ;\n") + f" : ../driver.py : {row['id']} : wasip2 wasip3 ;\n") + lines.append("webcpp.lane applications-p2 :\n " + + "\n ".join(row["id"] for row in rows) + "\n : wasip2 ;\n") lines.append("webcpp.lane applications-p3 :\n " + "\n ".join(row["id"] for row in rows) + "\n : wasip3 ;\n") prepare.write_changed(project / "Jamfile", "".join(lines)) diff --git a/example/applications/wasip3.patch b/example/applications/wasip3.patch index 3b45012..7d62f23 100644 --- a/example/applications/wasip3.patch +++ b/example/applications/wasip3.patch @@ -2264,7 +2264,7 @@ - the one the child task runs on (e.g. via @c net::bind_executor). This is - because @c emit() can run on a different thread than the task, and - @c co_spawn dispatches the cancellation to the handler's associated -+ ote `completion_token` must have an associated executor that matches ++ @note `completion_token` must have an associated executor that matches + the one the child task runs on (e.g. via `net::bind_executor`). This is + because `emit`() can run on a different thread than the task, and + `co_spawn` dispatches the cancellation to the handler's associated @@ -2737,7 +2737,7 @@ { std::cout << "Sending a terminal cancellation signal...\n"; task_group.emit(net::cancellation_type::terminal); -@@ -586,90 +541,65 @@ +@@ -586,92 +541,63 @@ } std::cout << "Child tasks completed.\n"; @@ -2848,14 +2848,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/common/root_certificates.hpp +++ wasip3/common/root_certificates.hpp @@ -1,3 +1,21 @@ @@ -4654,7 +4656,7 @@ // set up the peer verification mode so that the TLS/SSL handshake fails // if the certificate verification is unsuccessful -@@ -117,19 +133,15 @@ +@@ -117,21 +133,13 @@ net::co_spawn(ioc, request(ctx), print_exception); @@ -4669,14 +4671,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/doc/ssl/server.cpp +++ wasip3/doc/ssl/server.cpp @@ -1,3 +1,21 @@ @@ -4826,7 +4830,7 @@ // The client's certificate will be verified against this // certificate authority. -@@ -113,19 +125,15 @@ +@@ -113,21 +125,13 @@ net::co_spawn(ioc, acceptor(ctx), print_exception); @@ -4841,14 +4845,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/echo-op/echo_op.cpp +++ wasip3/echo-op/echo_op.cpp @@ -1,3 +1,20 @@ @@ -5660,7 +5666,7 @@ return EXIT_FAILURE; } auto const path = argv[1]; -@@ -162,26 +145,23 @@ +@@ -162,26 +145,19 @@ int version = argc == 6 && !std::strcmp("1.0", argv[5]) ? 10 : 11; // The io_context is required for all I/O @@ -5679,17 +5685,15 @@ } #else - +- -int -main(int, char*[]) -{ -std::cerr << - "Local sockets not available on this platform" << std::endl; -return EXIT_FAILURE; -+int main(int, char*[]) { -+ std::cerr << "Local sockets not available on this platform" << std::endl; -+ return EXIT_FAILURE; - } +-} ++#error "This application requires its declared Asio backend" #endif --- upstream/http/client/async-ssl/http_client_async_ssl.cpp @@ -6454,17 +6458,20 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -135,9 +142,7 @@ +@@ -134,12 +141,6 @@ + } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp +++ wasip3/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp @@ -1,3 +1,21 @@ @@ -6645,17 +6652,20 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -188,9 +188,7 @@ +@@ -187,12 +187,6 @@ + } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/http/client/body/json_body.hpp +++ wasip3/http/client/body/json_body.hpp @@ -1,3 +1,20 @@ @@ -19396,7 +19406,7 @@ } // Accept another connection -@@ -392,50 +351,33 @@ +@@ -392,63 +351,39 @@ //------------------------------------------------------------------------------ @@ -19458,20 +19468,18 @@ std::cerr << e.what() << std::endl; return EXIT_FAILURE; } -@@ -443,12 +385,9 @@ + } #else - +- -int -main(int, char*[]) -{ -std::cerr << - "Local sockets not available on this platform" << std::endl; -return EXIT_FAILURE; -+int main(int, char*[]) { -+ std::cerr << "Local sockets not available on this platform" << std::endl; -+ return EXIT_FAILURE; - } +-} ++#error "This application requires its declared Asio backend" #endif --- upstream/http/server/async-ssl/http_server_async_ssl.cpp @@ -20433,7 +20441,7 @@ // At this point the connection is closed gracefully // we ignore the error because the client might have -@@ -247,89 +259,63 @@ +@@ -247,91 +259,61 @@ } // Accepts incoming connections and launches the sessions @@ -20551,15 +20559,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } ---- upstream/http/server/coro/http_server_coro.cpp +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif--- upstream/http/server/coro/http_server_coro.cpp +++ wasip3/http/server/coro/http_server_coro.cpp @@ -1,3 +1,20 @@ +// Copyright (c) 2026 WebCpp.org @@ -25947,7 +25956,7 @@ return EXIT_FAILURE; } auto const path = argv[1]; -@@ -185,26 +156,23 @@ +@@ -185,26 +156,19 @@ auto const text = argv[4]; // The io_context is required for all I/O @@ -25966,17 +25975,15 @@ } #else - +- -int -main(int, char*[]) -{ -std::cerr << - "Local sockets not available on this platform" << std::endl; -return EXIT_FAILURE; -+int main(int, char*[]) { -+ std::cerr << "Local sockets not available on this platform" << std::endl; -+ return EXIT_FAILURE; - } +-} ++#error "This application requires its declared Asio backend" #endif --- upstream/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -26796,17 +26803,20 @@ std::cerr << "Error: " << e.what() << std::endl; return EXIT_FAILURE; } -@@ -138,9 +138,7 @@ +@@ -137,12 +137,6 @@ + } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/websocket/client/coro/websocket_client_coro.cpp +++ wasip3/websocket/client/coro/websocket_client_coro.cpp @@ -1,3 +1,21 @@ @@ -28166,7 +28176,7 @@ // Remove previous binding std::remove(path); -@@ -242,20 +196,10 @@ +@@ -242,33 +196,16 @@ std::make_shared(ioc, stream_protocol::endpoint{path})->run(); // Run the I/O service on the requested number of threads @@ -28189,20 +28199,20 @@ std::cerr << e.what() << std::endl; return EXIT_FAILURE; } -@@ -263,11 +207,8 @@ + } #else - +- -int -main(int, char*[]) -{ - std::cerr << - "Local sockets not available on this platform" << std::endl; -+int main(int, char*[]) { -+ std::cerr << "Local sockets not available on this platform" << std::endl; - return EXIT_FAILURE; - } +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + #endif --- upstream/websocket/server/async-ssl/websocket_server_async_ssl.cpp +++ wasip3/websocket/server/async-ssl/websocket_server_async_ssl.cpp @@ -1,3 +1,22 @@ @@ -28729,7 +28739,7 @@ std::cerr << "Error in session: " << e.what() << "\n"; } } -@@ -105,59 +106,42 @@ +@@ -105,61 +106,40 @@ } } @@ -28801,14 +28811,16 @@ } #else - +- -int -main(int, char*[]) -{ -+int main(int, char*[]) { - std::printf("awaitables require C++20\n"); - return EXIT_FAILURE; - } +- std::printf("awaitables require C++20\n"); +- return EXIT_FAILURE; +-} ++#error "This application requires its declared Asio backend" + + #endif --- upstream/websocket/server/chat-multi/beast.hpp +++ wasip3/websocket/server/chat-multi/beast.hpp @@ -1,3 +1,21 @@ diff --git a/example/applications/wasip3/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp b/example/applications/wasip3/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp index b7053f9..f3c027d 100644 --- a/example/applications/wasip3/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp +++ b/example/applications/wasip3/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp @@ -35,18 +35,18 @@ #include "common/server_certificate.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -62,8 +62,8 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; -namespace ssl = boost::asio::ssl; +namespace net = webcpp::asio; +namespace ssl = webcpp::asio::ssl; using executor_type = net::strand; using stream_type = beast::tcp_stream::rebind_executor::other; diff --git a/example/applications/wasip3/advanced/server-flex/advanced_server_flex.cpp b/example/applications/wasip3/advanced/server-flex/advanced_server_flex.cpp index 2646c5d..b4022f6 100644 --- a/example/applications/wasip3/advanced/server-flex/advanced_server_flex.cpp +++ b/example/applications/wasip3/advanced/server-flex/advanced_server_flex.cpp @@ -34,14 +34,12 @@ #include "common/server_certificate.hpp" -#include -#include -#include +#include +#include #include +#include #include -#include -#include #include #include #include @@ -49,15 +47,17 @@ #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/advanced/server/advanced_server.cpp b/example/applications/wasip3/advanced/server/advanced_server.cpp index 38ada15..b92561d 100644 --- a/example/applications/wasip3/advanced/server/advanced_server.cpp +++ b/example/applications/wasip3/advanced/server/advanced_server.cpp @@ -31,12 +31,11 @@ // //------------------------------------------------------------------------------ -#include -#include +#include +#include #include #include -#include #include #include #include @@ -45,14 +44,15 @@ #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/common/root_certificates.hpp b/example/applications/wasip3/common/root_certificates.hpp index 56a857b..7e13e17 100644 --- a/example/applications/wasip3/common/root_certificates.hpp +++ b/example/applications/wasip3/common/root_certificates.hpp @@ -28,8 +28,8 @@ #ifndef BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP #define BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP -#include #include +#include /* PLEASE READ @@ -56,7 +56,7 @@ tl;dr: root_certificates.hpp should not be used in production code */ -namespace ssl = boost::asio::ssl; // from +namespace ssl = webcpp::asio::ssl; // from namespace detail { @@ -3958,7 +3958,7 @@ inline void load_root_certificates(ssl::context& ctx, boost::system::error_code& static_cast( // The ec output and the returned reference carry the same operation status. // NOLINTNEXTLINE(bugprone-unused-return-value) - ctx.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()), ec)); + ctx.add_certificate_authority(webcpp::asio::buffer(cert.data(), cert.size()), ec)); if (ec) { return; } diff --git a/example/applications/wasip3/common/server_certificate.hpp b/example/applications/wasip3/common/server_certificate.hpp index 43902a3..1cb657a 100644 --- a/example/applications/wasip3/common/server_certificate.hpp +++ b/example/applications/wasip3/common/server_certificate.hpp @@ -28,10 +28,10 @@ #ifndef BOOST_BEAST_EXAMPLE_COMMON_SERVER_CERTIFICATE_HPP #define BOOST_BEAST_EXAMPLE_COMMON_SERVER_CERTIFICATE_HPP -#include -#include #include #include +#include +#include /* Load a signed certificate into the ssl context, and configure the context for use with a server. @@ -42,11 +42,11 @@ depending on your environment Please see the documentation accompanying the Beast certificate for more details. */ -inline void load_server_certificate(boost::asio::ssl::context& ctx) { +inline void load_server_certificate(webcpp::asio::ssl::context& ctx) { if (auto const* path = std::getenv("WEBCPP_BEAST_FIXTURE_CERT")) { ctx.use_certificate_chain_file(path); ctx.use_private_key_file(std::getenv("WEBCPP_BEAST_FIXTURE_KEY"), - boost::asio::ssl::context::pem); + webcpp::asio::ssl::context::pem); return; } @@ -123,17 +123,18 @@ inline void load_server_certificate(boost::asio::ssl::context& ctx) { "-----END DH PARAMETERS-----\n"; ctx.set_password_callback( - [](std::size_t, boost::asio::ssl::context_base::password_purpose) { return "test"; }); + [](std::size_t, webcpp::asio::ssl::context_base::password_purpose) { return "test"; }); - ctx.set_options(boost::asio::ssl::context::default_workarounds | - boost::asio::ssl::context::no_sslv2 | boost::asio::ssl::context::single_dh_use); + ctx.set_options(webcpp::asio::ssl::context::default_workarounds | + webcpp::asio::ssl::context::no_sslv2 | + webcpp::asio::ssl::context::single_dh_use); - ctx.use_certificate_chain(boost::asio::buffer(cert.data(), cert.size())); + ctx.use_certificate_chain(webcpp::asio::buffer(cert.data(), cert.size())); - ctx.use_private_key(boost::asio::buffer(key.data(), key.size()), - boost::asio::ssl::context::file_format::pem); + ctx.use_private_key(webcpp::asio::buffer(key.data(), key.size()), + webcpp::asio::ssl::context::file_format::pem); - ctx.use_tmp_dh(boost::asio::buffer(dh.data(), dh.size())); + ctx.use_tmp_dh(webcpp::asio::buffer(dh.data(), dh.size())); } #endif diff --git a/example/applications/wasip3/doc/http_examples.hpp b/example/applications/wasip3/doc/http_examples.hpp index beceabc..75a7fe8 100644 --- a/example/applications/wasip3/doc/http_examples.hpp +++ b/example/applications/wasip3/doc/http_examples.hpp @@ -70,7 +70,7 @@ void send_expect_100_continue(SyncStream& stream, DynamicBuffer& buffer, request>& req, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // Insert or replace the Expect field @@ -122,7 +122,7 @@ template void receive_expect_100_continue(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // Declare a parser for a request with a string body @@ -211,8 +211,8 @@ void send_cgi_response(SyncReadStream& input, SyncWriteStream& output, error_cod do { // Read a buffer from the child process char buffer[2048]; - auto bytes_transferred = input.read_some(boost::asio::buffer(buffer, sizeof(buffer)), ec); - if (ec == boost::asio::error::eof) { + auto bytes_transferred = input.read_some(webcpp::asio::buffer(buffer, sizeof(buffer)), ec); + if (ec == webcpp::asio::error::eof) { ec = {}; // `nullptr` indicates there is no buffer @@ -262,7 +262,7 @@ void send_cgi_response(SyncReadStream& input, SyncWriteStream& output, error_cod template void do_server_head(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // We deliver this payload for all GET requests @@ -342,7 +342,7 @@ response do_head_request(SyncStream& stream, DynamicBuffer& buffer, error_code& ec) { // Do some type checking to be a good citizen static_assert(is_sync_stream::value, "SyncStream requirements not met"); - static_assert(boost::asio::is_dynamic_buffer::value, + static_assert(webcpp::asio::is_dynamic_buffer::value, "DynamicBuffer requirements not met"); // The interfaces we are using are low level and do not @@ -530,10 +530,10 @@ class write_ostream_helper { std::size_t bytes_transferred = 0; // Loop over the buffer sequence - for (auto it = boost::asio::buffer_sequence_begin(buffers); - it != boost::asio::buffer_sequence_end(buffers); ++it) { + for (auto it = webcpp::asio::buffer_sequence_begin(buffers); + it != webcpp::asio::buffer_sequence_end(buffers); ++it) { // This is the next buffer in the sequence - boost::asio::const_buffer const buffer = *it; + webcpp::asio::const_buffer const buffer = *it; // Write it to the std::ostream os_.write(reinterpret_cast(buffer.data()), buffer.size()); diff --git a/example/applications/wasip3/doc/ssl/client.cpp b/example/applications/wasip3/doc/ssl/client.cpp index 39991ec..aca3806 100644 --- a/example/applications/wasip3/doc/ssl/client.cpp +++ b/example/applications/wasip3/doc/ssl/client.cpp @@ -25,18 +25,18 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -45,7 +45,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = net::ssl; namespace { diff --git a/example/applications/wasip3/doc/ssl/server.cpp b/example/applications/wasip3/doc/ssl/server.cpp index 24d3245..b75974d 100644 --- a/example/applications/wasip3/doc/ssl/server.cpp +++ b/example/applications/wasip3/doc/ssl/server.cpp @@ -25,18 +25,18 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -45,7 +45,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; namespace ssl = net::ssl; namespace { diff --git a/example/applications/wasip3/echo-op/echo_op.cpp b/example/applications/wasip3/echo-op/echo_op.cpp index 51fb14d..a60b550 100644 --- a/example/applications/wasip3/echo-op/echo_op.cpp +++ b/example/applications/wasip3/echo-op/echo_op.cpp @@ -24,24 +24,24 @@ // Official repository: https://github.com/boostorg/beast // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -namespace net = boost::asio; +namespace net = webcpp::asio; namespace beast = webcpp::beast; namespace { @@ -125,7 +125,7 @@ class echo_op; // This example uses the Asio's stackless "fauxroutines", implemented // using a macro-based solution. It makes the code easier to write and // easier to read. This include file defines the necessary macros and types. -#include +#include // Read a line and echo it back // @@ -151,10 +151,10 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to net::async_completion init(token); - // The helper macro BOOST_ASIO_HANDLER_TYPE converts the completion + // The helper macro WEBCPP_ASIO_HANDLER_TYPE converts the completion // token type into a concrete handler type of the correct signature. - using handler_type = BOOST_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); + using handler_type = WEBCPP_ASIO_HANDLER_TYPE(CompletionToken, void(beast::error_code)); // The class template `async_base` holds the caller's completion // handler for us, and provides all of the boilerplate for forwarding @@ -180,7 +180,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to // Asio operation state combines completion ownership with coroutine resume state. // NOLINTNEXTLINE(misc-multiple-inheritance) - struct echo_op : base_type, boost::asio::coroutine { + struct echo_op : base_type, webcpp::asio::coroutine { AsyncStream& stream_state; DynamicBuffer& buffer_state; @@ -325,7 +325,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to }; // Create the composed operation and launch it. This is a constructor - // call followed by invocation of operator(). We use BOOST_ASIO_HANDLER_TYPE + // call followed by invocation of operator(). We use WEBCPP_ASIO_HANDLER_TYPE // to convert the completion token into the correct handler type, // allowing user-defined specializations of the async_result template // to be used. @@ -341,7 +341,7 @@ auto async_echo(AsyncStream& stream, DynamicBuffer& buffer, CompletionToken&& to } // Including this file undefines the macros used by the stackless fauxroutines. -#include +#include //] @@ -369,7 +369,7 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } - namespace net = boost::asio; + namespace net = webcpp::asio; auto const address = net::ip::make_address(argv[1]); auto const port = static_cast(webcpp_fixture::integer(argv[2])); diff --git a/example/applications/wasip3/http/client/async-local/http_client_async_local.cpp b/example/applications/wasip3/http/client/async-local/http_client_async_local.cpp index ec0b467..d119b61 100644 --- a/example/applications/wasip3/http/client/async-local/http_client_async_local.cpp +++ b/example/applications/wasip3/http/client/async-local/http_client_async_local.cpp @@ -31,7 +31,7 @@ // //------------------------------------------------------------------------------ -#include +#include #include #include @@ -43,8 +43,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp b/example/applications/wasip3/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp index 7b92a52..c90f7ee 100644 --- a/example/applications/wasip3/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp +++ b/example/applications/wasip3/http/client/async-ssl-system-executor/http_client_async_ssl_system_executor.cpp @@ -33,19 +33,19 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -65,14 +65,14 @@ class session : public std::enable_shared_from_this { // Objects are constructed with a strand to // ensure that handlers do not execute concurrently. - session(net::strand strand, ssl::context& ctx) + session(net::strand strand, ssl::context& ctx) : resolver_(strand), stream_(strand, ctx) {} public: // Delegate construction to a prive constructor to be able to use // the same strand for both I/O object. explicit session(webcpp::asio::io_context& ioc, ssl::context& ctx) - : session(net::make_strand(boost::asio::any_io_executor(ioc.get_executor())), ctx) {} + : session(net::make_strand(webcpp::asio::any_io_executor(ioc.get_executor())), ctx) {} // Start the asynchronous operation void run(char const* host, char const* port, char const* target, int version) { diff --git a/example/applications/wasip3/http/client/async-ssl/http_client_async_ssl.cpp b/example/applications/wasip3/http/client/async-ssl/http_client_async_ssl.cpp index 93ad560..6dbc687 100644 --- a/example/applications/wasip3/http/client/async-ssl/http_client_async_ssl.cpp +++ b/example/applications/wasip3/http/client/async-ssl/http_client_async_ssl.cpp @@ -33,18 +33,18 @@ #include "common/root_certificates.hpp" -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/http/client/async/http_client_async.cpp b/example/applications/wasip3/http/client/async/http_client_async.cpp index 04365ef..ea1ffa7 100644 --- a/example/applications/wasip3/http/client/async/http_client_async.cpp +++ b/example/applications/wasip3/http/client/async/http_client_async.cpp @@ -30,18 +30,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp b/example/applications/wasip3/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp index 6a8dedf..fe0c830 100644 --- a/example/applications/wasip3/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp +++ b/example/applications/wasip3/http/client/awaitable-ssl/http_client_awaitable_ssl.cpp @@ -31,11 +31,11 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include "common/root_certificates.hpp" @@ -48,8 +48,8 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; -namespace ssl = boost::asio::ssl; +namespace net = webcpp::asio; +namespace ssl = webcpp::asio::ssl; //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/http/client/awaitable/http_client_awaitable.cpp b/example/applications/wasip3/http/client/awaitable/http_client_awaitable.cpp index bc69458..7555d16 100644 --- a/example/applications/wasip3/http/client/awaitable/http_client_awaitable.cpp +++ b/example/applications/wasip3/http/client/awaitable/http_client_awaitable.cpp @@ -30,9 +30,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -43,7 +43,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Performs an HTTP GET and prints the response namespace { diff --git a/example/applications/wasip3/http/client/body/json_body.hpp b/example/applications/wasip3/http/client/body/json_body.hpp index 2711011..b4ffef8 100644 --- a/example/applications/wasip3/http/client/body/json_body.hpp +++ b/example/applications/wasip3/http/client/body/json_body.hpp @@ -34,10 +34,10 @@ #define BOOST_BEAST_EXAMPLE_JSON_BODY #include -#include #include #include #include +#include #include namespace json = boost::json; @@ -46,7 +46,7 @@ struct json_body { using value_type = json::value; struct writer { - using const_buffers_type = boost::asio::const_buffer; + using const_buffers_type = webcpp::asio::const_buffer; template writer(webcpp::beast::http::header const& /*unused*/, @@ -66,7 +66,7 @@ struct json_body { ec = {}; // We serialize as much as we can with the buffer. Often that'll suffice const auto len = serializer_.read(buffer_.data(), buffer_.size()); - return std::make_pair(boost::asio::const_buffer(len.data(), len.size()), + return std::make_pair(webcpp::asio::const_buffer(len.data(), len.size()), !serializer_.done()); } diff --git a/example/applications/wasip3/http/client/body/json_client.cpp b/example/applications/wasip3/http/client/body/json_client.cpp index 3780af1..f12d8da 100644 --- a/example/applications/wasip3/http/client/body/json_client.cpp +++ b/example/applications/wasip3/http/client/body/json_client.cpp @@ -23,8 +23,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from int main(int /*unused*/, char** /*unused*/) { // Our test endpoint for testing the json diff --git a/example/applications/wasip3/http/client/coro-ssl/http_client_coro_ssl.cpp b/example/applications/wasip3/http/client/coro-ssl/http_client_coro_ssl.cpp index f0dd8e3..8df8151 100644 --- a/example/applications/wasip3/http/client/coro-ssl/http_client_coro_ssl.cpp +++ b/example/applications/wasip3/http/client/coro-ssl/http_client_coro_ssl.cpp @@ -33,19 +33,19 @@ #include "common/root_certificates.hpp" -#include -#include #include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -210,7 +210,7 @@ int main(int argc, char** argv) { ctx.set_verify_mode(ssl::verify_peer); // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) diff --git a/example/applications/wasip3/http/client/coro/http_client_coro.cpp b/example/applications/wasip3/http/client/coro/http_client_coro.cpp index 514c962..35da19f 100644 --- a/example/applications/wasip3/http/client/coro/http_client_coro.cpp +++ b/example/applications/wasip3/http/client/coro/http_client_coro.cpp @@ -30,17 +30,17 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -160,7 +160,7 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc; // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) diff --git a/example/applications/wasip3/http/client/crawl/http_crawl.cpp b/example/applications/wasip3/http/client/crawl/http_crawl.cpp index c322d17..5dc8625 100644 --- a/example/applications/wasip3/http/client/crawl/http_crawl.cpp +++ b/example/applications/wasip3/http/client/crawl/http_crawl.cpp @@ -33,11 +33,6 @@ #include "urls_large_data.hpp" #include -#include -#include -#include -#include -#include #include #include #include @@ -45,6 +40,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -53,8 +53,8 @@ namespace chrono = std::chrono; // from namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/http/client/methods/http_client_methods.cpp b/example/applications/wasip3/http/client/methods/http_client_methods.cpp index b418dff..4f2b385 100644 --- a/example/applications/wasip3/http/client/methods/http_client_methods.cpp +++ b/example/applications/wasip3/http/client/methods/http_client_methods.cpp @@ -32,17 +32,17 @@ //[example_http_client_methods -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from // perform a get request namespace { diff --git a/example/applications/wasip3/http/client/sync-ssl/http_client_sync_ssl.cpp b/example/applications/wasip3/http/client/sync-ssl/http_client_sync_ssl.cpp index 0954fb9..266b095 100644 --- a/example/applications/wasip3/http/client/sync-ssl/http_client_sync_ssl.cpp +++ b/example/applications/wasip3/http/client/sync-ssl/http_client_sync_ssl.cpp @@ -33,18 +33,18 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = net::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = net::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/wasip3/http/client/sync/http_client_sync.cpp b/example/applications/wasip3/http/client/sync/http_client_sync.cpp index 11f1d5b..594aeac 100644 --- a/example/applications/wasip3/http/client/sync/http_client_sync.cpp +++ b/example/applications/wasip3/http/client/sync/http_client_sync.cpp @@ -32,17 +32,17 @@ //[example_http_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -// from -using tcp = webcpp::asio::ip::tcp; // from +// from +using tcp = webcpp::asio::ip::tcp; // from // Performs an HTTP GET and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/wasip3/http/server/async-local/http_server_async_local.cpp b/example/applications/wasip3/http/server/async-local/http_server_async_local.cpp index bd34fe0..33bdd69 100644 --- a/example/applications/wasip3/http/server/async-local/http_server_async_local.cpp +++ b/example/applications/wasip3/http/server/async-local/http_server_async_local.cpp @@ -31,10 +31,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include #include +#include +#include +#include #include #include @@ -49,8 +49,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/http/server/async-ssl/http_server_async_ssl.cpp b/example/applications/wasip3/http/server/async-ssl/http_server_async_ssl.cpp index 44ecd22..a10c3a5 100644 --- a/example/applications/wasip3/http/server/async-ssl/http_server_async_ssl.cpp +++ b/example/applications/wasip3/http/server/async-ssl/http_server_async_ssl.cpp @@ -34,23 +34,23 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/http/server/async/http_server_async.cpp b/example/applications/wasip3/http/server/async/http_server_async.cpp index 0e73a5e..65c00d9 100644 --- a/example/applications/wasip3/http/server/async/http_server_async.cpp +++ b/example/applications/wasip3/http/server/async/http_server_async.cpp @@ -31,22 +31,22 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include #include #include #include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/http/server/awaitable/http_server_awaitable.cpp b/example/applications/wasip3/http/server/awaitable/http_server_awaitable.cpp index 9afc382..edac458 100644 --- a/example/applications/wasip3/http/server/awaitable/http_server_awaitable.cpp +++ b/example/applications/wasip3/http/server/awaitable/http_server_awaitable.cpp @@ -30,11 +30,11 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include @@ -49,7 +49,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; -namespace net = boost::asio; +namespace net = webcpp::asio; // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/http/server/coro-ssl/http_server_coro_ssl.cpp b/example/applications/wasip3/http/server/coro-ssl/http_server_coro_ssl.cpp index 8e293ee..5b7bbc7 100644 --- a/example/applications/wasip3/http/server/coro-ssl/http_server_coro_ssl.cpp +++ b/example/applications/wasip3/http/server/coro-ssl/http_server_coro_ssl.cpp @@ -34,23 +34,23 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -419,7 +419,7 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e if (ec) { fail(ec, "accept"); } else { - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) @@ -427,7 +427,7 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e doc_root, std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } } @@ -459,25 +459,25 @@ int main(int argc, char** argv) { load_server_certificate(ctx); // Spawn a listening port - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_listen, std::ref(ioc), std::ref(ctx), - tcp::endpoint{address, port}, doc_root, std::placeholders::_1), - // on completion, spawn will call this function - // Value parameters retain the upstream callback and coroutine ownership - // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) { - std::rethrow_exception(ex); - } - }); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_listen, std::ref(ioc), std::ref(ctx), + tcp::endpoint{address, port}, doc_root, std::placeholders::_1), + // on completion, spawn will call this function + // Value parameters retain the upstream callback and coroutine ownership + // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) { + std::rethrow_exception(ex); + } + }); // Run the I/O service on the requested number of threads ioc.run(); // lint-run: drives the application's network operations diff --git a/example/applications/wasip3/http/server/coro/http_server_coro.cpp b/example/applications/wasip3/http/server/coro/http_server_coro.cpp index 9a85bd5..3739cc5 100644 --- a/example/applications/wasip3/http/server/coro/http_server_coro.cpp +++ b/example/applications/wasip3/http/server/coro/http_server_coro.cpp @@ -31,22 +31,22 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -376,14 +376,14 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, if (ec) { fail(ec, "accept"); } else { - boost::asio::spawn(acceptor.get_executor(), - // The concrete bound signature selects the upstream Asio - // spawn/completion overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_session, beast::tcp_stream(std::move(socket)), - doc_root, std::placeholders::_1), - // we ignore the result of the session, - // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::spawn(acceptor.get_executor(), + // The concrete bound signature selects the upstream Asio + // spawn/completion overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_session, beast::tcp_stream(std::move(socket)), + doc_root, std::placeholders::_1), + // we ignore the result of the session, + // most errors are handled with error_code + webcpp::asio::detached); } } } @@ -409,25 +409,25 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc{threads}; // Spawn a listening port - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, doc_root, - std::placeholders::_1), - // on completion, spawn will call this function - // Value parameters retain the upstream callback and coroutine ownership - // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) { - std::rethrow_exception(ex); - } - }); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_listen, std::ref(ioc), tcp::endpoint{address, port}, doc_root, + std::placeholders::_1), + // on completion, spawn will call this function + // Value parameters retain the upstream callback and coroutine ownership + // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) { + std::rethrow_exception(ex); + } + }); // Run the I/O service on the requested number of threads ioc.run(); // lint-run: drives the application's network operations diff --git a/example/applications/wasip3/http/server/fast/http_server_fast.cpp b/example/applications/wasip3/http/server/fast/http_server_fast.cpp index 10b0f6b..836e9c5 100644 --- a/example/applications/wasip3/http/server/fast/http_server_fast.cpp +++ b/example/applications/wasip3/http/server/fast/http_server_fast.cpp @@ -32,17 +32,6 @@ #include "fields_alloc.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -50,12 +39,23 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/http/server/flex/http_server_flex.cpp b/example/applications/wasip3/http/server/flex/http_server_flex.cpp index 736a1ed..d3b223b 100644 --- a/example/applications/wasip3/http/server/flex/http_server_flex.cpp +++ b/example/applications/wasip3/http/server/flex/http_server_flex.cpp @@ -34,21 +34,21 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/http/server/small/http_server_small.cpp b/example/applications/wasip3/http/server/small/http_server_small.cpp index 044ca94..a3285bf 100644 --- a/example/applications/wasip3/http/server/small/http_server_small.cpp +++ b/example/applications/wasip3/http/server/small/http_server_small.cpp @@ -30,29 +30,29 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from namespace { namespace my_program_state { diff --git a/example/applications/wasip3/http/server/stackless-ssl/http_server_stackless_ssl.cpp b/example/applications/wasip3/http/server/stackless-ssl/http_server_stackless_ssl.cpp index b66f69f..9f005fb 100644 --- a/example/applications/wasip3/http/server/stackless-ssl/http_server_stackless_ssl.cpp +++ b/example/applications/wasip3/http/server/stackless-ssl/http_server_stackless_ssl.cpp @@ -34,25 +34,25 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -285,7 +285,7 @@ void fail(beast::error_code ec, char const* what) { // Handles an HTTP server connection // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { ssl::stream stream_; beast::flat_buffer buffer_; std::shared_ptr doc_root_; @@ -309,7 +309,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -401,7 +401,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -409,7 +409,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; ssl::context& ctx_; tcp::acceptor acceptor_; @@ -471,7 +471,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -497,7 +497,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/http/server/stackless/http_server_stackless.cpp b/example/applications/wasip3/http/server/stackless/http_server_stackless.cpp index 63877a9..0309d11 100644 --- a/example/applications/wasip3/http/server/stackless/http_server_stackless.cpp +++ b/example/applications/wasip3/http/server/stackless/http_server_stackless.cpp @@ -31,23 +31,23 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { @@ -259,7 +259,7 @@ void fail(beast::error_code ec, char const* what) { // Handles an HTTP server connection // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { beast::tcp_stream stream_; beast::flat_buffer buffer_; std::shared_ptr doc_root_; @@ -282,7 +282,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -348,7 +348,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -356,7 +356,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -416,7 +416,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -440,7 +440,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/http/server/sync-ssl/http_server_sync_ssl.cpp b/example/applications/wasip3/http/server/sync-ssl/http_server_sync_ssl.cpp index 54339d3..d921000 100644 --- a/example/applications/wasip3/http/server/sync-ssl/http_server_sync_ssl.cpp +++ b/example/applications/wasip3/http/server/sync-ssl/http_server_sync_ssl.cpp @@ -33,21 +33,21 @@ #include "common/server_certificate.hpp" -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. namespace { diff --git a/example/applications/wasip3/http/server/sync/http_server_sync.cpp b/example/applications/wasip3/http/server/sync/http_server_sync.cpp index 8f05db9..b4d46f0 100644 --- a/example/applications/wasip3/http/server/sync/http_server_sync.cpp +++ b/example/applications/wasip3/http/server/sync/http_server_sync.cpp @@ -30,18 +30,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/client/async-local/websocket_client_async_local.cpp b/example/applications/wasip3/websocket/client/async-local/websocket_client_async_local.cpp index ae07c32..6d6dc50 100644 --- a/example/applications/wasip3/websocket/client/async-local/websocket_client_async_local.cpp +++ b/example/applications/wasip3/websocket/client/async-local/websocket_client_async_local.cpp @@ -32,8 +32,8 @@ // //------------------------------------------------------------------------------ -#include -#include +#include +#include #include #include @@ -46,8 +46,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp b/example/applications/wasip3/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp index 3188974..dfd2749 100644 --- a/example/applications/wasip3/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp +++ b/example/applications/wasip3/websocket/client/async-ssl-system-executor/websocket_client_async_ssl_system_executor.cpp @@ -34,22 +34,22 @@ #include "common/root_certificates.hpp" -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -69,14 +69,14 @@ class session : public std::enable_shared_from_this { // Objects are constructed with a strand to // ensure that handlers do not execute concurrently. - session(net::strand ex, ssl::context& ctx) + session(net::strand ex, ssl::context& ctx) : resolver_(ex), ws_(ex, ctx) {} public: // Delegate construction to a prive constructor to be able to use // the same strand for both I/O objects. explicit session(webcpp::asio::io_context& ioc, ssl::context& ctx) - : session(net::make_strand(boost::asio::any_io_executor(ioc.get_executor())), ctx) {} + : session(net::make_strand(webcpp::asio::any_io_executor(ioc.get_executor())), ctx) {} // Start the asynchronous operation void run(char const* host, char const* port, char const* text) { diff --git a/example/applications/wasip3/websocket/client/async-ssl/websocket_client_async_ssl.cpp b/example/applications/wasip3/websocket/client/async-ssl/websocket_client_async_ssl.cpp index 35a7ec1..3ad6008 100644 --- a/example/applications/wasip3/websocket/client/async-ssl/websocket_client_async_ssl.cpp +++ b/example/applications/wasip3/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -34,21 +34,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/client/async/websocket_client_async.cpp b/example/applications/wasip3/websocket/client/async/websocket_client_async.cpp index b3d949b..fdc85b4 100644 --- a/example/applications/wasip3/websocket/client/async/websocket_client_async.cpp +++ b/example/applications/wasip3/websocket/client/async/websocket_client_async.cpp @@ -31,19 +31,19 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/client/awaitable/websocket_client_awaitable.cpp b/example/applications/wasip3/websocket/client/awaitable/websocket_client_awaitable.cpp index 19b5e34..c47388a 100644 --- a/example/applications/wasip3/websocket/client/awaitable/websocket_client_awaitable.cpp +++ b/example/applications/wasip3/websocket/client/awaitable/websocket_client_awaitable.cpp @@ -31,9 +31,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -45,7 +45,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Sends a WebSocket message and prints the response namespace { diff --git a/example/applications/wasip3/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp b/example/applications/wasip3/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp index f08778a..78a734b 100644 --- a/example/applications/wasip3/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp +++ b/example/applications/wasip3/websocket/client/coro-ssl/websocket_client_coro_ssl.cpp @@ -34,21 +34,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -206,7 +206,7 @@ int main(int argc, char** argv) { load_root_certificates(ctx); // Launch the asynchronous operation - boost::asio::spawn( + webcpp::asio::spawn( ioc, // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) diff --git a/example/applications/wasip3/websocket/client/coro/websocket_client_coro.cpp b/example/applications/wasip3/websocket/client/coro/websocket_client_coro.cpp index 0a7d7b3..12cf46d 100644 --- a/example/applications/wasip3/websocket/client/coro/websocket_client_coro.cpp +++ b/example/applications/wasip3/websocket/client/coro/websocket_client_coro.cpp @@ -31,18 +31,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -169,25 +169,25 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc; // Launch the asynchronous operation - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_session, std::string(host), std::string(port), - std::string(text), std::ref(ioc), std::placeholders::_1), - // on completion, spawn will call this function - // Value parameters retain the upstream callback and coroutine ownership - // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) { - std::rethrow_exception(ex); - } - }); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_session, std::string(host), std::string(port), + std::string(text), std::ref(ioc), std::placeholders::_1), + // on completion, spawn will call this function + // Value parameters retain the upstream callback and coroutine ownership + // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) { + std::rethrow_exception(ex); + } + }); // Run the I/O service. The call will return when // the socket is closed. diff --git a/example/applications/wasip3/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp b/example/applications/wasip3/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp index bcca15b..5a668db 100644 --- a/example/applications/wasip3/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp +++ b/example/applications/wasip3/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp @@ -34,21 +34,21 @@ #include "common/root_certificates.hpp" -#include -#include -#include -#include #include #include #include +#include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/wasip3/websocket/client/sync/websocket_client_sync.cpp b/example/applications/wasip3/websocket/client/sync/websocket_client_sync.cpp index 7745078..4a4afd9 100644 --- a/example/applications/wasip3/websocket/client/sync/websocket_client_sync.cpp +++ b/example/applications/wasip3/websocket/client/sync/websocket_client_sync.cpp @@ -33,18 +33,18 @@ //[example_websocket_client -#include -#include #include #include #include +#include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from // Sends a WebSocket message and prints the response // The process entry point retains the standard char** argv signature. diff --git a/example/applications/wasip3/websocket/server/async-local/websocket_server_async_local.cpp b/example/applications/wasip3/websocket/server/async-local/websocket_server_async_local.cpp index 7ab7915..dcd3b81 100644 --- a/example/applications/wasip3/websocket/server/async-local/websocket_server_async_local.cpp +++ b/example/applications/wasip3/websocket/server/async-local/websocket_server_async_local.cpp @@ -32,9 +32,9 @@ // //------------------------------------------------------------------------------ -#include -#include -#include +#include +#include +#include #include #include @@ -50,8 +50,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using net::local::stream_protocol; // from +namespace net = webcpp::asio; // from +using net::local::stream_protocol; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/server/async-ssl/websocket_server_async_ssl.cpp b/example/applications/wasip3/websocket/server/async-ssl/websocket_server_async_ssl.cpp index a588f02..ff06771 100644 --- a/example/applications/wasip3/websocket/server/async-ssl/websocket_server_async_ssl.cpp +++ b/example/applications/wasip3/websocket/server/async-ssl/websocket_server_async_ssl.cpp @@ -35,24 +35,24 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/server/async/websocket_server_async.cpp b/example/applications/wasip3/websocket/server/async/websocket_server_async.cpp index a068d69..17b6586 100644 --- a/example/applications/wasip3/websocket/server/async/websocket_server_async.cpp +++ b/example/applications/wasip3/websocket/server/async/websocket_server_async.cpp @@ -32,13 +32,13 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include #include #include +#include +#include #include #include @@ -46,8 +46,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/server/awaitable/websocket_server_awaitable.cpp b/example/applications/wasip3/websocket/server/awaitable/websocket_server_awaitable.cpp index 487bda0..57b2b25 100644 --- a/example/applications/wasip3/websocket/server/awaitable/websocket_server_awaitable.cpp +++ b/example/applications/wasip3/websocket/server/awaitable/websocket_server_awaitable.cpp @@ -31,10 +31,10 @@ // //------------------------------------------------------------------------------ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -49,7 +49,7 @@ namespace beast = webcpp::beast; namespace http = beast::http; namespace websocket = beast::websocket; -namespace net = boost::asio; +namespace net = webcpp::asio; // Echoes back all received WebSocket messages namespace { diff --git a/example/applications/wasip3/websocket/server/chat-multi/net.hpp b/example/applications/wasip3/websocket/server/chat-multi/net.hpp index 07f416f..8576cb6 100644 --- a/example/applications/wasip3/websocket/server/chat-multi/net.hpp +++ b/example/applications/wasip3/websocket/server/chat-multi/net.hpp @@ -27,20 +27,19 @@ #ifndef BOOST_BEAST_EXAMPLE_WEBSOCKET_CHAT_MULTI_NET_HPP #define BOOST_BEAST_EXAMPLE_WEBSOCKET_CHAT_MULTI_NET_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from #endif diff --git a/example/applications/wasip3/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp b/example/applications/wasip3/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp index 88f8792..dd84119 100644 --- a/example/applications/wasip3/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp +++ b/example/applications/wasip3/websocket/server/coro-ssl/websocket_server_coro_ssl.cpp @@ -35,24 +35,24 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -195,7 +195,7 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e if (ec) { fail(ec, "accept"); } else { - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) @@ -204,7 +204,7 @@ void do_listen(webcpp::asio::io_context& ioc, ssl::context& ctx, tcp::endpoint e std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } } @@ -235,25 +235,25 @@ int main(int argc, char** argv) { load_server_certificate(ctx); // Spawn a listening port - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_listen, std::ref(ioc), std::ref(ctx), - tcp::endpoint{address, port}, std::placeholders::_1), - // on completion, spawn will call this function - // Value parameters retain the upstream callback and coroutine ownership - // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) - [](std::exception_ptr ex) { - // if an exception occurred in the coroutine, - // it's something critical, e.g. out of memory - // we capture normal errors in the ec - // so we just rethrow the exception here, - // which will cause `ioc.run()` to throw // lint-run: drives the - // application's network operations - if (ex) { - std::rethrow_exception(ex); - } - }); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_listen, std::ref(ioc), std::ref(ctx), + tcp::endpoint{address, port}, std::placeholders::_1), + // on completion, spawn will call this function + // Value parameters retain the upstream callback and coroutine ownership + // contract. NOLINTNEXTLINE(performance-unnecessary-value-param) + [](std::exception_ptr ex) { + // if an exception occurred in the coroutine, + // it's something critical, e.g. out of memory + // we capture normal errors in the ec + // so we just rethrow the exception here, + // which will cause `ioc.run()` to throw // lint-run: drives the + // application's network operations + if (ex) { + std::rethrow_exception(ex); + } + }); // Run the I/O service on the requested number of threads ioc.run(); // lint-run: drives the application's network operations diff --git a/example/applications/wasip3/websocket/server/coro/websocket_server_coro.cpp b/example/applications/wasip3/websocket/server/coro/websocket_server_coro.cpp index 566b73f..1dc24df 100644 --- a/example/applications/wasip3/websocket/server/coro/websocket_server_coro.cpp +++ b/example/applications/wasip3/websocket/server/coro/websocket_server_coro.cpp @@ -32,13 +32,13 @@ //------------------------------------------------------------------------------ #include -#include -#include #include #include #include #include #include +#include +#include #include #include @@ -46,8 +46,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -171,7 +171,7 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, net::yield if (ec) { fail(ec, "accept"); } else { - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) @@ -179,7 +179,7 @@ void do_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, net::yield std::placeholders::_1), // we ignore the result of the session, // most errors are handled with error_code - boost::asio::detached); + webcpp::asio::detached); } } } @@ -204,7 +204,7 @@ int main(int argc, char** argv) { webcpp::asio::io_context ioc(threads); // Spawn a listening port - boost::asio::spawn( + webcpp::asio::spawn( ioc, // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) diff --git a/example/applications/wasip3/websocket/server/fast/websocket_server_fast.cpp b/example/applications/wasip3/websocket/server/fast/websocket_server_fast.cpp index b64a2e9..9ee2b85 100644 --- a/example/applications/wasip3/websocket/server/fast/websocket_server_fast.cpp +++ b/example/applications/wasip3/websocket/server/fast/websocket_server_fast.cpp @@ -45,14 +45,14 @@ */ #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include #include @@ -60,8 +60,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -352,13 +352,13 @@ void do_coro_listen(webcpp::asio::io_context& ioc, tcp::endpoint endpoint, continue; } - boost::asio::spawn( + webcpp::asio::spawn( acceptor.get_executor(), // The concrete bound signature selects the upstream Asio spawn/completion overload. // NOLINTNEXTLINE(modernize-avoid-bind) std::bind(&do_coro_session, websocket::stream(std::move(socket)), std::placeholders::_1), - boost::asio::detached); + webcpp::asio::detached); } } @@ -396,13 +396,13 @@ int main(int argc, char** argv) { ->run(); // Create coro port - boost::asio::spawn(ioc, - // The concrete bound signature selects the upstream Asio spawn/completion - // overload. NOLINTNEXTLINE(modernize-avoid-bind) - std::bind(&do_coro_listen, std::ref(ioc), - tcp::endpoint{address, static_cast(port + 2u)}, - std::placeholders::_1), - boost::asio::detached); + webcpp::asio::spawn(ioc, + // The concrete bound signature selects the upstream Asio spawn/completion + // overload. NOLINTNEXTLINE(modernize-avoid-bind) + std::bind(&do_coro_listen, std::ref(ioc), + tcp::endpoint{address, static_cast(port + 2u)}, + std::placeholders::_1), + webcpp::asio::detached); // Run the I/O service on the requested number of threads ioc.run(); // lint-run: drives the application's network operations diff --git a/example/applications/wasip3/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp b/example/applications/wasip3/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp index 3a8a9f6..b94e642 100644 --- a/example/applications/wasip3/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp +++ b/example/applications/wasip3/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp @@ -35,26 +35,26 @@ #include "common/server_certificate.hpp" #include -#include -#include -#include -#include -#include #include #include #include #include #include +#include +#include +#include +#include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -67,7 +67,7 @@ void fail(beast::error_code ec, char const* what) { // Echoes back all received WebSocket messages // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { websocket::stream> ws_; beast::flat_buffer buffer_; @@ -86,7 +86,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -174,7 +174,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -182,7 +182,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; ssl::context& ctx_; tcp::acceptor acceptor_; @@ -238,7 +238,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -264,7 +264,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/server/stackless/websocket_server_stackless.cpp b/example/applications/wasip3/websocket/server/stackless/websocket_server_stackless.cpp index e224bda..a05bae2 100644 --- a/example/applications/wasip3/websocket/server/stackless/websocket_server_stackless.cpp +++ b/example/applications/wasip3/websocket/server/stackless/websocket_server_stackless.cpp @@ -32,14 +32,14 @@ //------------------------------------------------------------------------------ #include -#include -#include -#include #include #include #include #include #include +#include +#include +#include #include #include @@ -47,8 +47,8 @@ namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ @@ -61,7 +61,7 @@ void fail(beast::error_code ec, char const* what) { // Echoes back all received WebSocket messages // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class session : public boost::asio::coroutine, public std::enable_shared_from_this { +class session : public webcpp::asio::coroutine, public std::enable_shared_from_this { websocket::stream ws_; beast::flat_buffer buffer_; @@ -80,7 +80,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th beast::bind_front_handler(&session::loop, shared_from_this(), beast::error_code{}, 0)); } -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -147,7 +147,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th } } -#include +#include }; //------------------------------------------------------------------------------ @@ -155,7 +155,7 @@ class session : public boost::asio::coroutine, public std::enable_shared_from_th // Accepts incoming connections and launches the sessions // Upstream combines coroutine state and shared lifetime as independent mixins. // NOLINTNEXTLINE(misc-multiple-inheritance) -class listener : public boost::asio::coroutine, public std::enable_shared_from_this { +class listener : public webcpp::asio::coroutine, public std::enable_shared_from_this { webcpp::asio::io_context& ioc_; tcp::acceptor acceptor_; tcp::socket socket_; @@ -210,7 +210,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t private: // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include // The retained stackless coroutine expands each yield into nested resume branches. // NOLINTNEXTLINE(readability-function-cognitive-complexity) @@ -236,7 +236,7 @@ class listener : public boost::asio::coroutine, public std::enable_shared_from_t // Asio yield/unyield headers intentionally toggle macros and have no include guards. // NOLINTNEXTLINE(readability-duplicate-include) -#include +#include }; //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp b/example/applications/wasip3/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp index 6824509..776ab84 100644 --- a/example/applications/wasip3/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp +++ b/example/applications/wasip3/websocket/server/sync-ssl/websocket_server_sync_ssl.cpp @@ -34,21 +34,21 @@ #include "common/server_certificate.hpp" -#include -#include -#include #include #include #include #include +#include +#include #include +#include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -namespace ssl = boost::asio::ssl; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +namespace ssl = webcpp::asio::ssl; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/applications/wasip3/websocket/server/sync/websocket_server_sync.cpp b/example/applications/wasip3/websocket/server/sync/websocket_server_sync.cpp index ec2e0bc..ec7e498 100644 --- a/example/applications/wasip3/websocket/server/sync/websocket_server_sync.cpp +++ b/example/applications/wasip3/websocket/server/sync/websocket_server_sync.cpp @@ -31,18 +31,18 @@ // //------------------------------------------------------------------------------ -#include #include #include #include #include +#include #include namespace beast = webcpp::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from -namespace net = boost::asio; // from -using tcp = webcpp::asio::ip::tcp; // from +namespace net = webcpp::asio; // from +using tcp = webcpp::asio::ip::tcp; // from //------------------------------------------------------------------------------ diff --git a/example/browser/client.cpp b/example/browser/client.cpp index b51e2ed..35f9b7a 100644 --- a/example/browser/client.cpp +++ b/example/browser/client.cpp @@ -14,9 +14,9 @@ #include #include -#include #include #include +#include int main() { namespace beast = webcpp::beast; @@ -46,7 +46,7 @@ int main() { return 1; } socket.text(true); - socket.write(boost::asio::buffer("hello", 5), ec); + socket.write(net::buffer("hello", 5), ec); if (ec) { return 1; } diff --git a/include/webcpp/beast/_experimental/http/icy_stream.hpp b/include/webcpp/beast/_experimental/http/icy_stream.hpp new file mode 100644 index 0000000..520d949 --- /dev/null +++ b/include/webcpp/beast/_experimental/http/icy_stream.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_HTTP_ICY_STREAM_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_HTTP_ICY_STREAM_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/http/icy_stream.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/test/error.hpp b/include/webcpp/beast/_experimental/test/error.hpp new file mode 100644 index 0000000..2321d64 --- /dev/null +++ b/include/webcpp/beast/_experimental/test/error.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_ERROR_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_ERROR_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/test/error.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/test/fail_count.hpp b/include/webcpp/beast/_experimental/test/fail_count.hpp new file mode 100644 index 0000000..3d4ad39 --- /dev/null +++ b/include/webcpp/beast/_experimental/test/fail_count.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_FAIL_COUNT_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_FAIL_COUNT_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/test/fail_count.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/test/handler.hpp b/include/webcpp/beast/_experimental/test/handler.hpp new file mode 100644 index 0000000..943a89d --- /dev/null +++ b/include/webcpp/beast/_experimental/test/handler.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_HANDLER_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_HANDLER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/test/handler.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/test/immediate_executor.hpp b/include/webcpp/beast/_experimental/test/immediate_executor.hpp new file mode 100644 index 0000000..992c9c2 --- /dev/null +++ b/include/webcpp/beast/_experimental/test/immediate_executor.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_IMMEDIATE_EXECUTOR_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_IMMEDIATE_EXECUTOR_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/test/immediate_executor.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/test/stream.hpp b/include/webcpp/beast/_experimental/test/stream.hpp new file mode 100644 index 0000000..883d258 --- /dev/null +++ b/include/webcpp/beast/_experimental/test/stream.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_STREAM_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_STREAM_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/test/stream.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/test/tcp.hpp b/include/webcpp/beast/_experimental/test/tcp.hpp new file mode 100644 index 0000000..3043e90 --- /dev/null +++ b/include/webcpp/beast/_experimental/test/tcp.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_TCP_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_TEST_TCP_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/test/tcp.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/amount.hpp b/include/webcpp/beast/_experimental/unit_test/amount.hpp new file mode 100644 index 0000000..1704898 --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/amount.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_AMOUNT_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_AMOUNT_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/amount.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/dstream.hpp b/include/webcpp/beast/_experimental/unit_test/dstream.hpp new file mode 100644 index 0000000..512d411 --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/dstream.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_DSTREAM_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_DSTREAM_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/dstream.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/global_suites.hpp b/include/webcpp/beast/_experimental/unit_test/global_suites.hpp new file mode 100644 index 0000000..13587cb --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/global_suites.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_GLOBAL_SUITES_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_GLOBAL_SUITES_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/global_suites.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/match.hpp b/include/webcpp/beast/_experimental/unit_test/match.hpp new file mode 100644 index 0000000..106d06f --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/match.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_MATCH_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_MATCH_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/match.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/recorder.hpp b/include/webcpp/beast/_experimental/unit_test/recorder.hpp new file mode 100644 index 0000000..75b0d9a --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/recorder.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_RECORDER_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_RECORDER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/recorder.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/reporter.hpp b/include/webcpp/beast/_experimental/unit_test/reporter.hpp new file mode 100644 index 0000000..6503dc2 --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/reporter.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_REPORTER_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_REPORTER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/reporter.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/results.hpp b/include/webcpp/beast/_experimental/unit_test/results.hpp new file mode 100644 index 0000000..d63fd65 --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/results.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_RESULTS_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_RESULTS_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/results.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/runner.hpp b/include/webcpp/beast/_experimental/unit_test/runner.hpp new file mode 100644 index 0000000..216d363 --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/runner.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_RUNNER_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_RUNNER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/runner.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/suite.hpp b/include/webcpp/beast/_experimental/unit_test/suite.hpp new file mode 100644 index 0000000..ed54d83 --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/suite.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_SUITE_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_SUITE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/suite.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/suite_info.hpp b/include/webcpp/beast/_experimental/unit_test/suite_info.hpp new file mode 100644 index 0000000..5f727ab --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/suite_info.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_SUITE_INFO_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_SUITE_INFO_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/suite_info.hpp) +#endif diff --git a/include/webcpp/beast/_experimental/unit_test/suite_list.hpp b/include/webcpp/beast/_experimental/unit_test/suite_list.hpp new file mode 100644 index 0000000..3f7702f --- /dev/null +++ b/include/webcpp/beast/_experimental/unit_test/suite_list.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_SUITE_LIST_HPP +#define WEBCPP_BEAST_FORWARD__EXPERIMENTAL_UNIT_TEST_SUITE_LIST_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(_experimental/unit_test/suite_list.hpp) +#endif diff --git a/include/webcpp/beast/browser/detail/imports.hpp b/include/webcpp/beast/browser/detail/imports.hpp index 6a32cbd..b133d37 100644 --- a/include/webcpp/beast/browser/detail/imports.hpp +++ b/include/webcpp/beast/browser/detail/imports.hpp @@ -48,7 +48,9 @@ inline int webcpp_beast_send(emscripten::EM_VAL handle, const void* data, std::s const socket = Emval.toValue(handle); if (socket.readyState !== WebSocket.OPEN) return 1; try { - const bytes = HEAPU8.subarray(data, data + size); + const view = HEAPU8.subarray(data, data + size); + // WebSocket.send and TextDecoder require non-shared BufferSource data. + const bytes = view.buffer instanceof ArrayBuffer ? view : view.slice(); socket.send(text ? new TextDecoder().decode(bytes) : bytes); return 0; } catch (_) { return 1; } @@ -83,7 +85,12 @@ inline void webcpp_beast_copy(emscripten::EM_VAL value, void* data, std::size_t const source = Emval.toValue(value); // Take the Wasm view after C++ has prepared storage and may have grown memory. const destination = HEAPU8.subarray(data, data + size); - if (typeof source === 'string') new TextEncoder().encodeInto(source, destination); + if (typeof source === 'string') { + const encoder = new TextEncoder(); + // encodeInto rejects SharedArrayBuffer-backed views in threaded builds. + if (destination.buffer instanceof ArrayBuffer) encoder.encodeInto(source, destination); + else destination.set(encoder.encode(source)); + } else destination.set(new Uint8Array(source)); }, value, data, size); } diff --git a/include/webcpp/beast/browser/detail/support.hpp b/include/webcpp/beast/browser/detail/support.hpp index 299a84c..36e586a 100644 --- a/include/webcpp/beast/browser/detail/support.hpp +++ b/include/webcpp/beast/browser/detail/support.hpp @@ -10,14 +10,14 @@ #include #include -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(append.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(associated_allocator.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(associated_cancellation_slot.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(associated_executor.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(async_result.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(bind_allocator.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(error.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(executor_work_guard.hpp) // lint-world: browser operation scheduling and handler associations #include #include #include @@ -54,14 +54,14 @@ using boost::system::error_code; /** Executor used to schedule stream operations and their completions. */ -using executor_type = boost::asio::any_io_executor; +using executor_type = ::webcpp::asio_backend::any_io_executor; /** Maps an unsupported request to the selected compatibility policy. */ inline error_code unsupported(bool condition = true) { return condition && !ignore_unsupported - ? error_code(boost::asio::error::operation_not_supported) + ? error_code(::webcpp::asio_backend::error::operation_not_supported) : error_code{}; } @@ -80,8 +80,8 @@ inline void throw_error(error_code ec) { template void post(const executor_type& executor, Handler&& handler, Values&&... values) { webcpp::asio::detail::post_completion( - executor, - boost::asio::append(std::forward(handler), std::forward(values)...)); + executor, ::webcpp::asio_backend::append(std::forward(handler), + std::forward(values)...)); } /** @@ -203,17 +203,18 @@ struct pending { template class operation final : public pending { using allocator_type = std::allocator_traits< - boost::asio::associated_allocator_t>::template rebind_alloc; + ::webcpp::asio_backend::associated_allocator_t>::template rebind_alloc; Handler handler_; Action action_; pending*& slot_; executor_type executor_; - boost::asio::executor_work_guard work_; - boost::asio::executor_work_guard> + ::webcpp::asio_backend::executor_work_guard work_; + ::webcpp::asio_backend::executor_work_guard< + ::webcpp::asio_backend::associated_executor_t> completion_work_; void destroy() { - allocator_type allocator(boost::asio::get_associated_allocator(handler_)); + allocator_type allocator(::webcpp::asio_backend::get_associated_allocator(handler_)); std::allocator_traits::destroy(allocator, this); std::allocator_traits::deallocate(allocator, this, 1); } @@ -228,20 +229,20 @@ class operation final : public pending { slot_(slot), executor_(std::move(executor)), work_(executor_), - completion_work_(boost::asio::get_associated_executor(handler_, executor_)) { + completion_work_(::webcpp::asio_backend::get_associated_executor(handler_, executor_)) { slot_ = this; } /** Installs cancellation handling for a pending operation. */ - void start(boost::asio::cancellation_type mask, const auto& cancel) { - auto cancellation = boost::asio::get_associated_cancellation_slot(handler_); + void start(::webcpp::asio_backend::cancellation_type mask, const auto& cancel) { + auto cancellation = ::webcpp::asio_backend::get_associated_cancellation_slot(handler_); if (cancellation.is_connected()) { cancellation.assign([this, mask, cancel](auto kind) { - if ((kind & mask) != boost::asio::cancellation_type::none) { + if ((kind & mask) != ::webcpp::asio_backend::cancellation_type::none) { cancel(); - complete(boost::asio::error::operation_aborted); + complete(::webcpp::asio_backend::error::operation_aborted); } }); } @@ -251,7 +252,7 @@ class operation final : public pending { Releases operation storage without invoking the handler during context destruction. */ void discard() override { - boost::asio::get_associated_cancellation_slot(handler_).clear(); + ::webcpp::asio_backend::get_associated_cancellation_slot(handler_).clear(); slot_ = nullptr; destroy(); } @@ -260,10 +261,10 @@ class operation final : public pending { Releases operation storage and posts exactly one completion. */ void complete(error_code ec = {}, std::size_t count = 0) override { - boost::asio::get_associated_cancellation_slot(handler_).clear(); + ::webcpp::asio_backend::get_associated_cancellation_slot(handler_).clear(); slot_ = nullptr; action_(ec, count); - allocator_type allocator(boost::asio::get_associated_allocator(handler_)); + allocator_type allocator(::webcpp::asio_backend::get_associated_allocator(handler_)); auto handler = std::move(handler_); const auto executor = executor_; // Post before releasing work; the queued completion then owns the wakeup. @@ -282,11 +283,11 @@ class operation final : public pending { */ template void start(pending*& slot, const executor_type& executor, Handler&& handler, Action action, - boost::asio::cancellation_type mask, const Cancel& cancel) { + ::webcpp::asio_backend::cancellation_type mask, const Cancel& cancel) { using type = operation, Sized, Action>; - using allocator_type = std::allocator_traits< - boost::asio::associated_allocator_t>>::template rebind_alloc; - allocator_type allocator(boost::asio::get_associated_allocator(handler)); + using allocator_type = std::allocator_traits<::webcpp::asio_backend::associated_allocator_t< + std::decay_t>>::template rebind_alloc; + allocator_type allocator(::webcpp::asio_backend::get_associated_allocator(handler)); auto* object = std::allocator_traits::allocate(allocator, 1); std::allocator_traits::construct( allocator, object, std::forward(handler), std::move(action), slot, executor); diff --git a/include/webcpp/beast/browser/http.hpp b/include/webcpp/beast/browser/http.hpp index 03d8617..566299f 100644 --- a/include/webcpp/beast/browser/http.hpp +++ b/include/webcpp/beast/browser/http.hpp @@ -11,9 +11,9 @@ #include #include -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: portable protocol data and explicit stream algorithms -#include // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_ASIO_BACKEND_HEADER(steady_timer.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_range.hpp) // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(core/error.hpp) // lint-world: portable protocol data and explicit stream algorithms #include #include #include @@ -56,7 +56,7 @@ class http_state final : public webcpp::asio::browser::intrusive_registration, /** Timer enforcing the current operation deadline. */ - boost::asio::steady_timer timer; // lint-world: browser operation deadline + ::webcpp::asio_backend::steady_timer timer; // lint-world: browser operation deadline /** Registration key used to reject events from detached operations. */ @@ -105,8 +105,8 @@ class http_state final : public webcpp::asio::browser::intrusive_registration, : memory(std::move(storage)), resource(memory.get()), executor(std::move(ex)), - bridge(&boost::asio::use_service( - boost::asio::query(executor, boost::asio::execution::context))), + bridge(&::webcpp::asio_backend::use_service( + ::webcpp::asio_backend::query(executor, ::webcpp::asio_backend::execution::context))), timer(executor) {} /** @@ -154,7 +154,7 @@ class http_state final : public webcpp::asio::browser::intrusive_registration, detach(); cancel_timer(); active = false; - failure = boost::asio::error::operation_aborted; + failure = ::webcpp::asio_backend::error::operation_aborted; ready = true; if (read != nullptr) { read->complete(failure); @@ -186,7 +186,7 @@ class http_state final : public webcpp::asio::browser::intrusive_registration, Queues a browser event on the stream executor while retaining state ownership. */ bool deliver(const emscripten::val& event) override { - post(executor, boost::asio::bind_allocator( + post(executor, ::webcpp::asio_backend::bind_allocator( owning_allocator(memory), [self = shared_from_this(), event, generation = key] { if (!self->alive || !self->active || self->key != generation) { @@ -209,7 +209,7 @@ class http_state final : public webcpp::asio::browser::intrusive_registration, if (type == "fetch-error") { self->failure = make_error_code(browser_errc::fetch_failed); } else if (type == "fetch-limit") { - self->failure = boost::beast::http::error::body_limit; + self->failure = ::webcpp::beast_backend::http::error::body_limit; } else { self->response = event; self->failure = unsupported(event["redirected"].as()); @@ -229,7 +229,7 @@ class http_state final : public webcpp::asio::browser::intrusive_registration, return; } timer.expires_at(deadline); - timer.async_wait(boost::asio::bind_allocator( + timer.async_wait(::webcpp::asio_backend::bind_allocator( owning_allocator(memory), [weak = weak_from_this(), generation = key](error_code ec) { if (auto const self = weak.lock(); @@ -238,7 +238,7 @@ class http_state final : public webcpp::asio::browser::intrusive_registration, self->detach(); self->active = false; self->ready = true; - self->failure = boost::beast::error::timeout; + self->failure = ::webcpp::beast_backend::error::timeout; if (self->read) { self->read->complete(self->failure); } @@ -270,7 +270,7 @@ concept host_stream = std::same_as, tcp_stream> || std::same_as, ssl_stream>; /** Detects forbidden methods in a Fetch method-override field value. */ -inline bool forbidden_method_override(boost::beast::string_view value) { +inline bool forbidden_method_override(::webcpp::beast_backend::string_view value) { // Fetch splits comma-separated values while preserving HTTP quoted strings. // https://fetch.spec.whatwg.org/#forbidden-request-header while (!value.empty()) { @@ -293,8 +293,9 @@ inline bool forbidden_method_override(boost::beast::string_view value) { while (!method.empty() && (method.back() == ' ' || method.back() == '\t')) { method.remove_suffix(1); } - if (boost::beast::iequals(method, "CONNECT") || boost::beast::iequals(method, "TRACE") || - boost::beast::iequals(method, "TRACK")) { + if (::webcpp::beast_backend::iequals(method, "CONNECT") || + ::webcpp::beast_backend::iequals(method, "TRACE") || + ::webcpp::beast_backend::iequals(method, "TRACK")) { return true; } if (length == value.size()) { @@ -308,7 +309,8 @@ inline bool forbidden_method_override(boost::beast::string_view value) { /** Detects request headers that the browser owns or may overwrite. */ -inline bool forbidden_header(boost::beast::string_view name, boost::beast::string_view value) { +inline bool forbidden_header(::webcpp::beast_backend::string_view name, + ::webcpp::beast_backend::string_view value) { // Fetch's forbidden request headers plus User-Agent, which browsers may overwrite. constexpr std::array names = { "accept-charset", @@ -331,18 +333,18 @@ inline bool forbidden_header(boost::beast::string_view name, boost::beast::strin "permissions-policy", }; for (auto const item : names) { - if (boost::beast::iequals(name, {item.data(), item.size()})) { + if (::webcpp::beast_backend::iequals(name, {item.data(), item.size()})) { return true; } } if (name.size() >= 4 && - (boost::beast::iequals(name.substr(0, 4), "sec-") || - (name.size() >= 6 && boost::beast::iequals(name.substr(0, 6), "proxy-")))) { + (::webcpp::beast_backend::iequals(name.substr(0, 4), "sec-") || + (name.size() >= 6 && ::webcpp::beast_backend::iequals(name.substr(0, 6), "proxy-")))) { return true; } - if (!boost::beast::iequals(name, "x-http-method") && - !boost::beast::iequals(name, "x-http-method-override") && - !boost::beast::iequals(name, "x-method-override")) { + if (!::webcpp::beast_backend::iequals(name, "x-http-method") && + !::webcpp::beast_backend::iequals(name, "x-http-method-override") && + !::webcpp::beast_backend::iequals(name, "x-method-override")) { return false; } return forbidden_method_override(value); @@ -351,9 +353,9 @@ inline bool forbidden_header(boost::beast::string_view name, boost::beast::strin /** Builds fetch headers after applying authority and forbidden-field policy. */ template emscripten::val fetch_headers(const tcp_stream& stream, - const boost::beast::http::request& request, + const ::webcpp::beast_backend::http::request& request, std::size_t& count, error_code& ec) { - namespace http = boost::beast::http; + namespace http = ::webcpp::beast_backend::http; auto const headers = emscripten::val::array(); for (const auto& field : request) { count += field.name_string().size() + field.value().size() + 4; @@ -389,23 +391,24 @@ emscripten::val fetch_headers(const tcp_stream& stream, Validates and buffers a complete request before initiating fetch. */ template -std::size_t start_fetch(tcp_stream& stream, boost::beast::http::request& request, +std::size_t start_fetch(tcp_stream& stream, + ::webcpp::beast_backend::http::request& request, error_code& ec) { - namespace http = boost::beast::http; + namespace http = ::webcpp::beast_backend::http; ec.clear(); if (!stream.is_open()) { - ec = boost::asio::error::not_connected; + ec = ::webcpp::asio_backend::error::not_connected; return 0; } auto const state = detail::browser::http(stream); if (state->active || state->ready || state->read) { - ec = boost::asio::error::already_started; + ec = ::webcpp::asio_backend::error::already_started; return 0; } const auto method = request.method(); if (method == http::verb::connect || method == http::verb::trace || request.method_string() == "TRACK") { - ec = boost::asio::error::operation_not_supported; + ec = ::webcpp::asio_backend::error::operation_not_supported; return 0; } auto init = emscripten::val::object(); @@ -424,10 +427,11 @@ std::size_t start_fetch(tcp_stream& stream, boost::beast::http::requestfirst); + const auto size = ::webcpp::asio_backend::buffer_size(next->first); const auto old = body.size(); body.resize(old + size); - boost::asio::buffer_copy(boost::asio::buffer(body.data() + old, size), next->first); + ::webcpp::asio_backend::buffer_copy(::webcpp::asio_backend::buffer(body.data() + old, size), + next->first); if (!next->second) { break; } @@ -436,7 +440,7 @@ std::size_t start_fetch(tcp_stream& stream, boost::beast::http::request -void map_response(http_state& state, boost::beast::http::response& response, - error_code& ec, std::size_t& count, bool header_only = false) { +void map_response(http_state& state, + ::webcpp::beast_backend::http::response& response, error_code& ec, + std::size_t& count, bool header_only = false) { if (ec) { return; } - namespace http = boost::beast::http; + namespace http = ::webcpp::beast_backend::http; response.clear(); response.version(11); response.result(state.response["status"].as()); @@ -492,9 +497,9 @@ void map_response(http_state& state, boost::beast::http::response& const auto pair = headers[i]; const auto name = js_text(pair[0], state.resource); const auto value = js_text(pair[1], state.resource); - if (boost::beast::iequals(name, "content-length") || - boost::beast::iequals(name, "content-encoding") || - boost::beast::iequals(name, "transfer-encoding")) { + if (::webcpp::beast_backend::iequals(name, "content-length") || + ::webcpp::beast_backend::iequals(name, "content-encoding") || + ::webcpp::beast_backend::iequals(name, "transfer-encoding")) { continue; } response.insert(name, value); @@ -522,7 +527,7 @@ void map_response(http_state& state, boost::beast::http::response& if (!ec && size) { std::pmr::vector bytes(size, state.resource); webcpp_beast_copy(body.as_handle(), bytes.data(), size); - count = reader.put(boost::asio::buffer(bytes), ec); + count = reader.put(::webcpp::asio_backend::buffer(bytes), ec); } if (!ec) { reader.finish(ec); @@ -539,11 +544,11 @@ void map_response(http_state& state, boost::beast::http::response& */ template void sync_http(tcp_stream& stream, Begin begin, error_code& ec, std::size_t& size) { - auto& context = static_cast( - boost::asio::query(stream.get_executor(), boost::asio::execution::context)); + auto& context = static_cast(::webcpp::asio_backend::query( + stream.get_executor(), ::webcpp::asio_backend::execution::context)); if (context.get_executor().running_in_this_thread() || - boost::asio::use_service(context).delivering()) { - ec = boost::asio::error::operation_not_supported; + ::webcpp::asio_backend::use_service(context).delivering()) { + ec = ::webcpp::asio_backend::error::operation_not_supported; return; } bool done = false; @@ -561,17 +566,19 @@ void sync_http(tcp_stream& stream, Begin begin, error_code& ec, std::size_t& siz /** Starts a metadata-only or complete response read with the handler associations. */ template -auto receive_response( - Stream& stream, - boost::beast::http::response>& response, - Token&& token) { - return boost::asio::async_initiate( +auto receive_response(Stream& stream, + ::webcpp::beast_backend::http::response< + Body, ::webcpp::beast_backend::http::basic_fields>& response, + Token&& token) { + return ::webcpp::asio_backend::async_initiate( [&stream, &response](auto handler) { auto const state = detail::browser::http(get_lowest_layer(stream)); if (state->read || (!state->active && !state->ready)) { detail::browser::post( stream.get_executor(), std::move(handler), - boost::system::error_code(boost::asio::error::already_started), std::size_t{}); + boost::system::error_code(::webcpp::asio_backend::error::already_started), + std::size_t{}); return; } state->header_only = HeaderOnly; @@ -584,7 +591,7 @@ auto receive_response( } detail::browser::map_response(*state, response, ec, count, HeaderOnly); }, - boost::asio::cancellation_type::all, + ::webcpp::asio_backend::cancellation_type::all, [state] { state->abort(); state->detach(); @@ -620,11 +627,12 @@ namespace webcpp::beast::http { @return The result determined by the completion token. */ template -auto async_write( - Stream& stream, - boost::beast::http::request>& request, - Token&& token) { - return boost::asio::async_initiate( +auto async_write(Stream& stream, + ::webcpp::beast_backend::http::request< + Body, ::webcpp::beast_backend::http::basic_fields>& request, + Token&& token) { + return ::webcpp::asio_backend::async_initiate( [&stream, &request](auto handler) { boost::system::error_code ec; const auto size = detail::browser::start_fetch(get_lowest_layer(stream), request, ec); @@ -644,10 +652,10 @@ auto async_write( @return The accepted body and synthetic header byte count. */ template -std::size_t write( - Stream& stream, - boost::beast::http::request>& request, - boost::system::error_code& ec) { +std::size_t write(Stream& stream, + ::webcpp::beast_backend::http::request< + Body, ::webcpp::beast_backend::http::basic_fields>& request, + boost::system::error_code& ec) { return detail::browser::start_fetch(get_lowest_layer(stream), request, ec); } @@ -661,9 +669,9 @@ std::size_t write( @return The accepted body and synthetic header byte count. */ template -std::size_t write( - Stream& stream, - boost::beast::http::request>& request) { +std::size_t write(Stream& stream, + ::webcpp::beast_backend::http::request< + Body, ::webcpp::beast_backend::http::basic_fields>& request) { boost::system::error_code ec; const auto n = write(stream, request, ec); detail::browser::throw_error(ec); @@ -689,10 +697,10 @@ std::size_t write( */ template -auto async_read( - Stream& stream, Buffer& /*unused*/, - boost::beast::http::response>& response, - Token&& token) { +auto async_read(Stream& stream, Buffer& /*unused*/, + ::webcpp::beast_backend::http::response< + Body, ::webcpp::beast_backend::http::basic_fields>& response, + Token&& token) { return detail::browser::receive_response(stream, response, std::forward(token)); } @@ -712,10 +720,10 @@ auto async_read( @return The number of decoded body bytes delivered. */ template -std::size_t read( - Stream& stream, Buffer& buffer, - boost::beast::http::response>& response, - boost::system::error_code& ec) { +std::size_t read(Stream& stream, Buffer& buffer, + ::webcpp::beast_backend::http::response< + Body, ::webcpp::beast_backend::http::basic_fields>& response, + boost::system::error_code& ec) { std::size_t size = 0; detail::browser::sync_http( get_lowest_layer(stream), @@ -738,9 +746,9 @@ std::size_t read( @return The number of decoded body bytes delivered. */ template -std::size_t read( - Stream& stream, Buffer& buffer, - boost::beast::http::response>& response) { +std::size_t read(Stream& stream, Buffer& buffer, + ::webcpp::beast_backend::http::response< + Body, ::webcpp::beast_backend::http::basic_fields>& response) { boost::system::error_code ec; const auto n = read(stream, buffer, response, ec); detail::browser::throw_error(ec); @@ -763,10 +771,10 @@ std::size_t read( */ template -auto async_read_header( - Stream& stream, Buffer& /*unused*/, - boost::beast::http::response>& response, - Token&& token) { +auto async_read_header(Stream& stream, Buffer& /*unused*/, + ::webcpp::beast_backend::http::response< + Body, ::webcpp::beast_backend::http::basic_fields>& response, + Token&& token) { return detail::browser::receive_response(stream, response, std::forward(token)); } @@ -785,10 +793,10 @@ auto async_read_header( @return The logical HTTP status-line and field byte count, excluding the body. */ template -std::size_t read_header( - Stream& stream, Buffer& buffer, - boost::beast::http::response>& response, - boost::system::error_code& ec) { +std::size_t read_header(Stream& stream, Buffer& buffer, + ::webcpp::beast_backend::http::response< + Body, ::webcpp::beast_backend::http::basic_fields>& response, + boost::system::error_code& ec) { std::size_t count = 0; detail::browser::sync_http( get_lowest_layer(stream), @@ -810,7 +818,8 @@ std::size_t read_header( template std::size_t read_header( Stream& stream, Buffer& buffer, - boost::beast::http::response>& response) { + ::webcpp::beast_backend::http::response< + Body, ::webcpp::beast_backend::http::basic_fields>& response) { boost::system::error_code ec; auto count = read_header(stream, buffer, response, ec); detail::browser::throw_error(ec); diff --git a/include/webcpp/beast/browser/http_byte_stream.hpp b/include/webcpp/beast/browser/http_byte_stream.hpp index 8e3a718..d525b04 100644 --- a/include/webcpp/beast/browser/http_byte_stream.hpp +++ b/include/webcpp/beast/browser/http_byte_stream.hpp @@ -10,10 +10,10 @@ #include #include -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: portable protocol data and explicit stream algorithms -#include // lint-world: portable protocol data and explicit stream algorithms -#include // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_ASIO_BACKEND_HEADER(compose.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_BEAST_BACKEND_HEADER(core/flat_buffer.hpp) // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(http/parser.hpp) // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(http/serializer.hpp) // lint-world: portable protocol data and explicit stream algorithms #include #include #include @@ -38,20 +38,21 @@ namespace browser { template class http_byte_stream { using allocator_type = std::pmr::polymorphic_allocator; - using body_type = - boost::beast::http::basic_string_body, allocator_type>; - using fields_type = boost::beast::http::basic_fields; + using body_type = ::webcpp::beast_backend::http::basic_string_body, + allocator_type>; + using fields_type = ::webcpp::beast_backend::http::basic_fields; NextLayer& next_; - std::optional> request_; - boost::beast::http::response response_; - boost::beast::basic_flat_buffer unused_; + std::optional<::webcpp::beast_backend::http::request_parser> + request_; + ::webcpp::beast_backend::http::response response_; + ::webcpp::beast_backend::basic_flat_buffer unused_; std::pmr::string wire_; std::size_t offset_ = 0; bool head_ = false; bool response_pending_ = false; void frame(boost::system::error_code& ec) { - namespace http = boost::beast::http; + namespace http = ::webcpp::beast_backend::http; wire_.clear(); offset_ = 0; const bool bodyless = @@ -69,7 +70,7 @@ class http_byte_stream { while (!serializer.is_header_done()) { std::size_t consumed = 0; serializer.next(ec, [&](auto&, const auto& buffers) { - for (const auto buffer : boost::beast::buffers_range_ref(buffers)) { + for (const auto buffer : ::webcpp::beast_backend::buffers_range_ref(buffers)) { wire_.append(static_cast(buffer.data()), buffer.size()); consumed += buffer.size(); } @@ -98,8 +99,9 @@ class http_byte_stream { template std::size_t copy(const Buffers& buffers) { - auto const count = boost::asio::buffer_copy( - buffers, boost::asio::buffer(wire_.data() + offset_, wire_.size() - offset_)); + auto const count = ::webcpp::asio_backend::buffer_copy( + buffers, + ::webcpp::asio_backend::buffer(wire_.data() + offset_, wire_.size() - offset_)); offset_ += count; return count; } @@ -147,10 +149,10 @@ class http_byte_stream { */ template std::size_t write_some(const Buffers& buffers, boost::system::error_code& ec) { - namespace http = boost::beast::http; + namespace http = ::webcpp::beast_backend::http; ec.clear(); if (response_pending_ || offset_ < wire_.size()) { - ec = boost::asio::error::already_started; + ec = ::webcpp::asio_backend::error::already_started; return 0; } if (!request_) { @@ -205,7 +207,8 @@ class http_byte_stream { */ template auto async_write_some(const Buffers& buffers, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this, buffers](auto handler) { boost::system::error_code ec; const auto n = write_some(buffers, ec); @@ -226,7 +229,7 @@ class http_byte_stream { ec.clear(); if (offset_ == wire_.size()) { if (!response_pending_) { - ec = boost::asio::error::eof; + ec = ::webcpp::asio_backend::error::eof; return 0; } webcpp::beast::http::read(next_, unused_, response_, ec); @@ -268,7 +271,8 @@ class http_byte_stream { */ template auto async_read_some(const Buffers& buffers, Token&& token) { - return boost::asio::async_compose( + return ::webcpp::asio_backend::async_compose( [this, buffers, started = false, posted = false]( auto& self, boost::system::error_code ec = {}, std::size_t = 0) mutable { if (!posted) { @@ -293,7 +297,7 @@ class http_byte_stream { return; } if (!response_pending_) { - self.complete(boost::asio::error::eof, 0); + self.complete(::webcpp::asio_backend::error::eof, 0); return; } started = true; diff --git a/include/webcpp/beast/browser/ssl_stream.hpp b/include/webcpp/beast/browser/ssl_stream.hpp index 3e7aa11..ddfa79e 100644 --- a/include/webcpp/beast/browser/ssl_stream.hpp +++ b/include/webcpp/beast/browser/ssl_stream.hpp @@ -234,7 +234,7 @@ class ssl_stream { */ template auto async_handshake(webcpp::asio::ssl::stream_base::handshake_type type, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this, type](auto handler) { boost::system::error_code ec; handshake(type, ec); @@ -268,7 +268,7 @@ class ssl_stream { */ template auto async_shutdown(Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this](auto handler) { boost::system::error_code ec; shutdown(ec); @@ -284,7 +284,7 @@ class ssl_stream { */ boost::system::result set_server_name(std::string_view host) { if (host.empty() || host.size() > 255 || host.find('\0') != std::string_view::npos) { - return boost::asio::error::invalid_argument; + return ::webcpp::asio_backend::error::invalid_argument; } server_name_ = host; return {}; diff --git a/include/webcpp/beast/browser/tcp_stream.hpp b/include/webcpp/beast/browser/tcp_stream.hpp index dfd829e..e35b7dc 100644 --- a/include/webcpp/beast/browser/tcp_stream.hpp +++ b/include/webcpp/beast/browser/tcp_stream.hpp @@ -11,7 +11,7 @@ #include // lint-world: allocation-free numeric address formatting, without I/O #include -#include // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(core/stream_traits.hpp) // lint-world: portable protocol data and explicit stream algorithms #include #include #include @@ -21,7 +21,7 @@ // NOLINTNEXTLINE(modernize-concat-nested-namespaces): policy selects an inline namespace namespace webcpp::beast { /** Finds the innermost layer of a composed stream. */ -using boost::beast::get_lowest_layer; +using ::webcpp::beast_backend::get_lowest_layer; #ifdef WEBCPP_BEAST_UNSUPPORTED_IGNORE inline namespace unsupported_ignore { #else @@ -35,7 +35,7 @@ class tcp_stream { /** Executor used to schedule stream operations and their completions. */ - using executor_type = boost::asio::any_io_executor; + using executor_type = ::webcpp::asio_backend::any_io_executor; /** Address and service value recorded by connect. */ @@ -251,7 +251,7 @@ class tcp_stream { Closes the browser operation and its authority record. @param ec Receives the operation error, or is cleared on success. */ - void shutdown(boost::asio::socket_base::shutdown_type /*unused*/, + void shutdown(::webcpp::asio_backend::socket_base::shutdown_type /*unused*/, boost::system::error_code& ec) { close(ec); } @@ -260,7 +260,7 @@ class tcp_stream { Closes the browser operation and its authority record. @param what Shutdown direction; browser host operations close as a whole. */ - void shutdown(boost::asio::socket_base::shutdown_type what) { + void shutdown(::webcpp::asio_backend::socket_base::shutdown_type what) { boost::system::error_code ec; shutdown(what, ec); } @@ -274,7 +274,7 @@ class tcp_stream { endpoint_type connect(const webcpp::asio::ip::tcp::resolver::results_type& results, boost::system::error_code& ec) { if (results.empty()) { - ec = boost::asio::error::host_not_found; + ec = ::webcpp::asio_backend::error::host_not_found; return {}; } reset_operation(); @@ -322,7 +322,7 @@ class tcp_stream { if (address.is_v6()) { const auto bytes = address.to_v6().to_bytes(); if (inet_ntop(AF_INET6, bytes.data(), text.data(), text.size()) == nullptr) { - ec = boost::asio::error::invalid_argument; + ec = ::webcpp::asio_backend::error::invalid_argument; return {}; } host_.assign(1, '['); @@ -336,7 +336,7 @@ class tcp_stream { } else { const auto bytes = address.to_v4().to_bytes(); if (inet_ntop(AF_INET, bytes.data(), text.data(), text.size()) == nullptr) { - ec = boost::asio::error::invalid_argument; + ec = ::webcpp::asio_backend::error::invalid_argument; return {}; } host_.assign(text.data()); @@ -370,7 +370,8 @@ class tcp_stream { template auto async_connect(const webcpp::asio::ip::tcp::resolver::results_type& results, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this, results](auto handler) { boost::system::error_code ec; auto endpoint = connect(results, ec); @@ -391,7 +392,7 @@ class tcp_stream { */ template auto async_connect(const endpoint_type& endpoint, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this, endpoint](auto handler) { boost::system::error_code ec; connect(endpoint, ec); diff --git a/include/webcpp/beast/browser/websocket.hpp b/include/webcpp/beast/browser/websocket.hpp index 426299e..9ed9efa 100644 --- a/include/webcpp/beast/browser/websocket.hpp +++ b/include/webcpp/beast/browser/websocket.hpp @@ -9,14 +9,14 @@ #include -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: browser operation scheduling and handler associations -#include // lint-world: portable protocol data and explicit stream algorithms -#include // lint-world: portable protocol data and explicit stream algorithms -#include // lint-world: portable protocol data and explicit stream algorithms -#include // lint-world: portable protocol data and explicit stream algorithms -#include // lint-world: portable protocol data and explicit stream algorithms -#include // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_ASIO_BACKEND_HEADER(buffer.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_ASIO_BACKEND_HEADER(steady_timer.hpp) // lint-world: browser operation scheduling and handler associations +#include WEBCPP_BEAST_BACKEND_HEADER(core/error.hpp) // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(core/role.hpp) // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(websocket/error.hpp) // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(websocket/option.hpp) // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(websocket/rfc6455.hpp) // lint-world: portable protocol data and explicit stream algorithms +#include WEBCPP_BEAST_BACKEND_HEADER(websocket/stream_base.hpp) // lint-world: portable protocol data and explicit stream algorithms #include #include #include @@ -29,7 +29,7 @@ // NOLINTNEXTLINE(modernize-concat-nested-namespaces): policy selects an inline namespace namespace webcpp::beast { /** Client or server role used by protocol options. */ -using boost::beast::role_type; +using ::webcpp::beast_backend::role_type; #ifdef WEBCPP_BEAST_UNSUPPORTED_IGNORE inline namespace unsupported_ignore { #else @@ -37,23 +37,23 @@ inline namespace unsupported_error { #endif namespace websocket { /** WebSocket close status codes. */ -using boost::beast::websocket::close_code; +using ::webcpp::beast_backend::websocket::close_code; /** WebSocket close status and UTF-8 explanation. */ -using boost::beast::websocket::close_reason; +using ::webcpp::beast_backend::websocket::close_reason; /** Errors produced by WebSocket protocol operations. */ -using boost::beast::websocket::error; +using ::webcpp::beast_backend::websocket::error; /** Tests whether a request asks to upgrade to WebSocket. */ -using boost::beast::websocket::is_upgrade; +using ::webcpp::beast_backend::websocket::is_upgrade; /** Compatibility record for browser-owned compression negotiation. */ -using boost::beast::websocket::permessage_deflate; +using ::webcpp::beast_backend::websocket::permessage_deflate; /** Payload type for a WebSocket control frame. */ -using boost::beast::websocket::ping_data; +using ::webcpp::beast_backend::websocket::ping_data; /** HTTP request shape supplied to a WebSocket decorator. */ -using request_type = boost::beast::http::request< - boost::beast::http::empty_body, - boost::beast::http::basic_fields>>; +using request_type = ::webcpp::beast_backend::http::request< + ::webcpp::beast_backend::http::empty_body, + ::webcpp::beast_backend::http::basic_fields>>; /** HTTP response shape used by the guest WebSocket engine. */ -using boost::beast::websocket::response_type; +using ::webcpp::beast_backend::websocket::response_type; /** Kind of WebSocket control event. */ @@ -73,7 +73,7 @@ struct stream_base { /** Handshake and idle timeout options shared with Beast. */ - using timeout = boost::beast::websocket::stream_base::timeout; + using timeout = ::webcpp::beast_backend::websocket::stream_base::timeout; /** Stores a callable that records the browser-compatible handshake subprotocols. @@ -132,7 +132,8 @@ struct callback_base { /** Invokes a control callback when this object stores one. */ - virtual void control(websocket::frame_type /*unused*/, boost::beast::string_view /*unused*/){}; + virtual void control(websocket::frame_type /*unused*/, + ::webcpp::beast_backend::string_view /*unused*/){}; /** Releases registration and retained state during destruction. */ @@ -166,7 +167,7 @@ struct callback final : callback_base { /** Invokes a control callback when this object stores one. */ - void control(websocket::frame_type kind, boost::beast::string_view value) override { + void control(websocket::frame_type kind, ::webcpp::beast_backend::string_view value) override { if constexpr (!Decorator) { function(kind, value); } @@ -222,7 +223,7 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati /** Timer enforcing the current operation deadline. */ - boost::asio::steady_timer timer; // lint-world: browser operation deadline + ::webcpp::asio_backend::steady_timer timer; // lint-world: browser operation deadline /** Registration key used to reject events from detached operations. */ @@ -263,7 +264,7 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati Handshake and receive-idle timeout settings. */ websocket::stream_base::timeout timeout = - websocket::stream_base::timeout::suggested(boost::beast::role_type::client); + websocket::stream_base::timeout::suggested(::webcpp::beast_backend::role_type::client); /** Send and receive queue bounds enforced by this state. */ @@ -323,8 +324,8 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati websocket_state(executor_type ex, std::shared_ptr storage) : resource(std::move(storage)), executor(std::move(ex)), - bridge(&boost::asio::use_service( - boost::asio::query(executor, boost::asio::execution::context))), + bridge(&::webcpp::asio_backend::use_service( + ::webcpp::asio_backend::query(executor, ::webcpp::asio_backend::execution::context))), timer(executor), messages(resource.get()), ingress(resource.get()), @@ -389,12 +390,12 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati ingress_posted = true; const auto epoch = generation; auto const self = shared_from_this(); - post(executor, - boost::asio::bind_allocator(owning_allocator(resource), [self, epoch] { - if (self->alive && self->generation == epoch) { - self->drain_ingress(); - } - })); + post(executor, ::webcpp::asio_backend::bind_allocator( + owning_allocator(resource), [self, epoch] { + if (self->alive && self->generation == epoch) { + self->drain_ingress(); + } + })); } return false; } @@ -479,16 +480,16 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati */ void stop() noexcept { alive = false; - invalidate(boost::asio::error::operation_aborted); - finish(boost::asio::error::operation_aborted); + invalidate(::webcpp::asio_backend::error::operation_aborted); + finish(::webcpp::asio_backend::error::operation_aborted); } /** Aborts the WebSocket and completes pending operations as cancelled. */ void cancel_all() { - invalidate(boost::asio::error::operation_aborted); - finish(boost::asio::error::operation_aborted); + invalidate(::webcpp::asio_backend::error::operation_aborted); + finish(::webcpp::asio_backend::error::operation_aborted); } /** @@ -502,11 +503,11 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati timer.expires_at(deadline); auto const weak = weak_from_this(); const auto epoch = generation; - timer.async_wait(boost::asio::bind_allocator( + timer.async_wait(::webcpp::asio_backend::bind_allocator( owning_allocator(resource), [weak, epoch](error_code ec) { if (auto const self = weak.lock(); self && !ec && self->alive && self->generation == epoch) { - self->invalidate(boost::beast::error::timeout); + self->invalidate(::webcpp::beast_backend::error::timeout); self->finish(self->failure); } })); @@ -516,7 +517,7 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati Restarts the receive-idle timer after browser activity. */ void arm_idle() { - if (timeout.idle_timeout != boost::beast::websocket::stream_base::none()) { + if (timeout.idle_timeout != ::webcpp::beast_backend::websocket::stream_base::none()) { arm(::webcpp::beast::detail::browser::clock_type::now() + timeout.idle_timeout); } else { cancel_timer(); @@ -593,7 +594,7 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati cancel_timer(); reason.code = static_cast(event["code"].as()); const auto text = js_text(event["reason"], resource.get()); - reason.reason = boost::beast::string_view(text.data(), text.size()); + reason.reason = ::webcpp::beast_backend::string_view(text.data(), text.size()); if (control) { control->control(websocket::frame_type::close, reason.reason); if (generation != epoch) { @@ -604,7 +605,7 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati if (!was_open && handshake != nullptr) { failure = make_error_code(browser_errc::connection_failed); } else if (reason.code == 1006) { - failure = boost::asio::error::connection_reset; + failure = ::webcpp::asio_backend::error::connection_reset; } else { failure = websocket::error::closed; } @@ -627,8 +628,8 @@ class websocket_state final : public webcpp::asio::browser::intrusive_registrati std::size_t copy(const Buffers& buffers, std::size_t maximum_count) { auto& message = messages.front(); auto size = std::min(maximum_count, message.bytes.size() - message.offset); - size = boost::asio::buffer_copy( - buffers, boost::asio::buffer(message.bytes.data() + message.offset, size)); + size = ::webcpp::asio_backend::buffer_copy( + buffers, ::webcpp::asio_backend::buffer(message.bytes.data() + message.offset, size)); received_text = message.text; message.offset += size; message_done = message.offset == message.bytes.size(); @@ -685,8 +686,8 @@ class stream { void arm(bool handshake = false) { auto deadline = get_lowest_layer(next_).expiry(); - if (handshake && - state_->timeout.handshake_timeout != boost::beast::websocket::stream_base::none()) { + if (handshake && state_->timeout.handshake_timeout != + ::webcpp::beast_backend::websocket::stream_base::none()) { deadline = std::min(deadline, ::webcpp::beast::detail::browser::clock_type::now() + state_->timeout.handshake_timeout); } @@ -697,10 +698,10 @@ class stream { template void sync(Begin begin, ec_type& ec) { - auto& context = static_cast( - boost::asio::query(get_executor(), boost::asio::execution::context)); + auto& context = static_cast(::webcpp::asio_backend::query( + get_executor(), ::webcpp::asio_backend::execution::context)); if (context.get_executor().running_in_this_thread() || state_->bridge->delivering()) { - ec = boost::asio::error::operation_not_supported; + ec = ::webcpp::asio_backend::error::operation_not_supported; return; } bool done = false; @@ -741,7 +742,7 @@ class stream { } auto const protocols = emscripten::val::array(); for (const auto& field : request) { - if (field.name() != boost::beast::http::field::sec_websocket_protocol) { + if (field.name() != ::webcpp::beast_backend::http::field::sec_websocket_protocol) { if (auto const error = detail::browser::unsupported()) { ec = error; } @@ -996,9 +997,9 @@ class stream { @return The result determined by the completion token. */ template - auto async_handshake(boost::beast::string_view host, boost::beast::string_view target, - Token&& token) { - return boost::asio::async_initiate( + auto async_handshake(::webcpp::beast_backend::string_view host, + ::webcpp::beast_backend::string_view target, Token&& token) { + return ::webcpp::asio_backend::async_initiate( [this, host = std::pmr::string(host, state_->resource.get()), target = std::pmr::string(target, state_->resource.get())](auto handler) { auto& state = *state_; @@ -1009,7 +1010,7 @@ class stream { ec = make_error_code(browser_errc::no_host); } if (state.handshake || state.opened || state.read || state.close) { - ec = boost::asio::error::already_started; + ec = ::webcpp::asio_backend::error::already_started; } const emscripten::val protocols = this->protocols(ec); if (ec) { @@ -1021,9 +1022,11 @@ class stream { detail::browser::start( state.handshake, get_executor(), std::move(handler), [](ec_type&, std::size_t&) {}, - boost::asio::cancellation_type::terminal | - boost::asio::cancellation_type::partial, - [state = state_] { state->invalidate(boost::asio::error::operation_aborted); }); + ::webcpp::asio_backend::cancellation_type::terminal | + ::webcpp::asio_backend::cancellation_type::partial, + [state = state_] { + state->invalidate(::webcpp::asio_backend::error::operation_aborted); + }); state.key = state.bridge->add(state); auto const url = detail::browser::js_string(record.url(target, true)); const emscripten::val result = emscripten::val::take_ownership( @@ -1076,11 +1079,11 @@ class stream { */ template auto async_read_some(DynamicBuffer& buffer, std::size_t maximum, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this, &buffer, maximum](auto handler) { if (state_->read) { detail::browser::post(get_executor(), std::move(handler), - ec_type(boost::asio::error::already_started), + ec_type(::webcpp::asio_backend::error::already_started), std::size_t{}); return; } @@ -1093,20 +1096,20 @@ class stream { auto const& message = state->messages.front(); const auto size = std::min(maximum, message.bytes.size() - message.offset); if (size > buffer.max_size() - buffer.size()) { - ec = boost::asio::error::no_buffer_space; + ec = ::webcpp::asio_backend::error::no_buffer_space; return; } count = state->copy(buffer.prepare(size), size); buffer.commit(count); }, - boost::asio::cancellation_type::all, + ::webcpp::asio_backend::cancellation_type::all, [state = state_] { state->cancel_read(); }); if (!state_->messages.empty()) { state_->read->complete(); } else if (state_->failure) { state_->read->complete(state_->failure); } else if (!state_->opened) { - state_->read->complete(boost::asio::error::not_connected); + state_->read->complete(::webcpp::asio_backend::error::not_connected); } else { arm(); } @@ -1129,11 +1132,11 @@ class stream { */ template auto async_read_some(const Buffers& buffers, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this, buffers](auto handler) { if (state_->read) { detail::browser::post(get_executor(), std::move(handler), - ec_type(boost::asio::error::already_started), + ec_type(::webcpp::asio_backend::error::already_started), std::size_t{}); return; } @@ -1141,17 +1144,18 @@ class stream { state_->read, get_executor(), std::move(handler), [state = state_, buffers](ec_type& ec, std::size_t& count) { if (!ec) { - count = state->copy(buffers, boost::asio::buffer_size(buffers)); + count = + state->copy(buffers, ::webcpp::asio_backend::buffer_size(buffers)); } }, - boost::asio::cancellation_type::all, + ::webcpp::asio_backend::cancellation_type::all, [state = state_] { state->cancel_read(); }); if (!state_->messages.empty()) { state_->read->complete(); } else if (state_->failure) { state_->read->complete(state_->failure); } else if (!state_->opened) { - state_->read->complete(boost::asio::error::not_connected); + state_->read->complete(::webcpp::asio_backend::error::not_connected); } else { arm(); } @@ -1172,11 +1176,11 @@ class stream { */ template std::size_t write_some(bool fin, const Buffers& buffers, ec_type& ec) { - const auto count = boost::asio::buffer_size(buffers); + const auto count = ::webcpp::asio_backend::buffer_size(buffers); auto& state = *state_; ec.clear(); if (!state.opened) { - ec = boost::asio::error::not_connected; + ec = ::webcpp::asio_backend::error::not_connected; return 0; } const auto queued = static_cast(state.socket["bufferedAmount"].as()); @@ -1189,11 +1193,12 @@ class stream { } const auto old = state.fragments.size(); state.fragments.resize(old + count); - boost::asio::buffer_copy(boost::asio::buffer(state.fragments.data() + old, count), buffers); + ::webcpp::asio_backend::buffer_copy( + ::webcpp::asio_backend::buffer(state.fragments.data() + old, count), buffers); if (fin) { if (webcpp_beast_send(state.socket.as_handle(), state.fragments.data(), state.fragments.size(), state.send_text)) { - ec = boost::asio::error::connection_reset; + ec = ::webcpp::asio_backend::error::connection_reset; } state.fragments.clear(); } @@ -1248,7 +1253,7 @@ class stream { */ template auto async_write_some(bool fin, const Buffers& buffers, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this, fin, buffers](auto handler) { ec_type ec; auto count = write_some(fin, buffers, ec); @@ -1287,15 +1292,15 @@ class stream { */ template auto async_close(close_reason reason, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this, reason](auto handler) mutable { auto ec = detail::browser::unsupported(reason.code != 1000 && (reason.code < 3000 || reason.code > 4999)); if (state_->close) { - ec = boost::asio::error::already_started; + ec = ::webcpp::asio_backend::error::already_started; } if (!state_->opened) { - ec = boost::asio::error::not_connected; + ec = ::webcpp::asio_backend::error::not_connected; } if (ec) { detail::browser::post(get_executor(), std::move(handler), ec); @@ -1307,8 +1312,8 @@ class stream { detail::browser::start( state_->close, get_executor(), std::move(handler), [](ec_type&, std::size_t&) {}, - boost::asio::cancellation_type::terminal | - boost::asio::cancellation_type::partial, + ::webcpp::asio_backend::cancellation_type::terminal | + ::webcpp::asio_backend::cancellation_type::partial, [] {}); webcpp_beast_close(state_->socket.as_handle(), reason.code, detail::browser::js_string(reason.reason).as_handle()); @@ -1328,7 +1333,7 @@ class stream { */ template auto async_ping(const ping_data& /*unused*/, Token&& token) { - return boost::asio::async_initiate( + return ::webcpp::asio_backend::async_initiate( [this](auto handler) { detail::browser::post(get_executor(), std::move(handler), detail::browser::unsupported()); @@ -1360,7 +1365,8 @@ class stream { @param target Origin-form path and query for the browser URL. @param ec Receives the operation error, or is cleared on success. */ - void handshake(boost::beast::string_view host, boost::beast::string_view target, ec_type& ec) { + void handshake(::webcpp::beast_backend::string_view host, + ::webcpp::beast_backend::string_view target, ec_type& ec) { sync([&](auto handler) { async_handshake(host, target, std::move(handler)); }, ec); } @@ -1372,7 +1378,8 @@ class stream { @param host Hostname to match against the recorded destination authority. @param target Origin-form path and query for the browser URL. */ - void handshake(boost::beast::string_view host, boost::beast::string_view target) { + void handshake(::webcpp::beast_backend::string_view host, + ::webcpp::beast_backend::string_view target) { ec_type ec; handshake(host, target, ec); detail::browser::throw_error(ec); diff --git a/include/webcpp/beast/config.hpp b/include/webcpp/beast/config.hpp index 96c11b0..408a4d3 100644 --- a/include/webcpp/beast/config.hpp +++ b/include/webcpp/beast/config.hpp @@ -7,8 +7,18 @@ #ifndef WEBCPP_BEAST_CONFIG_HPP #define WEBCPP_BEAST_CONFIG_HPP +#include #include +#if defined(WEBCPP_BEAST_HAS_SOCKET_BACKEND) || defined(WEBCPP_BEAST_HAS_OPENSSL_BACKEND) +#error "webcpp::beast: backend capabilities are derived by config.hpp, not user switches" +#else +/** 1 when the selected Asio backend supplies native or WASI guest sockets. */ +#define WEBCPP_BEAST_HAS_SOCKET_BACKEND WEBCPP_ASIO_HAS_SOCKET_BACKEND +/** 1 when guest OpenSSL can be linked on the selected target; does not link it. */ +#define WEBCPP_BEAST_HAS_OPENSSL_BACKEND WEBCPP_ASIO_HAS_OPENSSL_BACKEND +#endif + #ifdef __MRDOCS__ /** Records the facade's exception policy for host-adapter implementations. diff --git a/include/webcpp/beast/core.hpp b/include/webcpp/beast/core.hpp index b39722d..125c7f8 100644 --- a/include/webcpp/beast/core.hpp +++ b/include/webcpp/beast/core.hpp @@ -11,56 +11,56 @@ #include -#include // lint-world: binds handler arguments only -#include // lint-world: buffer-sequence views only -#include // lint-world: copies memory buffers only -#include // lint-world: error codes only -#include // lint-world: file access mode enumeration -#include // lint-world: memory buffers only -#include // lint-world: fixed-capacity memory buffers -#include // lint-world: buffer output formatting only -#include // lint-world: memory buffers only -#include // lint-world: writes into memory buffers -#include // lint-world: memory buffers only -#include // lint-world: string comparison only +#include WEBCPP_BEAST_BACKEND_HEADER(core/bind_handler.hpp) // lint-world: binds handler arguments only +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_prefix.hpp) // lint-world: buffer-sequence views only +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_to_string.hpp) // lint-world: copies memory buffers only +#include WEBCPP_BEAST_BACKEND_HEADER(core/error.hpp) // lint-world: error codes only +#include WEBCPP_BEAST_BACKEND_HEADER(core/file_base.hpp) // lint-world: file access mode enumeration +#include WEBCPP_BEAST_BACKEND_HEADER(core/flat_buffer.hpp) // lint-world: memory buffers only +#include WEBCPP_BEAST_BACKEND_HEADER(core/flat_static_buffer.hpp) // lint-world: fixed-capacity memory buffers +#include WEBCPP_BEAST_BACKEND_HEADER(core/make_printable.hpp) // lint-world: buffer output formatting only +#include WEBCPP_BEAST_BACKEND_HEADER(core/multi_buffer.hpp) // lint-world: memory buffers only +#include WEBCPP_BEAST_BACKEND_HEADER(core/ostream.hpp) // lint-world: writes into memory buffers +#include WEBCPP_BEAST_BACKEND_HEADER(core/static_buffer.hpp) // lint-world: memory buffers only +#include WEBCPP_BEAST_BACKEND_HEADER(core/string.hpp) // lint-world: string comparison only namespace webcpp::beast { /** Upstream contiguous dynamic buffer with an application-supplied allocator. */ -using boost::beast::basic_flat_buffer; +using ::webcpp::beast_backend::basic_flat_buffer; /** Upstream segmented dynamic buffer with an application-supplied allocator. */ -using boost::beast::basic_multi_buffer; +using ::webcpp::beast_backend::basic_multi_buffer; /** Binds leading arguments to a completion handler. */ -using boost::beast::bind_front_handler; +using ::webcpp::beast_backend::bind_front_handler; /** Returns a view of the first bytes of a buffer sequence. */ -using boost::beast::buffers_prefix; +using ::webcpp::beast_backend::buffers_prefix; /** Copies a buffer sequence to a string. */ -using boost::beast::buffers_to_string; +using ::webcpp::beast_backend::buffers_to_string; /** Upstream common stream errors, including timeout. */ -using boost::beast::error; +using ::webcpp::beast_backend::error; /** The error-code type used by Beast operations. */ -using boost::beast::error_code; +using ::webcpp::beast_backend::error_code; /** Upstream generic error conditions. */ -namespace errc = boost::beast::errc; +namespace errc = ::webcpp::beast_backend::errc; /** Upstream file-opening modes for explicit file bodies. */ -using boost::beast::file_mode; +using ::webcpp::beast_backend::file_mode; /** Upstream contiguous dynamic buffer. */ -using boost::beast::flat_buffer; +using ::webcpp::beast_backend::flat_buffer; /** Upstream contiguous buffer with fixed capacity. */ -using boost::beast::flat_static_buffer; +using ::webcpp::beast_backend::flat_static_buffer; /** Compares strings with HTTP's ASCII case-insensitive rules. */ -using boost::beast::iequals; +using ::webcpp::beast_backend::iequals; /** Formats a buffer sequence for diagnostic output. */ -using boost::beast::make_printable; +using ::webcpp::beast_backend::make_printable; /** Upstream segmented dynamic buffer. */ -using boost::beast::multi_buffer; +using ::webcpp::beast_backend::multi_buffer; /** Creates an output stream that appends to a dynamic buffer. */ -using boost::beast::ostream; +using ::webcpp::beast_backend::ostream; /** Upstream fixed-capacity buffer. */ -using boost::beast::static_buffer; +using ::webcpp::beast_backend::static_buffer; /** Upstream non-owning string view. */ -using boost::beast::string_view; +using ::webcpp::beast_backend::string_view; /** Upstream exception type for explicitly throwing application code. */ -using boost::beast::system_error; +using ::webcpp::beast_backend::system_error; } // namespace webcpp::beast #endif diff --git a/include/webcpp/beast/core/async_base.hpp b/include/webcpp/beast/core/async_base.hpp new file mode 100644 index 0000000..a866d3b --- /dev/null +++ b/include/webcpp/beast/core/async_base.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_ASYNC_BASE_HPP +#define WEBCPP_BEAST_FORWARD_CORE_ASYNC_BASE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/async_base.hpp) +#endif diff --git a/include/webcpp/beast/core/basic_stream.hpp b/include/webcpp/beast/core/basic_stream.hpp new file mode 100644 index 0000000..c146de9 --- /dev/null +++ b/include/webcpp/beast/core/basic_stream.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BASIC_STREAM_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BASIC_STREAM_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/basic_stream.hpp) +#endif diff --git a/include/webcpp/beast/core/bind_handler.hpp b/include/webcpp/beast/core/bind_handler.hpp new file mode 100644 index 0000000..145eb44 --- /dev/null +++ b/include/webcpp/beast/core/bind_handler.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BIND_HANDLER_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BIND_HANDLER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/bind_handler.hpp) +#endif diff --git a/include/webcpp/beast/core/buffer_ref.hpp b/include/webcpp/beast/core/buffer_ref.hpp new file mode 100644 index 0000000..faa715f --- /dev/null +++ b/include/webcpp/beast/core/buffer_ref.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFER_REF_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFER_REF_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffer_ref.hpp) +#endif diff --git a/include/webcpp/beast/core/buffer_traits.hpp b/include/webcpp/beast/core/buffer_traits.hpp new file mode 100644 index 0000000..ffd28e7 --- /dev/null +++ b/include/webcpp/beast/core/buffer_traits.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFER_TRAITS_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFER_TRAITS_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffer_traits.hpp) +#endif diff --git a/include/webcpp/beast/core/buffered_read_stream.hpp b/include/webcpp/beast/core/buffered_read_stream.hpp new file mode 100644 index 0000000..bd147c3 --- /dev/null +++ b/include/webcpp/beast/core/buffered_read_stream.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFERED_READ_STREAM_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFERED_READ_STREAM_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffered_read_stream.hpp) +#endif diff --git a/include/webcpp/beast/core/buffers_adaptor.hpp b/include/webcpp/beast/core/buffers_adaptor.hpp new file mode 100644 index 0000000..7f7a804 --- /dev/null +++ b/include/webcpp/beast/core/buffers_adaptor.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFERS_ADAPTOR_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFERS_ADAPTOR_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_adaptor.hpp) +#endif diff --git a/include/webcpp/beast/core/buffers_cat.hpp b/include/webcpp/beast/core/buffers_cat.hpp new file mode 100644 index 0000000..74a0975 --- /dev/null +++ b/include/webcpp/beast/core/buffers_cat.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFERS_CAT_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFERS_CAT_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_cat.hpp) +#endif diff --git a/include/webcpp/beast/core/buffers_generator.hpp b/include/webcpp/beast/core/buffers_generator.hpp new file mode 100644 index 0000000..70174bc --- /dev/null +++ b/include/webcpp/beast/core/buffers_generator.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFERS_GENERATOR_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFERS_GENERATOR_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_generator.hpp) +#endif diff --git a/include/webcpp/beast/core/buffers_prefix.hpp b/include/webcpp/beast/core/buffers_prefix.hpp new file mode 100644 index 0000000..a79faa8 --- /dev/null +++ b/include/webcpp/beast/core/buffers_prefix.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFERS_PREFIX_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFERS_PREFIX_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_prefix.hpp) +#endif diff --git a/include/webcpp/beast/core/buffers_range.hpp b/include/webcpp/beast/core/buffers_range.hpp new file mode 100644 index 0000000..439e0a5 --- /dev/null +++ b/include/webcpp/beast/core/buffers_range.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFERS_RANGE_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFERS_RANGE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_range.hpp) +#endif diff --git a/include/webcpp/beast/core/buffers_suffix.hpp b/include/webcpp/beast/core/buffers_suffix.hpp new file mode 100644 index 0000000..e3b807a --- /dev/null +++ b/include/webcpp/beast/core/buffers_suffix.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFERS_SUFFIX_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFERS_SUFFIX_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_suffix.hpp) +#endif diff --git a/include/webcpp/beast/core/buffers_to_string.hpp b/include/webcpp/beast/core/buffers_to_string.hpp new file mode 100644 index 0000000..b476e79 --- /dev/null +++ b/include/webcpp/beast/core/buffers_to_string.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_BUFFERS_TO_STRING_HPP +#define WEBCPP_BEAST_FORWARD_CORE_BUFFERS_TO_STRING_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/buffers_to_string.hpp) +#endif diff --git a/include/webcpp/beast/core/detect_ssl.hpp b/include/webcpp/beast/core/detect_ssl.hpp new file mode 100644 index 0000000..f80923d --- /dev/null +++ b/include/webcpp/beast/core/detect_ssl.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_DETECT_SSL_HPP +#define WEBCPP_BEAST_FORWARD_CORE_DETECT_SSL_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/detect_ssl.hpp) +#endif diff --git a/include/webcpp/beast/core/error.hpp b/include/webcpp/beast/core/error.hpp new file mode 100644 index 0000000..ab3844a --- /dev/null +++ b/include/webcpp/beast/core/error.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_ERROR_HPP +#define WEBCPP_BEAST_FORWARD_CORE_ERROR_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/error.hpp) +#endif diff --git a/include/webcpp/beast/core/file.hpp b/include/webcpp/beast/core/file.hpp new file mode 100644 index 0000000..ec21cbe --- /dev/null +++ b/include/webcpp/beast/core/file.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_FILE_HPP +#define WEBCPP_BEAST_FORWARD_CORE_FILE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/file.hpp) +#endif diff --git a/include/webcpp/beast/core/file_base.hpp b/include/webcpp/beast/core/file_base.hpp new file mode 100644 index 0000000..15d14ab --- /dev/null +++ b/include/webcpp/beast/core/file_base.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_FILE_BASE_HPP +#define WEBCPP_BEAST_FORWARD_CORE_FILE_BASE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/file_base.hpp) +#endif diff --git a/include/webcpp/beast/core/file_posix.hpp b/include/webcpp/beast/core/file_posix.hpp new file mode 100644 index 0000000..102f95b --- /dev/null +++ b/include/webcpp/beast/core/file_posix.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_FILE_POSIX_HPP +#define WEBCPP_BEAST_FORWARD_CORE_FILE_POSIX_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/file_posix.hpp) +#endif diff --git a/include/webcpp/beast/core/file_stdio.hpp b/include/webcpp/beast/core/file_stdio.hpp new file mode 100644 index 0000000..39dc359 --- /dev/null +++ b/include/webcpp/beast/core/file_stdio.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_FILE_STDIO_HPP +#define WEBCPP_BEAST_FORWARD_CORE_FILE_STDIO_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/file_stdio.hpp) +#endif diff --git a/include/webcpp/beast/core/file_win32.hpp b/include/webcpp/beast/core/file_win32.hpp new file mode 100644 index 0000000..fb10f8a --- /dev/null +++ b/include/webcpp/beast/core/file_win32.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_FILE_WIN32_HPP +#define WEBCPP_BEAST_FORWARD_CORE_FILE_WIN32_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/file_win32.hpp) +#endif diff --git a/include/webcpp/beast/core/flat_buffer.hpp b/include/webcpp/beast/core/flat_buffer.hpp new file mode 100644 index 0000000..7ee6bb0 --- /dev/null +++ b/include/webcpp/beast/core/flat_buffer.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_FLAT_BUFFER_HPP +#define WEBCPP_BEAST_FORWARD_CORE_FLAT_BUFFER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/flat_buffer.hpp) +#endif diff --git a/include/webcpp/beast/core/flat_static_buffer.hpp b/include/webcpp/beast/core/flat_static_buffer.hpp new file mode 100644 index 0000000..53f4a6d --- /dev/null +++ b/include/webcpp/beast/core/flat_static_buffer.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_FLAT_STATIC_BUFFER_HPP +#define WEBCPP_BEAST_FORWARD_CORE_FLAT_STATIC_BUFFER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/flat_static_buffer.hpp) +#endif diff --git a/include/webcpp/beast/core/flat_stream.hpp b/include/webcpp/beast/core/flat_stream.hpp new file mode 100644 index 0000000..85507bb --- /dev/null +++ b/include/webcpp/beast/core/flat_stream.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_FLAT_STREAM_HPP +#define WEBCPP_BEAST_FORWARD_CORE_FLAT_STREAM_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/flat_stream.hpp) +#endif diff --git a/include/webcpp/beast/core/make_printable.hpp b/include/webcpp/beast/core/make_printable.hpp new file mode 100644 index 0000000..b3fc7d5 --- /dev/null +++ b/include/webcpp/beast/core/make_printable.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_MAKE_PRINTABLE_HPP +#define WEBCPP_BEAST_FORWARD_CORE_MAKE_PRINTABLE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/make_printable.hpp) +#endif diff --git a/include/webcpp/beast/core/multi_buffer.hpp b/include/webcpp/beast/core/multi_buffer.hpp new file mode 100644 index 0000000..a4eea3e --- /dev/null +++ b/include/webcpp/beast/core/multi_buffer.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_MULTI_BUFFER_HPP +#define WEBCPP_BEAST_FORWARD_CORE_MULTI_BUFFER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/multi_buffer.hpp) +#endif diff --git a/include/webcpp/beast/core/ostream.hpp b/include/webcpp/beast/core/ostream.hpp new file mode 100644 index 0000000..815b8e4 --- /dev/null +++ b/include/webcpp/beast/core/ostream.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_OSTREAM_HPP +#define WEBCPP_BEAST_FORWARD_CORE_OSTREAM_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/ostream.hpp) +#endif diff --git a/include/webcpp/beast/core/rate_policy.hpp b/include/webcpp/beast/core/rate_policy.hpp new file mode 100644 index 0000000..a318a36 --- /dev/null +++ b/include/webcpp/beast/core/rate_policy.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_RATE_POLICY_HPP +#define WEBCPP_BEAST_FORWARD_CORE_RATE_POLICY_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/rate_policy.hpp) +#endif diff --git a/include/webcpp/beast/core/read_size.hpp b/include/webcpp/beast/core/read_size.hpp new file mode 100644 index 0000000..d86c29b --- /dev/null +++ b/include/webcpp/beast/core/read_size.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_READ_SIZE_HPP +#define WEBCPP_BEAST_FORWARD_CORE_READ_SIZE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/read_size.hpp) +#endif diff --git a/include/webcpp/beast/core/role.hpp b/include/webcpp/beast/core/role.hpp new file mode 100644 index 0000000..1afe428 --- /dev/null +++ b/include/webcpp/beast/core/role.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_ROLE_HPP +#define WEBCPP_BEAST_FORWARD_CORE_ROLE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/role.hpp) +#endif diff --git a/include/webcpp/beast/core/saved_handler.hpp b/include/webcpp/beast/core/saved_handler.hpp new file mode 100644 index 0000000..8da5d8d --- /dev/null +++ b/include/webcpp/beast/core/saved_handler.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_SAVED_HANDLER_HPP +#define WEBCPP_BEAST_FORWARD_CORE_SAVED_HANDLER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/saved_handler.hpp) +#endif diff --git a/include/webcpp/beast/core/span.hpp b/include/webcpp/beast/core/span.hpp new file mode 100644 index 0000000..f765251 --- /dev/null +++ b/include/webcpp/beast/core/span.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_SPAN_HPP +#define WEBCPP_BEAST_FORWARD_CORE_SPAN_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/span.hpp) +#endif diff --git a/include/webcpp/beast/core/static_buffer.hpp b/include/webcpp/beast/core/static_buffer.hpp new file mode 100644 index 0000000..de6d415 --- /dev/null +++ b/include/webcpp/beast/core/static_buffer.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_STATIC_BUFFER_HPP +#define WEBCPP_BEAST_FORWARD_CORE_STATIC_BUFFER_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/static_buffer.hpp) +#endif diff --git a/include/webcpp/beast/core/static_string.hpp b/include/webcpp/beast/core/static_string.hpp new file mode 100644 index 0000000..e974aa3 --- /dev/null +++ b/include/webcpp/beast/core/static_string.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_STATIC_STRING_HPP +#define WEBCPP_BEAST_FORWARD_CORE_STATIC_STRING_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/static_string.hpp) +#endif diff --git a/include/webcpp/beast/core/stream_traits.hpp b/include/webcpp/beast/core/stream_traits.hpp new file mode 100644 index 0000000..78dc107 --- /dev/null +++ b/include/webcpp/beast/core/stream_traits.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_STREAM_TRAITS_HPP +#define WEBCPP_BEAST_FORWARD_CORE_STREAM_TRAITS_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/stream_traits.hpp) +#endif diff --git a/include/webcpp/beast/core/string.hpp b/include/webcpp/beast/core/string.hpp new file mode 100644 index 0000000..ab5b9f8 --- /dev/null +++ b/include/webcpp/beast/core/string.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_STRING_HPP +#define WEBCPP_BEAST_FORWARD_CORE_STRING_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/string.hpp) +#endif diff --git a/include/webcpp/beast/core/string_param.hpp b/include/webcpp/beast/core/string_param.hpp new file mode 100644 index 0000000..4576842 --- /dev/null +++ b/include/webcpp/beast/core/string_param.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_STRING_PARAM_HPP +#define WEBCPP_BEAST_FORWARD_CORE_STRING_PARAM_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/string_param.hpp) +#endif diff --git a/include/webcpp/beast/core/string_type.hpp b/include/webcpp/beast/core/string_type.hpp new file mode 100644 index 0000000..5205295 --- /dev/null +++ b/include/webcpp/beast/core/string_type.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_STRING_TYPE_HPP +#define WEBCPP_BEAST_FORWARD_CORE_STRING_TYPE_HPP +#include +#include WEBCPP_BEAST_BACKEND_HEADER(core/string_type.hpp) +#endif diff --git a/include/webcpp/beast/core/tcp_stream.hpp b/include/webcpp/beast/core/tcp_stream.hpp new file mode 100644 index 0000000..b3ff466 --- /dev/null +++ b/include/webcpp/beast/core/tcp_stream.hpp @@ -0,0 +1,6 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +#ifndef WEBCPP_BEAST_FORWARD_CORE_TCP_STREAM_HPP +#define WEBCPP_BEAST_FORWARD_CORE_TCP_STREAM_HPP +#include +#include +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/http/icy_stream.hpp b/include/webcpp/beast/detail/backend/_experimental/http/icy_stream.hpp new file mode 100644 index 0000000..3cbc589 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/http/icy_stream.hpp @@ -0,0 +1,329 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_HTTP_ICY_STREAM_HPP +#define WEBCPP_BEAST_BACKEND_HTTP_ICY_STREAM_HPP + +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace http { + +/** Stream wrapper to process Shoutcast HTTP responses + + This wrapper replaces the word "ICY" in the first + HTTP response received on the connection, with "HTTP/1.1". + This allows the Beast parser to be used with Shoutcast + servers, which send a non-standard HTTP message as the + response. + + For asynchronous operations, the application must ensure + that they are are all performed within the same implicit + or explicit strand. + + @par Thread Safety + @e Distinct @e objects: Safe.@n + @e Shared @e objects: Unsafe. + The application must also ensure that all asynchronous + operations are performed within the same implicit or explicit strand. + + @par Example + To use the @ref icy_stream template with an @ref tcp_stream + you would write: + @code + http::icy_stream is(ioc); + @endcode + + @tparam NextLayer The type representing the next layer, to which + data will be read and written during operations. For synchronous + operations, the type must support the SyncStream concept. + For asynchronous operations, the type must support the + AsyncStream concept. + + @note A stream object must not be moved or destroyed while there + are pending asynchronous operations associated with it. + + @par Concepts + AsyncStream, SyncStream +*/ +template +class icy_stream +{ + NextLayer stream_; + char buf_[8]; + unsigned char n_ = 0; + bool detect_ = true; + + struct ops; + + static + net::const_buffer + version() + { + return {"HTTP/1.1", 8}; + } + +public: + /// The type of the next layer. + using next_layer_type = + typename std::remove_reference::type; + + /// The type of the executor associated with the object. + using executor_type = typename next_layer_type::executor_type; + + icy_stream(icy_stream&&) = default; + icy_stream(icy_stream const&) = default; + icy_stream& operator=(icy_stream&&) = default; + icy_stream& operator=(icy_stream const&) = default; + + /** Destructor + + The treatment of pending operations will be the same as that + of the next layer. + */ + ~icy_stream() = default; + + /** Constructor + + Arguments, if any, are forwarded to the next layer's constructor. + */ + template + explicit + icy_stream(Args&&... args); + + //-------------------------------------------------------------------------- + + /** Get the executor associated with the object. + + This function may be used to obtain the executor object that the + stream uses to dispatch handlers for asynchronous operations. + + @return A copy of the executor that stream will use to dispatch handlers. + */ + executor_type + get_executor() noexcept + { + return stream_.get_executor(); + } + + /** Get a reference to the next layer + + This function returns a reference to the next layer + in a stack of stream layers. + + @return A reference to the next layer in the stack of + stream layers. + */ + next_layer_type& + next_layer() + { + return stream_; + } + + /** Get a reference to the next layer + + This function returns a reference to the next layer in a + stack of stream layers. + + @return A reference to the next layer in the stack of + stream layers. + */ + next_layer_type const& + next_layer() const + { + return stream_; + } + + //-------------------------------------------------------------------------- + + /** Read some data from the stream. + + This function is used to read data from the stream. The function call will + block until one or more bytes of data has been read successfully, or until + an error occurs. + + @param buffers The buffers into which the data will be read. + + @returns The number of bytes read. + + @throws system_error Thrown on failure. + + @note The `read_some` operation may not read all of the requested number of + bytes. Consider using the function `net::read` if you need to ensure + that the requested amount of data is read before the blocking operation + completes. + */ + template + std::size_t + read_some(MutableBufferSequence const& buffers); + + /** Read some data from the stream. + + This function is used to read data from the stream. The function call will + block until one or more bytes of data has been read successfully, or until + an error occurs. + + @param buffers The buffers into which the data will be read. + + @param ec Set to indicate what error occurred, if any. + + @returns The number of bytes read. + + @note The `read_some` operation may not read all of the requested number of + bytes. Consider using the function `net::read` if you need to ensure + that the requested amount of data is read before the blocking operation + completes. + */ + template + std::size_t + read_some( + MutableBufferSequence const& buffers, + error_code& ec); + + /** Start an asynchronous read. + + This function is used to asynchronously read one or more bytes of data from + the stream. The function call always returns immediately. + + @param buffers The buffers into which the data will be read. Although the + buffers object may be copied as necessary, ownership of the underlying + buffers is retained by the caller, which must guarantee that they remain + valid until the handler is called. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + const boost::system::error_code& error, // Result of operation. + std::size_t bytes_transferred // Number of bytes read. + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @note The `async_read_some` operation may not read all of the requested number of + bytes. Consider using the function `net::async_read` if you need + to ensure that the requested amount of data is read before the asynchronous + operation completes. + */ + template< + class MutableBufferSequence, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 ReadHandler = + net::default_completion_token_t + > + WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(ReadHandler) + async_read_some( + MutableBufferSequence const& buffers, + ReadHandler&& handler = + net::default_completion_token_t{}); + + /** Write some data to the stream. + + This function is used to write data on the stream. The function call will + block until one or more bytes of data has been written successfully, or + until an error occurs. + + @param buffers The data to be written. + + @returns The number of bytes written. + + @throws system_error Thrown on failure. + + @note The `write_some` operation may not transmit all of the data to the + peer. Consider using the function `net::write` if you need to + ensure that all data is written before the blocking operation completes. + */ + template + std::size_t + write_some(ConstBufferSequence const& buffers); + + /** Write some data to the stream. + + This function is used to write data on the stream. The function call will + block until one or more bytes of data has been written successfully, or + until an error occurs. + + @param buffers The data to be written. + + @param ec Set to indicate what error occurred, if any. + + @returns The number of bytes written. + + @note The `write_some` operation may not transmit all of the data to the + peer. Consider using the function `net::write` if you need to + ensure that all data is written before the blocking operation completes. + */ + template + std::size_t + write_some( + ConstBufferSequence const& buffers, + error_code& ec); + + /** Start an asynchronous write. + + This function is used to asynchronously write one or more bytes of data to + the stream. The function call always returns immediately. + + @param buffers The data to be written to the stream. Although the buffers + object may be copied as necessary, ownership of the underlying buffers is + retained by the caller, which must guarantee that they remain valid until + the handler is called. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + error_code const& error, // Result of operation. + std::size_t bytes_transferred // Number of bytes written. + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @note The `async_write_some` operation may not transmit all of the data to + the peer. Consider using the function `net::async_write` if you need + to ensure that all data is written before the asynchronous operation completes. + */ + template< + class ConstBufferSequence, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 WriteHandler = + net::default_completion_token_t + > + WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(WriteHandler) + async_write_some( + ConstBufferSequence const& buffers, + WriteHandler&& handler = + net::default_completion_token_t{}); +}; + +} // http +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/http/impl/icy_stream.hpp b/include/webcpp/beast/detail/backend/_experimental/http/impl/icy_stream.hpp new file mode 100644 index 0000000..dd5b27c --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/http/impl/icy_stream.hpp @@ -0,0 +1,360 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_CORE_IMPL_ICY_STREAM_HPP +#define WEBCPP_BEAST_BACKEND_CORE_IMPL_ICY_STREAM_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace http { + +namespace detail { + +template +boost::tribool +is_icy(ConstBufferSequence const& buffers) +{ + char buf[3]; + auto const n = net::buffer_copy( + net::mutable_buffer(buf, 3), + buffers); + if(n >= 1 && buf[0] != 'I') + return false; + if(n >= 2 && buf[1] != 'C') + return false; + if(n >= 3 && buf[2] != 'Y') + return false; + if(n < 3) + return boost::indeterminate; + return true; +} + +} // detail + +template +struct icy_stream::ops +{ + +template +class read_op + : public ::webcpp::beast_backend::async_base> + , public ::webcpp::asio_backend::coroutine +{ + icy_stream& s_; + Buffers b_; + std::size_t n_ = 0; + error_code ec_; + bool match_ = false; + +public: + template + read_op( + Handler_&& h, + icy_stream& s, + Buffers const& b) + : async_base>( + std::forward(h), s.get_executor()) + , s_(s) + , b_(b) + { + (*this)({}, 0, false); + } + + void + operator()( + error_code ec, + std::size_t bytes_transferred, + bool cont = true) + { + WEBCPP_ASIO_BACKEND_CORO_REENTER(*this) + { + if(s_.detect_) + { + BOOST_ASSERT(s_.n_ == 0); + for(;;) + { + // Try to read the first three characters + WEBCPP_ASIO_BACKEND_CORO_YIELD + { + WEBCPP_ASIO_BACKEND_HANDLER_LOCATION(( + __FILE__, __LINE__, + "http::icy_stream::async_read_some")); + + s_.next_layer().async_read_some( + net::mutable_buffer( + s_.buf_ + s_.n_, 3 - s_.n_), + std::move(*this)); + } + s_.n_ += static_cast(bytes_transferred); + if(ec) + goto upcall; + auto result = detail::is_icy( + net::const_buffer(s_.buf_, s_.n_)); + if(boost::indeterminate(result)) + continue; + if(result) + s_.n_ = static_cast(net::buffer_copy( + net::buffer(s_.buf_, sizeof(s_.buf_)), + icy_stream::version())); + break; + } + s_.detect_ = false; + } + if(s_.n_ > 0) + { + bytes_transferred = net::buffer_copy( + b_, net::const_buffer(s_.buf_, s_.n_)); + s_.n_ -= static_cast(bytes_transferred); + std::memmove( + s_.buf_, + s_.buf_ + bytes_transferred, + sizeof(s_.buf_) - bytes_transferred); + } + else + { + WEBCPP_ASIO_BACKEND_CORO_YIELD + { + WEBCPP_ASIO_BACKEND_HANDLER_LOCATION(( + __FILE__, __LINE__, + "http::icy_stream::async_read_some")); + + s_.next_layer().async_read_some( + b_, std::move(*this)); + } + } + upcall: + if(! cont) + { + ec_ = ec; + n_ = bytes_transferred; + WEBCPP_ASIO_BACKEND_CORO_YIELD + { + WEBCPP_ASIO_BACKEND_HANDLER_LOCATION(( + __FILE__, __LINE__, + "http::icy_stream::async_read_some")); + + s_.next_layer().async_read_some( + net::mutable_buffer{}, + std::move(*this)); + } + WEBCPP_BEAST_BACKEND_ASSIGN_EC(ec, ec_); + bytes_transferred = n_; + } + this->complete_now(ec, bytes_transferred); + } + } +}; + +struct run_read_op +{ + icy_stream* self; + + using executor_type = typename icy_stream::executor_type; + + executor_type + get_executor() const noexcept + { + return self->get_executor(); + } + + template + void + operator()( + ReadHandler&& h, + Buffers const& b) + { + // If you get an error on the following line it means + // that your handler does not meet the documented type + // requirements for the handler. + + static_assert( + ::webcpp::beast_backend::detail::is_invocable::value, + "ReadHandler type requirements not met"); + + read_op< + Buffers, + typename std::decay::type>( + std::forward(h), *self, b); + } +}; + +}; + +//------------------------------------------------------------------------------ + +template +template +icy_stream:: +icy_stream(Args&&... args) + : stream_(std::forward(args)...) +{ + std::memset(buf_, 0, sizeof(buf_)); +} + +template +template +std::size_t +icy_stream:: +read_some(MutableBufferSequence const& buffers) +{ + static_assert(is_sync_read_stream::value, + "SyncReadStream type requirements not met"); + static_assert(net::is_mutable_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + error_code ec; + auto n = read_some(buffers, ec); + if(ec) + BOOST_THROW_EXCEPTION(system_error{ec}); + return n; +} + +template +template +std::size_t +icy_stream:: +read_some(MutableBufferSequence const& buffers, error_code& ec) +{ + static_assert(is_sync_read_stream::value, + "SyncReadStream type requirements not met"); + static_assert(net::is_mutable_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + std::size_t bytes_transferred; + if(detect_) + { + BOOST_ASSERT(n_ == 0); + for(;;) + { + // Try to read the first three characters + bytes_transferred = next_layer().read_some( + net::mutable_buffer(buf_ + n_, 3 - n_), ec); + n_ += static_cast(bytes_transferred); + if(ec) + return 0; + auto result = detail::is_icy( + net::const_buffer(buf_, n_)); + if(boost::indeterminate(result)) + continue; + if(result) + n_ = static_cast(net::buffer_copy( + net::buffer(buf_, sizeof(buf_)), + icy_stream::version())); + break; + } + detect_ = false; + } + if(n_ > 0) + { + bytes_transferred = net::buffer_copy( + buffers, net::const_buffer(buf_, n_)); + n_ -= static_cast(bytes_transferred); + std::memmove( + buf_, + buf_ + bytes_transferred, + sizeof(buf_) - bytes_transferred); + } + else + { + bytes_transferred = + next_layer().read_some(buffers, ec); + } + return bytes_transferred; +} + +template +template< + class MutableBufferSequence, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 ReadHandler> +WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(ReadHandler) +icy_stream:: +async_read_some( + MutableBufferSequence const& buffers, + ReadHandler&& handler) +{ + static_assert(is_async_read_stream::value, + "AsyncReadStream type requirements not met"); + static_assert(net::is_mutable_buffer_sequence< + MutableBufferSequence >::value, + "MutableBufferSequence type requirements not met"); + return net::async_initiate< + ReadHandler, + void(error_code, std::size_t)>( + typename ops::run_read_op{this}, + handler, + buffers); +} + +template +template +std::size_t +icy_stream:: +write_some(MutableBufferSequence const& buffers) +{ + static_assert(is_sync_write_stream::value, + "SyncWriteStream type requirements not met"); + static_assert(net::is_const_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + return stream_.write_some(buffers); +} + +template +template +std::size_t +icy_stream:: +write_some(MutableBufferSequence const& buffers, error_code& ec) +{ + static_assert(is_sync_write_stream::value, + "SyncWriteStream type requirements not met"); + static_assert(net::is_const_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + return stream_.write_some(buffers, ec); +} + +template +template< + class MutableBufferSequence, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 WriteHandler> +WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(WriteHandler) +icy_stream:: +async_write_some( + MutableBufferSequence const& buffers, + WriteHandler&& handler) +{ + static_assert(is_async_write_stream::value, + "AsyncWriteStream type requirements not met"); + static_assert(net::is_const_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + return stream_.async_write_some( + buffers, std::forward(handler)); +} + +} // http +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/detail/stream_state.hpp b/include/webcpp/beast/detail/backend/_experimental/test/detail/stream_state.hpp new file mode 100644 index 0000000..0c50ef3 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/detail/stream_state.hpp @@ -0,0 +1,138 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// Copyright (c) 2020 Richard Hodges (hodges.r@gmail.com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_DETAIL_STREAM_STATE_HPP +#define WEBCPP_BEAST_BACKEND_TEST_DETAIL_STREAM_STATE_HPP + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { +namespace detail { + +struct stream_state; + +struct stream_service_impl +{ + std::mutex m_; + std::vector v_; + + WEBCPP_BEAST_BACKEND_DECL + void + remove(stream_state& impl); +}; + +//------------------------------------------------------------------------------ + +class stream_service + : public ::webcpp::beast_backend::detail::service_base +{ + boost::shared_ptr sp_; + + WEBCPP_BEAST_BACKEND_DECL + void + shutdown() override; + +public: + WEBCPP_BEAST_BACKEND_DECL + explicit + stream_service(net::execution_context& ctx); + + WEBCPP_BEAST_BACKEND_DECL + static + auto + make_impl( + net::any_io_executor exec, + test::fail_count* fc) -> + boost::shared_ptr; +}; + +//------------------------------------------------------------------------------ + +struct stream_read_op_base +{ + virtual ~stream_read_op_base() = default; + virtual void operator()(error_code ec) = 0; +}; + +//------------------------------------------------------------------------------ + +enum class stream_status +{ + ok, + eof, +}; + +//------------------------------------------------------------------------------ + +struct stream_state +{ + net::any_io_executor exec; + boost::weak_ptr wp; + std::mutex m; + flat_buffer b; + std::condition_variable cv; + std::unique_ptr op; + stream_status code = stream_status::ok; + fail_count* fc = nullptr; + std::size_t nread = 0; + std::size_t nread_bytes = 0; + std::size_t nwrite = 0; + std::size_t nwrite_bytes = 0; + std::size_t read_max = + (std::numeric_limits::max)(); + std::size_t write_max = + (std::numeric_limits::max)(); + + WEBCPP_BEAST_BACKEND_DECL + stream_state( + net::any_io_executor exec_, + boost::weak_ptr wp_, + fail_count* fc_); + + WEBCPP_BEAST_BACKEND_DECL + ~stream_state(); + + WEBCPP_BEAST_BACKEND_DECL + void + remove() noexcept; + + WEBCPP_BEAST_BACKEND_DECL + void + notify_read(); + + WEBCPP_BEAST_BACKEND_DECL + void + cancel_read(); +}; + + + +} // detail +} // test +} // beast +} // boost + +#ifdef WEBCPP_BEAST_BACKEND_HEADER_ONLY +#include +#endif + +#endif // WEBCPP_BEAST_BACKEND_TEST_DETAIL_STREAM_STATE_HPP diff --git a/include/webcpp/beast/detail/backend/_experimental/test/detail/stream_state.ipp b/include/webcpp/beast/detail/backend/_experimental/test/detail/stream_state.ipp new file mode 100644 index 0000000..493fa79 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/detail/stream_state.ipp @@ -0,0 +1,151 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// Copyright (c) 2020 Richard Hodges (hodges.r@gmail.com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_DETAIL_STREAM_STATE_IPP +#define WEBCPP_BEAST_BACKEND_TEST_DETAIL_STREAM_STATE_IPP + +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +namespace detail { + +//------------------------------------------------------------------------------ + +stream_service:: +stream_service(net::execution_context& ctx) + : ::webcpp::beast_backend::detail::service_base(ctx) + , sp_(boost::make_shared()) +{ +} + +void +stream_service:: +shutdown() +{ + std::vector> v; + std::lock_guard g1(sp_->m_); + v.reserve(sp_->v_.size()); + for(auto p : sp_->v_) + { + std::lock_guard g2(p->m); + v.emplace_back(std::move(p->op)); + p->code = detail::stream_status::eof; + } +} + +auto +stream_service:: +make_impl( + net::any_io_executor exec, + test::fail_count* fc) -> + boost::shared_ptr +{ +#if defined(WEBCPP_ASIO_BACKEND_USE_TS_EXECUTOR_AS_DEFAULT) + auto& ctx = exec.context(); +#else + auto& ctx = net::query( + exec, + net::execution::context); +#endif + auto& svc = net::use_service(ctx); + auto sp = boost::make_shared(exec, svc.sp_, fc); + std::lock_guard g(svc.sp_->m_); + svc.sp_->v_.push_back(sp.get()); + return sp; +} + +//------------------------------------------------------------------------------ + +void +stream_service_impl:: +remove(stream_state& impl) +{ + std::lock_guard g(m_); + *std::find( + v_.begin(), v_.end(), + &impl) = std::move(v_.back()); + v_.pop_back(); +} + +//------------------------------------------------------------------------------ + +stream_state:: +stream_state( + net::any_io_executor exec_, + boost::weak_ptr wp_, + fail_count* fc_) + : exec(std::move(exec_)) + , wp(std::move(wp_)) + , fc(fc_) +{ +} + +stream_state:: +~stream_state() +{ + // cancel outstanding read + if(op != nullptr) + (*op)(net::error::operation_aborted); +} + +void +stream_state:: +remove() noexcept +{ + auto sp = wp.lock(); + + // If this goes off, it means the lifetime of a test::stream object + // extended beyond the lifetime of the associated execution context. + BOOST_ASSERT(sp); + + sp->remove(*this); +} + +void +stream_state:: +notify_read() +{ + if(op) + { + auto op_ = std::move(op); + op_->operator()(error_code{}); + } + else + { + cv.notify_all(); + } +} + +void +stream_state:: +cancel_read() +{ + std::unique_ptr p; + { + std::lock_guard lock(m); + code = stream_status::eof; + p = std::move(op); + } + if(p != nullptr) + (*p)(net::error::operation_aborted); +} + +} // detail + +} // test +} // beast +} // boost + +#endif // WEBCPP_BEAST_BACKEND_TEST_DETAIL_STREAM_STATE_IPP diff --git a/include/webcpp/beast/detail/backend/_experimental/test/error.hpp b/include/webcpp/beast/detail/backend/_experimental/test/error.hpp new file mode 100644 index 0000000..13e0c8c --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/error.hpp @@ -0,0 +1,40 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_ERROR_HPP +#define WEBCPP_BEAST_BACKEND_TEST_ERROR_HPP + +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +/// Error codes returned from unit testing algorithms +enum class error +{ + /** The test stream generated a simulated testing error + + This error is returned by a @ref fail_count object + when it generates a simulated error. + */ + test_failure = 1 +}; + +} // test +} // beast +} // boost + +#include +#ifdef WEBCPP_BEAST_BACKEND_HEADER_ONLY +#include +#endif + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/fail_count.hpp b/include/webcpp/beast/detail/backend/_experimental/test/fail_count.hpp new file mode 100644 index 0000000..7350861 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/fail_count.hpp @@ -0,0 +1,70 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_FAIL_COUNT_HPP +#define WEBCPP_BEAST_BACKEND_TEST_FAIL_COUNT_HPP + +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +/** A countdown to simulated failure + + On the Nth operation, the class will fail with the specified + error code, or the default error code of @ref error::test_failure. + + Instances of this class may be used to build objects which + are specifically designed to aid in writing unit tests, for + interfaces which can throw exceptions or return `error_code` + values representing failure. +*/ +class fail_count +{ + std::size_t n_; + std::size_t i_ = 0; + error_code ec_; + +public: + fail_count(fail_count&&) = default; + + /** Construct a counter + + @param n The 0-based index of the operation to fail on or after + @param ev An optional error code to use when generating a simulated failure + */ + WEBCPP_BEAST_BACKEND_DECL + explicit + fail_count( + std::size_t n, + error_code ev = error::test_failure); + + /// Throw an exception on the Nth failure + WEBCPP_BEAST_BACKEND_DECL + void + fail(); + + /// Set an error code on the Nth failure + WEBCPP_BEAST_BACKEND_DECL + bool + fail(error_code& ec); +}; + +} // test +} // beast +} // boost + +#ifdef WEBCPP_BEAST_BACKEND_HEADER_ONLY +#include +#endif + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/handler.hpp b/include/webcpp/beast/detail/backend/_experimental/test/handler.hpp new file mode 100644 index 0000000..a2336b8 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/handler.hpp @@ -0,0 +1,199 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_HANDLER_HPP +#define WEBCPP_BEAST_BACKEND_TEST_HANDLER_HPP + +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +/** A CompletionHandler used for testing. + + This completion handler is used by tests to ensure correctness + of behavior. It is designed as a single type to reduce template + instantiations, with configurable settings through constructor + arguments. Typically this type will be used in type lists and + not instantiated directly; instances of this class are returned + by the helper functions listed below. + + @see success_handler, @ref fail_handler, @ref any_handler +*/ +class handler +{ + boost::optional ec_; + bool pass_ = false; + boost::source_location loc_{BOOST_CURRENT_LOCATION}; +public: + handler(boost::source_location loc = BOOST_CURRENT_LOCATION) : loc_(loc) {} + + explicit + handler(error_code ec, boost::source_location loc = BOOST_CURRENT_LOCATION) + : ec_(ec), loc_(loc) + { + } + + explicit + handler(boost::none_t, boost::source_location loc = BOOST_CURRENT_LOCATION) : loc_(loc) + { + } + + handler(handler&& other) + : ec_(other.ec_) + , pass_(boost::exchange(other.pass_, true)) + , loc_(other.loc_) + + { + } + + ~handler() + { + ::webcpp::beast_backend::unit_test::suite::this_suite()->expect(pass_, loc_.file_name(), loc_.line()); + } + + template + void + operator()(error_code ec, Args&&...) + { + ::webcpp::beast_backend::unit_test::suite::this_suite()->expect(!pass_, loc_.file_name(), loc_.line()); + if (ec_ && ec != *ec_) + ::webcpp::beast_backend::unit_test::suite::this_suite()->fail(ec.message(), loc_.file_name(), loc_.line()); + else + ::webcpp::beast_backend::unit_test::suite::this_suite()->pass(); + pass_ = true; + } + + void + operator()() + { + ::webcpp::beast_backend::unit_test::suite::this_suite()->expect(!pass_, loc_.file_name(), loc_.line()); + if (ec_ && ec_->failed()) + ::webcpp::beast_backend::unit_test::suite::this_suite()->fail(ec_->message(), loc_.file_name(), loc_.line()); + else + ::webcpp::beast_backend::unit_test::suite::this_suite()->pass(); + + pass_ = true; + } + + template::value>::type> + void + operator()(Arg0&&, Args&&...) + { + ::webcpp::beast_backend::unit_test::suite::this_suite()->expect(!pass_, loc_.file_name(), loc_.line()); + if (ec_ && ec_->failed()) + ::webcpp::beast_backend::unit_test::suite::this_suite()->fail(ec_->message(), loc_.file_name(), loc_.line()); + else + ::webcpp::beast_backend::unit_test::suite::this_suite()->pass(); + pass_ = true; + } +}; + +/** Return a test CompletionHandler which requires success. + + The returned handler can be invoked with any signature whose + first parameter is an `error_code`. The handler fails the test + if: + + @li The handler is destroyed without being invoked, or + + @li The handler is invoked with a non-successful error code. +*/ +inline +handler +success_handler(boost::source_location loc = BOOST_CURRENT_LOCATION) noexcept +{ + return handler(error_code{}, loc); +} + +/** Return a test CompletionHandler which requires invocation. + + The returned handler can be invoked with any signature. + The handler fails the test if: + + @li The handler is destroyed without being invoked. +*/ +inline +handler +any_handler(boost::source_location loc = BOOST_CURRENT_LOCATION) noexcept +{ + return handler(boost::none, loc); +} + +/** Return a test CompletionHandler which requires a specific error code. + + This handler can be invoked with any signature whose first + parameter is an `error_code`. The handler fails the test if: + + @li The handler is destroyed without being invoked. + + @li The handler is invoked with an error code different from + what is specified. + + @param ec The error code to specify. +*/ +inline +handler +fail_handler(error_code ec,boost::source_location loc = BOOST_CURRENT_LOCATION) noexcept +{ + return handler(ec, loc); +} + +/** Run an I/O context. + + This function runs and dispatches handlers on the specified + I/O context, until one of the following conditions is true: + + @li The I/O context runs out of work. + + @param ioc The I/O context to run +*/ +inline +void +run(net::io_context& ioc) +{ + ioc.run(); + ioc.restart(); +} + +/** Run an I/O context for a certain amount of time. + + This function runs and dispatches handlers on the specified + I/O context, until one of the following conditions is true: + + @li The I/O context runs out of work. + + @li No completions occur and the specified amount of time has elapsed. + + @param ioc The I/O context to run + + @param elapsed The maximum amount of time to run for. +*/ +template +void +run_for( + net::io_context& ioc, + std::chrono::duration elapsed) +{ + ioc.run_for(elapsed); + ioc.restart(); +} + +} // test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/immediate_executor.hpp b/include/webcpp/beast/detail/backend/_experimental/test/immediate_executor.hpp new file mode 100644 index 0000000..9c618e0 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/immediate_executor.hpp @@ -0,0 +1,119 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2023 Klemens Morgenstern (klemens.morgenstern@gmx.net) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_IMMEDIATE_EXECUTOR_HPP +#define WEBCPP_BEAST_BACKEND_TEST_IMMEDIATE_EXECUTOR_HPP + +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test +{ + +/** A immediate executor that directly invokes and counts how often that happened. */ + +class immediate_executor +{ + ::webcpp::asio_backend::execution_context* context_ = nullptr; + std::size_t &count_; + + public: + immediate_executor(std::size_t & count) noexcept : count_(count) {} + + ::webcpp::asio_backend::execution_context &query(::webcpp::asio_backend::execution::context_t) const noexcept + { + BOOST_ASSERT(false); + return *context_; + } + + constexpr static ::webcpp::asio_backend::execution::blocking_t + query(::webcpp::asio_backend::execution::blocking_t) noexcept + { + return ::webcpp::asio_backend::execution::blocking_t::never_t{}; + } + + constexpr static ::webcpp::asio_backend::execution::relationship_t + query(::webcpp::asio_backend::execution::relationship_t) noexcept + { + return ::webcpp::asio_backend::execution::relationship_t::fork_t{}; + } + // this function takes the function F and runs it on the event loop. + template + void + execute(F f) const + { + count_++; + std::forward(f)(); + } + + bool + operator==(immediate_executor const &) const noexcept + { + return true; + } + + bool + operator!=(immediate_executor const &) const noexcept + { + return false; + } +}; + +} // test +} // beast + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN +namespace asio +{ +namespace traits +{ +template +struct execute_member<::webcpp::beast_backend::test::immediate_executor, F> +{ + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = false; + typedef void result_type; +}; + +template<> +struct equality_comparable<::webcpp::beast_backend::test::immediate_executor> +{ + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; +}; + +template<> +struct query_member<::webcpp::beast_backend::test::immediate_executor, execution::context_t> +{ + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; + typedef execution_context& result_type; +}; + +template +struct query_static_constexpr_member< + ::webcpp::beast_backend::test::immediate_executor, + Property, + typename enable_if::value>::type> +{ + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; + typedef execution::blocking_t::never_t result_type; + static constexpr result_type value() noexcept + { + return result_type(); + } +}; +} // traits +} // asio +#endif + +} // boost + +#endif //WEBCPP_BEAST_BACKEND_TEST_IMMEDIATE_EXECUTOR_HPP diff --git a/include/webcpp/beast/detail/backend/_experimental/test/impl/error.hpp b/include/webcpp/beast/detail/backend/_experimental/test/impl/error.hpp new file mode 100644 index 0000000..90957ab --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/impl/error.hpp @@ -0,0 +1,40 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_IMPL_ERROR_HPP +#define WEBCPP_BEAST_BACKEND_TEST_IMPL_ERROR_HPP + +#include +#include +#include + +namespace boost { +namespace system { +template<> +struct is_error_code_enum< + webcpp::beast_backend::test::error> + : std::true_type +{ +}; +} // system +} // boost + +namespace webcpp { namespace beast_backend { +namespace test { + +WEBCPP_BEAST_BACKEND_DECL +error_code +make_error_code(error e) noexcept; + +} // test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/impl/error.ipp b/include/webcpp/beast/detail/backend/_experimental/test/impl/error.ipp new file mode 100644 index 0000000..cc9ef95 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/impl/error.ipp @@ -0,0 +1,72 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_IMPL_ERROR_IPP +#define WEBCPP_BEAST_BACKEND_TEST_IMPL_ERROR_IPP + +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +namespace detail { + +class error_codes : public error_category +{ +public: + WEBCPP_BEAST_BACKEND_DECL + const char* + name() const noexcept override + { + return "boost.beast.test"; + } + + WEBCPP_BEAST_BACKEND_DECL + char const* + message(int ev, char*, std::size_t) const noexcept override + { + switch(static_cast(ev)) + { + default: + case error::test_failure: return + "An automatic unit test failure occurred"; + } + } + + WEBCPP_BEAST_BACKEND_DECL + std::string + message(int ev) const override + { + return message(ev, nullptr, 0); + } + + WEBCPP_BEAST_BACKEND_DECL + error_condition + default_error_condition(int ev) const noexcept override + { + return error_condition{ev, *this}; + } +}; + +} // detail + +error_code +make_error_code(error e) noexcept +{ + static detail::error_codes const cat{}; + return error_code{static_cast< + std::underlying_type::type>(e), cat}; +} + +} // test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/impl/fail_count.ipp b/include/webcpp/beast/detail/backend/_experimental/test/impl/fail_count.ipp new file mode 100644 index 0000000..482de02 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/impl/fail_count.ipp @@ -0,0 +1,58 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_IMPL_FAIL_COUNT_IPP +#define WEBCPP_BEAST_BACKEND_TEST_IMPL_FAIL_COUNT_IPP + +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +fail_count:: +fail_count( + std::size_t n, + error_code ev) + : n_(n) + , ec_(ev) +{ +} + +void +fail_count:: +fail() +{ + if(i_ < n_) + ++i_; + if(i_ == n_) + BOOST_THROW_EXCEPTION(system_error{ec_}); +} + +bool +fail_count:: +fail(error_code& ec) +{ + if(i_ < n_) + ++i_; + if(i_ == n_) + { + ec = ec_; + return true; + } + ec = {}; + return false; +} + +} // test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/impl/stream.hpp b/include/webcpp/beast/detail/backend/_experimental/test/impl/stream.hpp new file mode 100644 index 0000000..cccfe52 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/impl/stream.hpp @@ -0,0 +1,483 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_IMPL_STREAM_HPP +#define WEBCPP_BEAST_BACKEND_TEST_IMPL_STREAM_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +namespace detail +{ +template +struct extract_executor_op +{ + To operator()(net::any_io_executor& ex) const + { + assert(ex.template target()); + return *ex.template target(); + } +}; + +template<> +struct extract_executor_op +{ + net::any_io_executor operator()(net::any_io_executor& ex) const + { + return ex; + } +}; +} // detail + +template +template +class basic_stream::read_op : public detail::stream_read_op_base +{ + struct lambda + { + Handler h_; + boost::weak_ptr wp_; + Buffers b_; + net::executor_work_guard< + net::associated_executor_t> wg2_; + lambda(lambda&&) = default; + lambda(lambda const&) = default; + + template + lambda( + Handler_&& h, + boost::shared_ptr const& s, + Buffers const& b) + : h_(std::forward(h)) + , wp_(s) + , b_(b) + , wg2_(net::get_associated_executor(h_, s->exec)) + { + } + + using allocator_type = net::associated_allocator_t; + + allocator_type get_allocator() const noexcept + { + return net::get_associated_allocator(h_); + } + + using cancellation_slot_type = + net::associated_cancellation_slot_t; + + cancellation_slot_type + get_cancellation_slot() const noexcept + { + return net::get_associated_cancellation_slot(h_, + net::cancellation_slot()); + } + + void + operator()(error_code ec) + { + std::size_t bytes_transferred = 0; + auto sp = wp_.lock(); + if(! sp) + { + WEBCPP_BEAST_BACKEND_ASSIGN_EC(ec, net::error::operation_aborted); + } + if(! ec) + { + std::lock_guard lock(sp->m); + BOOST_ASSERT(! sp->op); + if(sp->b.size() > 0) + { + bytes_transferred = + net::buffer_copy( + b_, sp->b.data(), sp->read_max); + sp->b.consume(bytes_transferred); + sp->nread_bytes += bytes_transferred; + } + else if (buffer_bytes(b_) > 0) + { + WEBCPP_BEAST_BACKEND_ASSIGN_EC(ec, net::error::eof); + } + } + + net::dispatch(wg2_.get_executor(), + net::append(std::move(h_), ec, bytes_transferred)); + wg2_.reset(); + } + }; + + lambda fn_; + net::executor_work_guard wg1_; + +public: + template + read_op( + Handler_&& h, + boost::shared_ptr const& s, + Buffers const& b) + : fn_(std::forward(h), s, b) + , wg1_(s->exec) + { + } + + void + operator()(error_code ec) override + { + net::post(wg1_.get_executor(), net::append(std::move(fn_), ec)); + wg1_.reset(); + } +}; + +template +struct basic_stream::run_read_op +{ + boost::shared_ptr const& in; + + using executor_type = typename basic_stream::executor_type; + + executor_type + get_executor() const noexcept + { + return detail::extract_executor_op()(in->exec); + } + + template< + class ReadHandler, + class MutableBufferSequence> + void + operator()( + ReadHandler&& h, + MutableBufferSequence const& buffers) + { + // If you get an error on the following line it means + // that your handler does not meet the documented type + // requirements for the handler. + + static_assert( + ::webcpp::beast_backend::detail::is_invocable::value, + "ReadHandler type requirements not met"); + + initiate_read( + in, + std::unique_ptr{ + new read_op< + typename std::decay::type, + MutableBufferSequence>( + std::move(h), + in, + buffers)}, + buffer_bytes(buffers)); + } +}; + +template +struct basic_stream::run_write_op +{ + boost::shared_ptr const& in_; + + using executor_type = typename basic_stream::executor_type; + + executor_type + get_executor() const noexcept + { + return detail::extract_executor_op()(in_->exec); + } + + template< + class WriteHandler, + class ConstBufferSequence> + void + operator()( + WriteHandler&& h, + boost::weak_ptr out_, + ConstBufferSequence const& buffers) + { + // If you get an error on the following line it means + // that your handler does not meet the documented type + // requirements for the handler. + + static_assert( + ::webcpp::beast_backend::detail::is_invocable::value, + "WriteHandler type requirements not met"); + + ++in_->nwrite; + auto const upcall = [&](error_code ec, std::size_t n) + { + net::post(in_->exec, net::append(std::move(h), ec, n)); + }; + + // test failure + error_code ec; + std::size_t n = 0; + if(in_->fc && in_->fc->fail(ec)) + return upcall(ec, n); + + // A request to write 0 bytes to a stream is a no-op. + if(buffer_bytes(buffers) == 0) + return upcall(ec, n); + + // connection closed + auto out = out_.lock(); + if(! out) + return upcall(net::error::connection_reset, n); + + // copy buffers + n = std::min( + buffer_bytes(buffers), in_->write_max); + { + std::lock_guard lock(out->m); + n = net::buffer_copy(out->b.prepare(n), buffers); + out->b.commit(n); + out->nwrite_bytes += n; + out->notify_read(); + } + BOOST_ASSERT(! ec); + upcall(ec, n); + } +}; + +//------------------------------------------------------------------------------ + +template +template +std::size_t +basic_stream:: +read_some(MutableBufferSequence const& buffers) +{ + static_assert(net::is_mutable_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + error_code ec; + auto const n = read_some(buffers, ec); + if(ec) + BOOST_THROW_EXCEPTION(system_error{ec}); + return n; +} + +template +template +std::size_t +basic_stream:: +read_some(MutableBufferSequence const& buffers, + error_code& ec) +{ + static_assert(net::is_mutable_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + + ++in_->nread; + + // test failure + if(in_->fc && in_->fc->fail(ec)) + return 0; + + // A request to read 0 bytes from a stream is a no-op. + if(buffer_bytes(buffers) == 0) + { + ec = {}; + return 0; + } + + std::unique_lock lock{in_->m}; + BOOST_ASSERT(! in_->op); + in_->cv.wait(lock, + [&]() + { + return + in_->b.size() > 0 || + in_->code != detail::stream_status::ok; + }); + + // deliver bytes before eof + if(in_->b.size() > 0) + { + auto const n = net::buffer_copy( + buffers, in_->b.data(), in_->read_max); + in_->b.consume(n); + in_->nread_bytes += n; + return n; + } + + // deliver error + BOOST_ASSERT(in_->code != detail::stream_status::ok); + WEBCPP_BEAST_BACKEND_ASSIGN_EC(ec, net::error::eof); + return 0; +} + +template +template +WEBCPP_ASIO_BACKEND_INITFN_AUTO_RESULT_TYPE(ReadHandler, void(error_code, std::size_t)) +basic_stream:: +async_read_some( + MutableBufferSequence const& buffers, + ReadHandler&& handler) +{ + static_assert(net::is_mutable_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + + return net::async_initiate< + ReadHandler, + void(error_code, std::size_t)>( + run_read_op{in_}, + handler, + buffers); +} + +template +template +std::size_t +basic_stream:: +write_some(ConstBufferSequence const& buffers) +{ + static_assert(net::is_const_buffer_sequence< + ConstBufferSequence>::value, + "ConstBufferSequence type requirements not met"); + error_code ec; + auto const bytes_transferred = + write_some(buffers, ec); + if(ec) + BOOST_THROW_EXCEPTION(system_error{ec}); + return bytes_transferred; +} + +template +template +std::size_t +basic_stream:: +write_some( + ConstBufferSequence const& buffers, error_code& ec) +{ + static_assert(net::is_const_buffer_sequence< + ConstBufferSequence>::value, + "ConstBufferSequence type requirements not met"); + + ++in_->nwrite; + + // test failure + if(in_->fc && in_->fc->fail(ec)) + return 0; + + // A request to write 0 bytes to a stream is a no-op. + if(buffer_bytes(buffers) == 0) + { + ec = {}; + return 0; + } + + // connection closed + auto out = out_.lock(); + if(! out) + { + WEBCPP_BEAST_BACKEND_ASSIGN_EC(ec, net::error::connection_reset); + return 0; + } + + // copy buffers + auto n = std::min( + buffer_bytes(buffers), in_->write_max); + { + std::lock_guard lock(out->m); + n = net::buffer_copy(out->b.prepare(n), buffers); + out->b.commit(n); + out->nwrite_bytes += n; + out->notify_read(); + } + return n; +} + +template +template +WEBCPP_ASIO_BACKEND_INITFN_AUTO_RESULT_TYPE(WriteHandler, void(error_code, std::size_t)) +basic_stream:: +async_write_some( + ConstBufferSequence const& buffers, + WriteHandler&& handler) +{ + static_assert(net::is_const_buffer_sequence< + ConstBufferSequence>::value, + "ConstBufferSequence type requirements not met"); + + return net::async_initiate< + WriteHandler, + void(error_code, std::size_t)>( + run_write_op{in_}, + handler, + out_, + buffers); +} + +//------------------------------------------------------------------------------ + +template +void +async_teardown( + role_type, + basic_stream& s, + TeardownHandler&& handler) +{ + error_code ec; + if( s.in_->fc && + s.in_->fc->fail(ec)) + return net::post( + s.get_executor(), + net::append(std::move(handler), ec)); + s.close(); + if( s.in_->fc && + s.in_->fc->fail(ec)) + { + WEBCPP_BEAST_BACKEND_ASSIGN_EC(ec, net::error::eof); + } + else + ec = {}; + + net::post(s.get_executor(), net::append(std::move(handler), ec)); +} + +//------------------------------------------------------------------------------ + +template +basic_stream +connect(stream& to, Arg1&& arg1, ArgN&&... argn) +{ + stream from{ + std::forward(arg1), + std::forward(argn)...}; + from.connect(to); + return from; +} + +template +auto basic_stream::get_executor() noexcept -> executor_type +{ + return detail::extract_executor_op()(in_->exec); +} + +} // test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/impl/stream.ipp b/include/webcpp/beast/detail/backend/_experimental/test/impl/stream.ipp new file mode 100644 index 0000000..111235b --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/impl/stream.ipp @@ -0,0 +1,277 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_IMPL_STREAM_IPP +#define WEBCPP_BEAST_BACKEND_TEST_IMPL_STREAM_IPP + +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +//------------------------------------------------------------------------------ + +template +void basic_stream::initiate_read( + boost::shared_ptr const& in_, + std::unique_ptr&& op, + std::size_t buf_size) +{ + std::unique_lock lock(in_->m); + + ++in_->nread; + if(in_->op != nullptr) + BOOST_THROW_EXCEPTION( + std::logic_error{"in_->op != nullptr"}); + + // test failure + error_code ec; + if(in_->fc && in_->fc->fail(ec)) + { + lock.unlock(); + (*op)(ec); + return; + } + + // A request to read 0 bytes from a stream is a no-op. + if(buf_size == 0 || buffer_bytes(in_->b.data()) > 0) + { + lock.unlock(); + (*op)(ec); + return; + } + + // deliver error + if(in_->code != detail::stream_status::ok) + { + lock.unlock(); + (*op)(net::error::eof); + return; + } + + // complete when bytes available or closed + in_->op = std::move(op); +} + +//------------------------------------------------------------------------------ + +template +basic_stream:: +~basic_stream() +{ + close(); + in_->remove(); +} + +template +basic_stream:: +basic_stream(basic_stream&& other) +{ + auto in = detail::stream_service::make_impl( + other.in_->exec, other.in_->fc); + in_ = std::move(other.in_); + out_ = std::move(other.out_); + other.in_ = in; +} + + +template +basic_stream& +basic_stream:: +operator=(basic_stream&& other) +{ + close(); + auto in = detail::stream_service::make_impl( + other.in_->exec, other.in_->fc); + in_->remove(); + in_ = std::move(other.in_); + out_ = std::move(other.out_); + other.in_ = in; + return *this; +} + +//------------------------------------------------------------------------------ + +template +basic_stream:: +basic_stream(executor_type exec) + : in_(detail::stream_service::make_impl(std::move(exec), nullptr)) +{ +} + +template +basic_stream:: +basic_stream( + net::io_context& ioc, + fail_count& fc) + : in_(detail::stream_service::make_impl(ioc.get_executor(), &fc)) +{ +} + +template +basic_stream:: +basic_stream( + net::io_context& ioc, + string_view s) + : in_(detail::stream_service::make_impl(ioc.get_executor(), nullptr)) +{ + in_->b.commit(net::buffer_copy( + in_->b.prepare(s.size()), + net::buffer(s.data(), s.size()))); +} + +template +basic_stream:: +basic_stream( + net::io_context& ioc, + fail_count& fc, + string_view s) + : in_(detail::stream_service::make_impl(ioc.get_executor(), &fc)) +{ + in_->b.commit(net::buffer_copy( + in_->b.prepare(s.size()), + net::buffer(s.data(), s.size()))); +} + +template +void +basic_stream:: +connect(basic_stream& remote) +{ + BOOST_ASSERT(! out_.lock()); + BOOST_ASSERT(! remote.out_.lock()); + std::lock(in_->m, remote.in_->m); + std::lock_guard guard1{in_->m, std::adopt_lock}; + std::lock_guard guard2{remote.in_->m, std::adopt_lock}; + out_ = remote.in_; + remote.out_ = in_; + in_->code = detail::stream_status::ok; + remote.in_->code = detail::stream_status::ok; +} + +template +string_view +basic_stream:: +str() const +{ + auto const bs = in_->b.data(); + if(buffer_bytes(bs) == 0) + return {}; + net::const_buffer const b = *net::buffer_sequence_begin(bs); + return {static_cast(b.data()), b.size()}; +} + +template +void +basic_stream:: +append(string_view s) +{ + std::lock_guard lock{in_->m}; + in_->b.commit(net::buffer_copy( + in_->b.prepare(s.size()), + net::buffer(s.data(), s.size()))); +} + +template +void +basic_stream:: +clear() +{ + std::lock_guard lock{in_->m}; + in_->b.consume(in_->b.size()); +} + +template +void +basic_stream:: +close() +{ + in_->cancel_read(); + + // disconnect + { + auto out = out_.lock(); + out_.reset(); + + // notify peer + if(out) + { + std::lock_guard lock(out->m); + if(out->code == detail::stream_status::ok) + { + out->code = detail::stream_status::eof; + out->notify_read(); + } + } + } +} + +template +void +basic_stream:: +close_remote() +{ + std::lock_guard lock{in_->m}; + if(in_->code == detail::stream_status::ok) + { + in_->code = detail::stream_status::eof; + in_->notify_read(); + } +} + +template +void +teardown( + role_type, + basic_stream& s, + boost::system::error_code& ec) +{ + if( s.in_->fc && + s.in_->fc->fail(ec)) + return; + + s.close(); + + if( s.in_->fc && + s.in_->fc->fail(ec)) + { + WEBCPP_BEAST_BACKEND_ASSIGN_EC(ec, net::error::eof); + } + else + ec = {}; +} + +//------------------------------------------------------------------------------ + +template +basic_stream +connect(basic_stream& to) +{ + basic_stream from(to.get_executor()); + from.connect(to); + return from; +} + +template +void +connect(basic_stream& s1, basic_stream& s2) +{ + s1.connect(s2); +} + +} // test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/stream.hpp b/include/webcpp/beast/detail/backend/_experimental/test/stream.hpp new file mode 100644 index 0000000..1f047b0 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/stream.hpp @@ -0,0 +1,622 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_STREAM_HPP +#define WEBCPP_BEAST_BACKEND_TEST_STREAM_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN +namespace webcpp { namespace asio_backend { +namespace ssl { +template class stream; +} // ssl +} // asio +} // boost +#endif + +namespace webcpp { namespace beast_backend { +namespace test { + +/** A two-way socket useful for unit testing + + An instance of this class simulates a traditional socket, + while also providing features useful for unit testing. + Each endpoint maintains an independent buffer called + the input area. Writes from one endpoint append data + to the peer's pending input area. When an endpoint performs + a read and data is present in the input area, the data is + delivered to the blocking or asynchronous operation. Otherwise + the operation is blocked or deferred until data is made + available, or until the endpoints become disconnected. + + These streams may be used anywhere an algorithm accepts a + reference to a synchronous or asynchronous read or write + stream. It is possible to use a test stream in a call to + `net::read_until`, or in a call to + @ref webcpp::beast_backend::http::async_write for example. + + As with Boost.Asio I/O objects, a @ref stream constructs + with a reference to the `net::io_context` to use for + handling asynchronous I/O. For asynchronous operations, the + stream follows the same rules as a traditional asio socket + with respect to how completion handlers for asynchronous + operations are performed. + + To facilitate testing, these streams support some additional + features: + + @li The input area, represented by a @ref ::webcpp::beast_backend::basic_flat_buffer, + may be directly accessed by the caller to inspect the contents + before or after the remote endpoint writes data. This allows + a unit test to verify that the received data matches. + + @li Data may be manually appended to the input area. This data + will delivered in the next call to + @ref stream::read_some or @ref stream::async_read_some. + This allows predefined test vectors to be set up for testing + read algorithms. + + @li The stream may be constructed with a fail count. The + stream will eventually fail with a predefined error after a + certain number of operations, where the number of operations + is controlled by the test. When a test loops over a range of + operation counts, it is possible to exercise every possible + point of failure in the algorithm being tested. When used + correctly the technique allows the tests to reach a high + percentage of code coverage. + + @par Thread Safety + @e Distinct @e objects: Safe.@n + @e Shared @e objects: Unsafe. + The application must also ensure that all asynchronous + operations are performed within the same implicit or explicit strand. + + @par Concepts + @li SyncReadStream + @li SyncWriteStream + @li AsyncReadStream + @li AsyncWriteStream +*/ +template +class basic_stream; + +template +void +teardown( + role_type, + basic_stream& s, + boost::system::error_code& ec); + +template +void +async_teardown( + role_type role, + basic_stream& s, + TeardownHandler&& handler); + +template +class basic_stream +{ +public: + /// The type of the executor associated with the object. + using executor_type = + Executor; + + /// Rebinds the socket type to another executor. + template + struct rebind_executor + { + /// The socket type when rebound to the specified executor. + typedef basic_stream other; + }; + +private: + template + friend class basic_stream; + + boost::shared_ptr in_; + boost::weak_ptr out_; + + template + class read_op; + + struct run_read_op; + struct run_write_op; + + static + void + initiate_read( + boost::shared_ptr const& in, + std::unique_ptr&& op, + std::size_t buf_size); + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + // webcpp::asio_backend::ssl::stream needs these + // DEPRECATED + template + friend class webcpp::asio_backend::ssl::stream; + // DEPRECATED + using lowest_layer_type = basic_stream; + // DEPRECATED + lowest_layer_type& + lowest_layer() noexcept + { + return *this; + } + // DEPRECATED + lowest_layer_type const& + lowest_layer() const noexcept + { + return *this; + } +#endif + +public: + using buffer_type = flat_buffer; + + /** Destructor + + If an asynchronous read operation is pending, it will + simply be discarded with no notification to the completion + handler. + + If a connection is established while the stream is destroyed, + the peer will see the error `net::error::connection_reset` + when performing any reads or writes. + */ + ~basic_stream(); + + /** Move Constructor + + Moving the stream while asynchronous operations are pending + results in undefined behavior. + */ + basic_stream(basic_stream&& other); + + /** Move Constructor + + Moving the stream while asynchronous operations are pending + results in undefined behavior. + */ + template + basic_stream(basic_stream&& other) + : in_(std::move(other.in_)) + , out_(std::move(other.out_)) + { + BOOST_ASSERT(in_->exec.template target() != nullptr); + in_->exec = executor_type(*in_->exec.template target()); + } + + /** Move Assignment + + Moving the stream while asynchronous operations are pending + results in undefined behavior. + */ + basic_stream& + operator=(basic_stream&& other); + + template + basic_stream& + operator==(basic_stream&& other); + + /** Construct a stream + + The stream will be created in a disconnected state. + + @param context The `io_context` object that the stream will use to + dispatch handlers for any asynchronous operations. + */ + template ::value>::type> + explicit + basic_stream(ExecutionContext& context) + : basic_stream(context.get_executor()) + { + } + + /** Construct a stream + + The stream will be created in a disconnected state. + + @param exec The `executor` object that the stream will use to + dispatch handlers for any asynchronous operations. + */ + explicit + basic_stream(executor_type exec); + + /** Construct a stream + + The stream will be created in a disconnected state. + + @param ioc The `io_context` object that the stream will use to + dispatch handlers for any asynchronous operations. + + @param fc The @ref fail_count to associate with the stream. + Each I/O operation performed on the stream will increment the + fail count. When the fail count reaches its internal limit, + a simulated failure error will be raised. + */ + basic_stream( + net::io_context& ioc, + fail_count& fc); + + /** Construct a stream + + The stream will be created in a disconnected state. + + @param ioc The `io_context` object that the stream will use to + dispatch handlers for any asynchronous operations. + + @param s A string which will be appended to the input area, not + including the null terminator. + */ + basic_stream( + net::io_context& ioc, + string_view s); + + /** Construct a stream + + The stream will be created in a disconnected state. + + @param ioc The `io_context` object that the stream will use to + dispatch handlers for any asynchronous operations. + + @param fc The @ref fail_count to associate with the stream. + Each I/O operation performed on the stream will increment the + fail count. When the fail count reaches its internal limit, + a simulated failure error will be raised. + + @param s A string which will be appended to the input area, not + including the null terminator. + */ + basic_stream( + net::io_context& ioc, + fail_count& fc, + string_view s); + + /// Establish a connection + void + connect(basic_stream& remote); + + /// Return the executor associated with the object. + executor_type + get_executor() noexcept; + + /// Set the maximum number of bytes returned by read_some + void + read_size(std::size_t n) noexcept + { + in_->read_max = n; + } + + /// Set the maximum number of bytes returned by write_some + void + write_size(std::size_t n) noexcept + { + in_->write_max = n; + } + + /// Direct input buffer access + buffer_type& + buffer() noexcept + { + return in_->b; + } + + /// Returns a string view representing the pending input data + string_view + str() const; + + /// Appends a string to the pending input data + void + append(string_view s); + + /// Clear the pending input area + void + clear(); + + /// Return the number of reads + std::size_t + nread() const noexcept + { + return in_->nread; + } + + /// Return the number of bytes read + std::size_t + nread_bytes() const noexcept + { + return in_->nread_bytes; + } + + /// Return the number of writes + std::size_t + nwrite() const noexcept + { + return in_->nwrite; + } + + /// Return the number of bytes written + std::size_t + nwrite_bytes() const noexcept + { + return in_->nwrite_bytes; + } + + /** Close the stream. + + The other end of the connection will see + `error::eof` after reading all the remaining data. + */ + void + close(); + + /** Close the other end of the stream. + + This end of the connection will see + `error::eof` after reading all the remaining data. + */ + void + close_remote(); + + /** Read some data from the stream. + + This function is used to read data from the stream. The function call will + block until one or more bytes of data has been read successfully, or until + an error occurs. + + @param buffers The buffers into which the data will be read. + + @returns The number of bytes read. + + @throws boost::system::system_error Thrown on failure. + + @note The `read_some` operation may not read all of the requested number of + bytes. Consider using the function `net::read` if you need to ensure + that the requested amount of data is read before the blocking operation + completes. + */ + template + std::size_t + read_some(MutableBufferSequence const& buffers); + + /** Read some data from the stream. + + This function is used to read data from the stream. The function call will + block until one or more bytes of data has been read successfully, or until + an error occurs. + + @param buffers The buffers into which the data will be read. + + @param ec Set to indicate what error occurred, if any. + + @returns The number of bytes read. + + @note The `read_some` operation may not read all of the requested number of + bytes. Consider using the function `net::read` if you need to ensure + that the requested amount of data is read before the blocking operation + completes. + */ + template + std::size_t + read_some(MutableBufferSequence const& buffers, + error_code& ec); + + /** Start an asynchronous read. + + This function is used to asynchronously read one or more bytes of data from + the stream. The function call always returns immediately. + + @param buffers The buffers into which the data will be read. Although the + buffers object may be copied as necessary, ownership of the underlying + buffers is retained by the caller, which must guarantee that they remain + valid until the handler is called. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + error_code const& ec, // Result of operation. + std::size_t bytes_transferred // Number of bytes read. + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @note The `async_read_some` operation may not read all of the requested number of + bytes. Consider using the function `net::async_read` if you need + to ensure that the requested amount of data is read before the asynchronous + operation completes. + */ + template< + class MutableBufferSequence, + WEBCPP_ASIO_BACKEND_COMPLETION_TOKEN_FOR(void(error_code, std::size_t)) ReadHandler + WEBCPP_ASIO_BACKEND_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> + WEBCPP_ASIO_BACKEND_INITFN_AUTO_RESULT_TYPE(ReadHandler, void(error_code, std::size_t)) + async_read_some( + MutableBufferSequence const& buffers, + ReadHandler&& handler WEBCPP_ASIO_BACKEND_DEFAULT_COMPLETION_TOKEN(executor_type)); + + /** Write some data to the stream. + + This function is used to write data on the stream. The function call will + block until one or more bytes of data has been written successfully, or + until an error occurs. + + @param buffers The data to be written. + + @returns The number of bytes written. + + @throws boost::system::system_error Thrown on failure. + + @note The `write_some` operation may not transmit all of the data to the + peer. Consider using the function `net::write` if you need to + ensure that all data is written before the blocking operation completes. + */ + template + std::size_t + write_some(ConstBufferSequence const& buffers); + + /** Write some data to the stream. + + This function is used to write data on the stream. The function call will + block until one or more bytes of data has been written successfully, or + until an error occurs. + + @param buffers The data to be written. + + @param ec Set to indicate what error occurred, if any. + + @returns The number of bytes written. + + @note The `write_some` operation may not transmit all of the data to the + peer. Consider using the function `net::write` if you need to + ensure that all data is written before the blocking operation completes. + */ + template + std::size_t + write_some( + ConstBufferSequence const& buffers, error_code& ec); + + /** Start an asynchronous write. + + This function is used to asynchronously write one or more bytes of data to + the stream. The function call always returns immediately. + + @param buffers The data to be written to the stream. Although the buffers + object may be copied as necessary, ownership of the underlying buffers is + retained by the caller, which must guarantee that they remain valid until + the handler is called. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + error_code const& ec, // Result of operation. + std::size_t bytes_transferred // Number of bytes written. + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @note The `async_write_some` operation may not transmit all of the data to + the peer. Consider using the function `net::async_write` if you need + to ensure that all data is written before the asynchronous operation completes. + */ + template< + class ConstBufferSequence, + WEBCPP_ASIO_BACKEND_COMPLETION_TOKEN_FOR(void(error_code, std::size_t)) WriteHandler + WEBCPP_ASIO_BACKEND_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> + WEBCPP_ASIO_BACKEND_INITFN_AUTO_RESULT_TYPE(WriteHandler, void(error_code, std::size_t)) + async_write_some( + ConstBufferSequence const& buffers, + WriteHandler&& handler WEBCPP_ASIO_BACKEND_DEFAULT_COMPLETION_TOKEN(executor_type) + ); + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + friend + void + teardown<>( + role_type, + basic_stream& s, + boost::system::error_code& ec); + + template + friend + void + async_teardown( + role_type role, + basic_stream& s, + TeardownHandler&& handler); +#endif +}; + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN +template +void +beast_close_socket(basic_stream& s) +{ + s.close(); +} +#endif + +#if WEBCPP_BEAST_BACKEND_DOXYGEN +/** Return a new stream connected to the given stream + + @param to The stream to connect to. + + @param args Optional arguments forwarded to the new stream's constructor. + + @return The new, connected stream. +*/ +template +template +basic_stream +connect(basic_stream& to, Args&&... args); + +#else +template +basic_stream +connect(basic_stream& to); + +template +void +connect(basic_stream& s1, basic_stream& s2); + +template +basic_stream +connect(basic_stream& to, Arg1&& arg1, ArgN&&... argn); +#endif + +using stream = basic_stream<>; + +} // test +} // beast +} // boost + +#include +//#ifdef WEBCPP_BEAST_BACKEND_HEADER_ONLY +#include +//#endif + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/test/tcp.hpp b/include/webcpp/beast/detail/backend/_experimental/test/tcp.hpp new file mode 100644 index 0000000..9f0cb0b --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/test/tcp.hpp @@ -0,0 +1,77 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_TEST_TCP_HPP +#define WEBCPP_BEAST_BACKEND_TEST_TCP_HPP + +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace test { + +/** Connect two TCP sockets together. +*/ +template +bool +connect( + net::basic_stream_socket& s1, + net::basic_stream_socket& s2) + +{ + auto ioc1 = ::webcpp::beast_backend::detail::get_io_context(s1); + auto ioc2 = ::webcpp::beast_backend::detail::get_io_context(s2); + if(! BEAST_EXPECT(ioc1 != nullptr)) + return false; + if(! BEAST_EXPECT(ioc2 != nullptr)) + return false; + if(! BEAST_EXPECT(ioc1 == ioc2)) + return false; + auto& ioc = *ioc1; + try + { + net::basic_socket_acceptor< + net::ip::tcp, Executor> a(s1.get_executor()); + auto ep = net::ip::tcp::endpoint( + net::ip::make_address_v4("127.0.0.1"), 0); + a.open(ep.protocol()); + a.set_option( + net::socket_base::reuse_address(true)); + a.bind(ep); + a.listen(0); + ep = a.local_endpoint(); + a.async_accept(s2, test::success_handler()); + s1.async_connect(ep, test::success_handler()); + run(ioc); + if(! BEAST_EXPECT( + s1.remote_endpoint() == s2.local_endpoint())) + return false; + if(! BEAST_EXPECT( + s2.remote_endpoint() == s1.local_endpoint())) + return false; + } + catch(std::exception const& e) + { + ::webcpp::beast_backend::unit_test::suite::this_suite()->fail( + e.what(), __FILE__, __LINE__); + return false; + } + return true; +} + +} // test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/amount.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/amount.hpp new file mode 100644 index 0000000..1fc24a1 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/amount.hpp @@ -0,0 +1,59 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_AMOUNT_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_AMOUNT_HPP + +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +/** Utility for producing nicely composed output of amounts with units. */ +class amount +{ +private: + std::size_t n_; + std::string const& what_; + +public: + amount(amount const&) = default; + amount& operator=(amount const&) = delete; + + template + amount(std::size_t n, std::string const& what); + + friend + std::ostream& + operator<<(std::ostream& s, amount const& t); +}; + +template +amount::amount(std::size_t n, std::string const& what) + : n_(n) + , what_(what) +{ +} + +inline +std::ostream& +operator<<(std::ostream& s, amount const& t) +{ + s << t.n_ << " " << t.what_ <<((t.n_ != 1) ? "s" : ""); + return s; +} + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/detail/const_container.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/detail/const_container.hpp new file mode 100644 index 0000000..8b5c6e6 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/detail/const_container.hpp @@ -0,0 +1,95 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP + +namespace webcpp { namespace beast_backend { +namespace unit_test { +namespace detail { + +/** Adapter to constrain a container interface. + The interface allows for limited read only operations. Derived classes + provide additional behavior. +*/ +template +class const_container +{ +private: + using cont_type = Container; + + cont_type m_cont; + +protected: + cont_type& cont() + { + return m_cont; + } + + cont_type const& cont() const + { + return m_cont; + } + +public: + using value_type = typename cont_type::value_type; + using size_type = typename cont_type::size_type; + using difference_type = typename cont_type::difference_type; + using iterator = typename cont_type::const_iterator; + using const_iterator = typename cont_type::const_iterator; + + /** Returns `true` if the container is empty. */ + bool + empty() const + { + return m_cont.empty(); + } + + /** Returns the number of items in the container. */ + size_type + size() const + { + return m_cont.size(); + } + + /** Returns forward iterators for traversal. */ + /** @{ */ + const_iterator + begin() const + { + return m_cont.cbegin(); + } + + const_iterator + cbegin() const + { + return m_cont.cbegin(); + } + + const_iterator + end() const + { + return m_cont.cend(); + } + + const_iterator + cend() const + { + return m_cont.cend(); + } + /** @} */ +}; + +} // detail +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/dstream.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/dstream.hpp new file mode 100644 index 0000000..11dae33 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/dstream.hpp @@ -0,0 +1,131 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_DSTREAM_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_DSTREAM_HPP + +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_WINDOWS +#include +#include +#endif + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +#ifdef BOOST_WINDOWS + +namespace detail { + +template +class dstream_buf + : public std::basic_stringbuf +{ + using ostream = std::basic_ostream; + + ostream& os_; + bool dbg_; + + template + void write(T const*) = delete; + + void write(char const* s) + { + if(dbg_) + boost::winapi::OutputDebugStringA(s); + os_ << s; + } + + void write(wchar_t const* s) + { + if(dbg_) + boost::winapi::OutputDebugStringW(s); + os_ << s; + } + +public: + explicit + dstream_buf(ostream& os) + : os_(os) + , dbg_(boost::winapi::IsDebuggerPresent() != 0) + { + } + + ~dstream_buf() + { + sync(); + } + + int + sync() override + { + write(this->str().c_str()); + this->str(""); + return 0; + } +}; + +} // detail + +/** std::ostream with Visual Studio IDE redirection. + + Instances of this stream wrap a specified `std::ostream` + (such as `std::cout` or `std::cerr`). If the IDE debugger + is attached when the stream is created, output will be + additionally copied to the Visual Studio Output window. +*/ +template< + class CharT, + class Traits = std::char_traits, + class Allocator = std::allocator +> +class basic_dstream + : public std::basic_ostream +{ + detail::dstream_buf< + CharT, Traits, Allocator> buf_; + +public: + /** Construct a stream. + + @param os The output stream to wrap. + */ + explicit + basic_dstream(std::ostream& os) + : std::basic_ostream(&buf_) + , buf_(os) + { + if(os.flags() & std::ios::unitbuf) + std::unitbuf(*this); + } +}; + +using dstream = basic_dstream; +using dwstream = basic_dstream; + +#else + +using dstream = std::ostream&; +using dwstream = std::wostream&; + +#endif + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/global_suites.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/global_suites.hpp new file mode 100644 index 0000000..d79572f --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/global_suites.hpp @@ -0,0 +1,55 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_GLOBAL_SUITES_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_GLOBAL_SUITES_HPP + +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +namespace detail { + +/// Holds test suites registered during static initialization. +inline +suite_list& +global_suites() +{ + static suite_list s; + return s; +} + +template +struct insert_suite +{ + insert_suite(char const* name, char const* module, + char const* library, bool manual) + { + global_suites().insert( + name, module, library, manual); + } +}; + +} // detail + +/// Holds test suites registered during static initialization. +inline +suite_list const& +global_suites() +{ + return detail::global_suites(); +} + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/main.ipp b/include/webcpp/beast/detail/backend/_experimental/unit_test/main.ipp new file mode 100644 index 0000000..be3ee83 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/main.ipp @@ -0,0 +1,88 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_MSVC +# ifndef WIN32_LEAN_AND_MEAN // VC_EXTRALEAN +# define WIN32_LEAN_AND_MEAN +# include +# undef WIN32_LEAN_AND_MEAN +# else +# include +# endif +#endif + +// Simple main used to produce stand +// alone executables that run unit tests. +int main(int ac, char const* av[]) +{ + using namespace std; + using namespace webcpp::beast_backend::unit_test; + + dstream log(std::cerr); + std::unitbuf(log); + +#ifdef BOOST_MSVC + { + int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + flags |= _CRTDBG_LEAK_CHECK_DF; + _CrtSetDbgFlag(flags); + } +#endif + + if(ac == 2) + { + std::string const s{av[1]}; + if(s == "-h" || s == "--help") + { + log << + "Usage:\n" + " " << av[0] << ": { ... }" << + std::endl; + return EXIT_SUCCESS; + } + } + + reporter r(log); + bool failed; + if(ac > 1) + { + std::vector v; + v.reserve(ac - 1); + for(int i = 1; i < ac; ++i) + v.emplace_back(selector::automatch, av[i]); + auto pred = + [&v](suite_info const& si) mutable + { + for(auto& p : v) + if(p(si)) + return true; + return false; + }; + failed = r.run_each_if(global_suites(), pred); + } + else + { + failed = r.run_each(global_suites()); + } + if(failed) + return EXIT_FAILURE; + return EXIT_SUCCESS; +} diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/match.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/match.hpp new file mode 100644 index 0000000..5b1c3cc --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/match.hpp @@ -0,0 +1,176 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_MATCH_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_MATCH_HPP + +#include +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +// Predicate for implementing matches +class selector +{ +public: + enum mode_t + { + // Run all tests except manual ones + all, + + // Run tests that match in any field + automatch, + + // Match on suite + suite, + + // Match on library + library, + + // Match on module (used internally) + module, + + // Match nothing (used internally) + none + }; + +private: + mode_t mode_; + std::string pat_; + std::string library_; + +public: + template + explicit + selector(mode_t mode, std::string const& pattern = ""); + + template + bool + operator()(suite_info const& s); +}; + +//------------------------------------------------------------------------------ + +template +selector::selector(mode_t mode, std::string const& pattern) + : mode_(mode) + , pat_(pattern) +{ + if(mode_ == automatch && pattern.empty()) + mode_ = all; +} + +template +bool +selector::operator()(suite_info const& s) +{ + switch(mode_) + { + case automatch: + // suite or full name + if(s.name() == pat_ || s.full_name() == pat_) + { + mode_ = none; + return true; + } + + // check module + if(pat_ == s.module()) + { + mode_ = module; + library_ = s.library(); + return ! s.manual(); + } + + // check library + if(pat_ == s.library()) + { + mode_ = library; + return ! s.manual(); + } + + return false; + + case suite: + return pat_ == s.name(); + + case module: + return pat_ == s.module() && ! s.manual(); + + case library: + return pat_ == s.library() && ! s.manual(); + + case none: + return false; + + case all: + default: + break; + }; + + return ! s.manual(); +} + +//------------------------------------------------------------------------------ + +// Utility functions for producing predicates to select suites. + +/** Returns a predicate that implements a smart matching rule. + The predicate checks the suite, module, and library fields of the + suite_info in that order. When it finds a match, it changes modes + depending on what was found: + + If a suite is matched first, then only the suite is selected. The + suite may be marked manual. + + If a module is matched first, then only suites from that module + and library not marked manual are selected from then on. + + If a library is matched first, then only suites from that library + not marked manual are selected from then on. + +*/ +inline +selector +match_auto(std::string const& name) +{ + return selector(selector::automatch, name); +} + +/** Return a predicate that matches all suites not marked manual. */ +inline +selector +match_all() +{ + return selector(selector::all); +} + +/** Returns a predicate that matches a specific suite. */ +inline +selector +match_suite(std::string const& name) +{ + return selector(selector::suite, name); +} + +/** Returns a predicate that matches all suites in a library. */ +inline +selector +match_library(std::string const& name) +{ + return selector(selector::library, name); +} + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/recorder.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/recorder.hpp new file mode 100644 index 0000000..2d279de --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/recorder.hpp @@ -0,0 +1,93 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_RECORDER_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_RECORDER_HPP + +#include +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +/** A test runner that stores the results. */ +class recorder : public runner +{ + results m_results; + suite_results m_suite; + case_results m_case; + +public: + recorder() = default; + + /** Returns a report with the results of all completed suites. */ + results const& + report() const + { + return m_results; + } + +private: + virtual + void + on_suite_begin(suite_info const& info) override + { + m_suite = suite_results(info.full_name()); + } + + virtual + void + on_suite_end() override + { + m_results.insert(std::move(m_suite)); + } + + virtual + void + on_case_begin(std::string const& name) override + { + m_case = case_results(name); + } + + virtual + void + on_case_end() override + { + if(m_case.tests.size() > 0) + m_suite.insert(std::move(m_case)); + } + + virtual + void + on_pass() override + { + m_case.tests.pass(); + } + + virtual + void + on_fail(std::string const& reason) override + { + m_case.tests.fail(reason); + } + + virtual + void + on_log(std::string const& s) override + { + m_case.log.insert(s); + } +}; + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/reporter.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/reporter.hpp new file mode 100644 index 0000000..bbef123 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/reporter.hpp @@ -0,0 +1,292 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_REPORTER_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_REPORTER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +namespace detail { + +/** A simple test runner that writes everything to a stream in real time. + The totals are output when the object is destroyed. +*/ +template +class reporter : public runner +{ +private: + using clock_type = std::chrono::steady_clock; + + struct case_results + { + std::string name; + std::size_t total = 0; + std::size_t failed = 0; + + explicit + case_results(std::string name_ = "") + : name(std::move(name_)) + { + } + }; + + struct suite_results + { + std::string name; + std::size_t cases = 0; + std::size_t total = 0; + std::size_t failed = 0; + typename clock_type::time_point start = clock_type::now(); + + explicit + suite_results(std::string name_ = "") + : name(std::move(name_)) + { + } + + void + add(case_results const& r); + }; + + struct results + { + using run_time = std::pair; + + enum + { + max_top = 10 + }; + + std::size_t suites = 0; + std::size_t cases = 0; + std::size_t total = 0; + std::size_t failed = 0; + std::vector top; + typename clock_type::time_point start = clock_type::now(); + + void + add(suite_results const& r); + }; + + std::ostream& os_; + results results_; + suite_results suite_results_; + case_results case_results_; + +public: + reporter(reporter const&) = delete; + reporter& operator=(reporter const&) = delete; + + ~reporter(); + + explicit + reporter(std::ostream& os = std::cout); + +private: + static + std::string + fmtdur(typename clock_type::duration const& d); + + virtual + void + on_suite_begin(suite_info const& info) override; + + virtual + void + on_suite_end() override; + + virtual + void + on_case_begin(std::string const& name) override; + + virtual + void + on_case_end() override; + + virtual + void + on_pass() override; + + virtual + void + on_fail(std::string const& reason) override; + + virtual + void + on_log(std::string const& s) override; +}; + +//------------------------------------------------------------------------------ + +template +void +reporter<_>:: +suite_results::add(case_results const& r) +{ + ++cases; + total += r.total; + failed += r.failed; +} + +template +void +reporter<_>:: +results::add(suite_results const& r) +{ + ++suites; + total += r.total; + cases += r.cases; + failed += r.failed; + auto const elapsed = clock_type::now() - r.start; + if(elapsed >= std::chrono::seconds{1}) + { + auto const iter = std::lower_bound(top.begin(), + top.end(), elapsed, + [](run_time const& t1, + typename clock_type::duration const& t2) + { + return t1.second > t2; + }); + if(iter != top.end()) + { + top.emplace(iter, r.name, elapsed); + if(top.size() > max_top) + top.resize(max_top); + } + } +} + +//------------------------------------------------------------------------------ + +template +reporter<_>:: +reporter(std::ostream& os) + : os_(os) +{ +} + +template +reporter<_>::~reporter() +{ + if(results_.top.size() > 0) + { + os_ << "Longest suite times:\n"; + for(auto const& i : results_.top) + os_ << std::setw(8) << + fmtdur(i.second) << " " << i.first << '\n'; + } + auto const elapsed = clock_type::now() - results_.start; + os_ << + fmtdur(elapsed) << ", " << + amount{results_.suites, "suite"} << ", " << + amount{results_.cases, "case"} << ", " << + amount{results_.total, "test"} << " total, " << + amount{results_.failed, "failure"} << + std::endl; +} + +template +std::string +reporter<_>::fmtdur(typename clock_type::duration const& d) +{ + using namespace std::chrono; + auto const ms = duration_cast(d); + if(ms < seconds{1}) + return std::to_string(ms.count()) + "ms"; + std::stringstream ss; + ss << std::fixed << std::setprecision(1) << + (ms.count()/1000.) << "s"; + return ss.str(); +} + +template +void +reporter<_>:: +on_suite_begin(suite_info const& info) +{ + suite_results_ = suite_results{info.full_name()}; +} + +template +void +reporter<_>::on_suite_end() +{ + results_.add(suite_results_); +} + +template +void +reporter<_>:: +on_case_begin(std::string const& name) +{ + case_results_ = case_results(name); + os_ << suite_results_.name << + (case_results_.name.empty() ? "" : + (" " + case_results_.name)) << std::endl; +} + +template +void +reporter<_>:: +on_case_end() +{ + suite_results_.add(case_results_); +} + +template +void +reporter<_>:: +on_pass() +{ + ++case_results_.total; +} + +template +void +reporter<_>:: +on_fail(std::string const& reason) +{ + ++case_results_.failed; + ++case_results_.total; + os_ << + "#" << case_results_.total << " failed" << + (reason.empty() ? "" : ": ") << reason << std::endl; +} + +template +void +reporter<_>:: +on_log(std::string const& s) +{ + os_ << s; +} + +} // detail + +using reporter = detail::reporter<>; + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/results.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/results.hpp new file mode 100644 index 0000000..ad8ca55 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/results.hpp @@ -0,0 +1,246 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_RESULTS_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_RESULTS_HPP + +#include + +#include +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +/** Holds a set of test condition outcomes in a testcase. */ +class case_results +{ +public: + /** Holds the result of evaluating one test condition. */ + struct test + { + explicit test(bool pass_) + : pass(pass_) + { + } + + test(bool pass_, std::string const& reason_) + : pass(pass_) + , reason(reason_) + { + } + + bool pass; + std::string reason; + }; + +private: + class tests_t + : public detail::const_container > + { + private: + std::size_t failed_; + + public: + tests_t() + : failed_(0) + { + } + + /** Returns the total number of test conditions. */ + std::size_t + total() const + { + return cont().size(); + } + + /** Returns the number of failed test conditions. */ + std::size_t + failed() const + { + return failed_; + } + + /** Register a successful test condition. */ + void + pass() + { + cont().emplace_back(true); + } + + /** Register a failed test condition. */ + void + fail(std::string const& reason = "") + { + ++failed_; + cont().emplace_back(false, reason); + } + }; + + class log_t + : public detail::const_container > + { + public: + /** Insert a string into the log. */ + void + insert(std::string const& s) + { + cont().push_back(s); + } + }; + + std::string name_; + +public: + explicit case_results(std::string const& name = "") + : name_(name) + { + } + + /** Returns the name of this testcase. */ + std::string const& + name() const + { + return name_; + } + + /** Memberspace for a container of test condition outcomes. */ + tests_t tests; + + /** Memberspace for a container of testcase log messages. */ + log_t log; +}; + +//-------------------------------------------------------------------------- + +/** Holds the set of testcase results in a suite. */ +class suite_results + : public detail::const_container > +{ +private: + std::string name_; + std::size_t total_ = 0; + std::size_t failed_ = 0; + +public: + explicit suite_results(std::string const& name = "") + : name_(name) + { + } + + /** Returns the name of this suite. */ + std::string const& + name() const + { + return name_; + } + + /** Returns the total number of test conditions. */ + std::size_t + total() const + { + return total_; + } + + /** Returns the number of failures. */ + std::size_t + failed() const + { + return failed_; + } + + /** Insert a set of testcase results. */ + /** @{ */ + void + insert(case_results&& r) + { + cont().emplace_back(std::move(r)); + total_ += r.tests.total(); + failed_ += r.tests.failed(); + } + + void + insert(case_results const& r) + { + cont().push_back(r); + total_ += r.tests.total(); + failed_ += r.tests.failed(); + } + /** @} */ +}; + +//------------------------------------------------------------------------------ + +// VFALCO TODO Make this a template class using scoped allocators +/** Holds the results of running a set of testsuites. */ +class results + : public detail::const_container > +{ +private: + std::size_t m_cases; + std::size_t total_; + std::size_t failed_; + +public: + results() + : m_cases(0) + , total_(0) + , failed_(0) + { + } + + /** Returns the total number of test cases. */ + std::size_t + cases() const + { + return m_cases; + } + + /** Returns the total number of test conditions. */ + std::size_t + total() const + { + return total_; + } + + /** Returns the number of failures. */ + std::size_t + failed() const + { + return failed_; + } + + /** Insert a set of suite results. */ + /** @{ */ + void + insert(suite_results&& r) + { + m_cases += r.size(); + total_ += r.total(); + failed_ += r.failed(); + cont().emplace_back(std::move(r)); + } + + void + insert(suite_results const& r) + { + m_cases += r.size(); + total_ += r.total(); + failed_ += r.failed(); + cont().push_back(r); + } + /** @} */ +}; + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/runner.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/runner.hpp new file mode 100644 index 0000000..26169a2 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/runner.hpp @@ -0,0 +1,292 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_RUNNER_H_INCLUDED +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_RUNNER_H_INCLUDED + +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +/** Unit test runner interface. + + Derived classes can customize the reporting behavior. This interface is + injected into the unit_test class to receive the results of the tests. +*/ +class runner +{ + std::string arg_; + bool default_ = false; + bool failed_ = false; + bool cond_ = false; + std::recursive_mutex mutex_; + +public: + runner() = default; + virtual ~runner() = default; + runner(runner const&) = delete; + runner& operator=(runner const&) = delete; + + /** Set the argument string. + + The argument string is available to suites and + allows for customization of the test. Each suite + defines its own syntax for the argument string. + The same argument is passed to all suites. + */ + void + arg(std::string const& s) + { + arg_ = s; + } + + /** Returns the argument string. */ + std::string const& + arg() const + { + return arg_; + } + + /** Run the specified suite. + @return `true` if any conditions failed. + */ + template + bool + run(suite_info const& s); + + /** Run a sequence of suites. + The expression + `FwdIter::value_type` + must be convertible to `suite_info`. + @return `true` if any conditions failed. + */ + template + bool + run(FwdIter first, FwdIter last); + + /** Conditionally run a sequence of suites. + pred will be called as: + @code + bool pred(suite_info const&); + @endcode + @return `true` if any conditions failed. + */ + template + bool + run_if(FwdIter first, FwdIter last, Pred pred = Pred{}); + + /** Run all suites in a container. + @return `true` if any conditions failed. + */ + template + bool + run_each(SequenceContainer const& c); + + /** Conditionally run suites in a container. + pred will be called as: + @code + bool pred(suite_info const&); + @endcode + @return `true` if any conditions failed. + */ + template + bool + run_each_if(SequenceContainer const& c, Pred pred = Pred{}); + +protected: + /// Called when a new suite starts. + virtual + void + on_suite_begin(suite_info const&) + { + } + + /// Called when a suite ends. + virtual + void + on_suite_end() + { + } + + /// Called when a new case starts. + virtual + void + on_case_begin(std::string const&) + { + } + + /// Called when a new case ends. + virtual + void + on_case_end() + { + } + + /// Called for each passing condition. + virtual + void + on_pass() + { + } + + /// Called for each failing condition. + virtual + void + on_fail(std::string const&) + { + } + + /// Called when a test logs output. + virtual + void + on_log(std::string const&) + { + } + +private: + friend class suite; + + // Start a new testcase. + template + void + testcase(std::string const& name); + + template + void + pass(); + + template + void + fail(std::string const& reason); + + template + void + log(std::string const& s); +}; + +//------------------------------------------------------------------------------ + +template +bool +runner::run(suite_info const& s) +{ + // Enable 'default' testcase + default_ = true; + failed_ = false; + on_suite_begin(s); + s.run(*this); + // Forgot to call pass or fail. + BOOST_ASSERT(cond_); + on_case_end(); + on_suite_end(); + return failed_; +} + +template +bool +runner::run(FwdIter first, FwdIter last) +{ + bool failed(false); + for(;first != last; ++first) + failed = run(*first) || failed; + return failed; +} + +template +bool +runner::run_if(FwdIter first, FwdIter last, Pred pred) +{ + bool failed(false); + for(;first != last; ++first) + if(pred(*first)) + failed = run(*first) || failed; + return failed; +} + +template +bool +runner::run_each(SequenceContainer const& c) +{ + bool failed(false); + for(auto const& s : c) + failed = run(s) || failed; + return failed; +} + +template +bool +runner::run_each_if(SequenceContainer const& c, Pred pred) +{ + bool failed(false); + for(auto const& s : c) + if(pred(s)) + failed = run(s) || failed; + return failed; +} + +template +void +runner::testcase(std::string const& name) +{ + std::lock_guard lock(mutex_); + // Name may not be empty + BOOST_ASSERT(default_ || ! name.empty()); + // Forgot to call pass or fail + BOOST_ASSERT(default_ || cond_); + if(! default_) + on_case_end(); + default_ = false; + cond_ = false; + on_case_begin(name); +} + +template +void +runner::pass() +{ + std::lock_guard lock(mutex_); + if(default_) + testcase(""); + on_pass(); + cond_ = true; +} + +template +void +runner::fail(std::string const& reason) +{ + std::lock_guard lock(mutex_); + if(default_) + testcase(""); + on_fail(reason); + failed_ = true; + cond_ = true; +} + +template +void +runner::log(std::string const& s) +{ + std::lock_guard lock(mutex_); + if(default_) + testcase(""); + on_log(s); +} + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/suite.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/suite.hpp new file mode 100644 index 0000000..8957c37 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/suite.hpp @@ -0,0 +1,745 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_SUITE_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_SUITE_HPP + +#include +#include +#include +#include +#include + +#if defined(BOOST_GCC) && BOOST_GCC >= 70000 && BOOST_GCC < 80000 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnoexcept-type" +#endif + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +namespace detail { + +template +std::string +make_reason(String const& reason, + char const* file, int line) +{ + std::string s(reason); + if(! s.empty()) + s.append(": "); + char const* path = file + strlen(file); + while(path != file) + { + #ifdef _MSC_VER + if(path[-1] == '\\') + #else + if(path[-1] == '/') + #endif + break; + --path; + } + s.append(path); + s.append("("); + s.append(std::to_string(line)); + s.append(")"); + return s; +} + +} // detail + +class thread; + +enum abort_t +{ + no_abort_on_fail, + abort_on_fail +}; + +/** A testsuite class. + + Derived classes execute a series of testcases, where each testcase is + a series of pass/fail tests. To provide a unit test using this class, + derive from it and use the WEBCPP_BEAST_BACKEND_DEFINE_UNIT_TEST macro in a + translation unit. +*/ +class suite +{ +private: + bool abort_ = false; + bool aborted_ = false; + runner* runner_ = nullptr; + + // This exception is thrown internally to stop the current suite + // in the event of a failure, if the option to stop is set. + struct abort_exception : public std::exception + { + char const* + what() const noexcept override + { + return "test suite aborted"; + } + }; + + template + class log_buf + : public std::basic_stringbuf + { + suite& suite_; + + public: + explicit + log_buf(suite& self) + : suite_(self) + { + } + + ~log_buf() + { + sync(); + } + + int + sync() override + { + auto const& s = this->str(); + if(s.size() > 0) + suite_.runner_->log(s); + this->str(""); + return 0; + } + }; + + template< + class CharT, + class Traits = std::char_traits, + class Allocator = std::allocator + > + class log_os : public std::basic_ostream + { + log_buf buf_; + + public: + explicit + log_os(suite& self) + : std::basic_ostream(&buf_) + , buf_(self) + { + } + }; + + class scoped_testcase; + + class testcase_t + { + suite& suite_; + std::stringstream ss_; + + public: + explicit + testcase_t(suite& self) + : suite_(self) + { + } + + /** Open a new testcase. + + A testcase is a series of evaluated test conditions. A test + suite may have multiple test cases. A test is associated with + the last opened testcase. When the test first runs, a default + unnamed case is opened. Tests with only one case may omit the + call to testcase. + + @param abort Determines if suite continues running after a failure. + */ + void + operator()(std::string const& name, + abort_t abort = no_abort_on_fail); + + scoped_testcase + operator()(abort_t abort); + + template + scoped_testcase + operator<<(T const& t); + }; + +public: + /** Logging output stream. + + Text sent to the log output stream will be forwarded to + the output stream associated with the runner. + */ + log_os log; + + /** Memberspace for declaring test cases. */ + testcase_t testcase; + + /** Returns the "current" running suite. + If no suite is running, nullptr is returned. + */ + static + suite* + this_suite() + { + return *p_this_suite(); + } + + suite() + : log(*this) + , testcase(*this) + { + } + + virtual ~suite() = default; + suite(suite const&) = delete; + suite& operator=(suite const&) = delete; + + /** Invokes the test using the specified runner. + + Data members are set up here instead of the constructor as a + convenience to writing the derived class to avoid repetition of + forwarded constructor arguments to the base. + Normally this is called by the framework for you. + */ + template + void + operator()(runner& r); + + /** Record a successful test condition. */ + template + void + pass(); + + /** Record a failure. + + @param reason Optional text added to the output on a failure. + + @param file The source code file where the test failed. + + @param line The source code line number where the test failed. + */ + /** @{ */ + template + void + fail(String const& reason, char const* file, int line); + + template + void + fail(std::string const& reason = ""); + /** @} */ + + /** Evaluate a test condition. + + This function provides improved logging by incorporating the + file name and line number into the reported output on failure, + as well as additional text specified by the caller. + + @param shouldBeTrue The condition to test. The condition + is evaluated in a boolean context. + + @param reason Optional added text to output on a failure. + + @param file The source code file where the test failed. + + @param line The source code line number where the test failed. + + @return `true` if the test condition indicates success. + */ + /** @{ */ + template + bool + expect(Condition const& shouldBeTrue) + { + return expect(shouldBeTrue, ""); + } + + template + bool + expect(Condition const& shouldBeTrue, String const& reason); + + template + bool + expect(Condition const& shouldBeTrue, + char const* file, int line) + { + return expect(shouldBeTrue, "", file, line); + } + + template + bool + expect(Condition const& shouldBeTrue, + String const& reason, char const* file, int line); + /** @} */ + + // + // DEPRECATED + // + // Expect an exception from f() + template + bool + except(F&& f, String const& reason); + template + bool + except(F&& f) + { + return except(f, ""); + } + template + bool + except(F&& f, String const& reason); + template + bool + except(F&& f) + { + return except(f, ""); + } + template + bool + unexcept(F&& f, String const& reason); + template + bool + unexcept(F&& f) + { + return unexcept(f, ""); + } + + /** Return the argument associated with the runner. */ + std::string const& + arg() const + { + return runner_->arg(); + } + + // DEPRECATED + // @return `true` if the test condition indicates success(a false value) + template + bool + unexpected(Condition shouldBeFalse, + String const& reason); + + template + bool + unexpected(Condition shouldBeFalse) + { + return unexpected(shouldBeFalse, ""); + } + +private: + friend class thread; + + static + suite** + p_this_suite() + { + static suite* pts = nullptr; + return &pts; + } + + /** Runs the suite. */ + virtual + void + run() = 0; + + void + propagate_abort(); + + template + void + run(runner& r); +}; + +//------------------------------------------------------------------------------ + +// Helper for streaming testcase names +class suite::scoped_testcase +{ +private: + suite& suite_; + std::stringstream& ss_; + +public: + scoped_testcase& operator=(scoped_testcase const&) = delete; + + ~scoped_testcase() + { + auto const& name = ss_.str(); + if(! name.empty()) + suite_.runner_->testcase(name); + } + + scoped_testcase(suite& self, std::stringstream& ss) + : suite_(self) + , ss_(ss) + { + ss_.clear(); + ss_.str({}); + } + + template + scoped_testcase(suite& self, + std::stringstream& ss, T const& t) + : suite_(self) + , ss_(ss) + { + ss_.clear(); + ss_.str({}); + ss_ << t; + } + + template + scoped_testcase& + operator<<(T const& t) + { + ss_ << t; + return *this; + } +}; + +//------------------------------------------------------------------------------ + +inline +void +suite::testcase_t::operator()( + std::string const& name, abort_t abort) +{ + suite_.abort_ = abort == abort_on_fail; + suite_.runner_->testcase(name); +} + +inline +suite::scoped_testcase +suite::testcase_t::operator()(abort_t abort) +{ + suite_.abort_ = abort == abort_on_fail; + return { suite_, ss_ }; +} + +template +inline +suite::scoped_testcase +suite::testcase_t::operator<<(T const& t) +{ + return { suite_, ss_, t }; +} + +//------------------------------------------------------------------------------ + +template +void +suite:: +operator()(runner& r) +{ + *p_this_suite() = this; + try + { + run(r); + *p_this_suite() = nullptr; + } + catch(...) + { + *p_this_suite() = nullptr; + throw; + } +} + +template +bool +suite:: +expect( + Condition const& shouldBeTrue, String const& reason) +{ + if(shouldBeTrue) + { + pass(); + return true; + } + fail(reason); + return false; +} + +template +bool +suite:: +expect(Condition const& shouldBeTrue, + String const& reason, char const* file, int line) +{ + if(shouldBeTrue) + { + pass(); + return true; + } + fail(detail::make_reason(reason, file, line)); + return false; +} + +// DEPRECATED + +template +bool +suite:: +except(F&& f, String const& reason) +{ + try + { + f(); + fail(reason); + return false; + } + catch(...) + { + pass(); + } + return true; +} + +template +bool +suite:: +except(F&& f, String const& reason) +{ + try + { + f(); + fail(reason); + return false; + } + catch(E const&) + { + pass(); + } + return true; +} + +template +bool +suite:: +unexcept(F&& f, String const& reason) +{ + try + { + f(); + pass(); + return true; + } + catch(...) + { + fail(reason); + } + return false; +} + +template +bool +suite:: +unexpected( + Condition shouldBeFalse, String const& reason) +{ + bool const b = + static_cast(shouldBeFalse); + if(! b) + pass(); + else + fail(reason); + return ! b; +} + +template +void +suite:: +pass() +{ + propagate_abort(); + runner_->pass(); +} + +// ::fail +template +void +suite:: +fail(std::string const& reason) +{ + propagate_abort(); + runner_->fail(reason); + if(abort_) + { + aborted_ = true; + BOOST_THROW_EXCEPTION(abort_exception()); + } +} + +template +void +suite:: +fail(String const& reason, char const* file, int line) +{ + fail(detail::make_reason(reason, file, line)); +} + +inline +void +suite:: +propagate_abort() +{ + if(abort_ && aborted_) + BOOST_THROW_EXCEPTION(abort_exception()); +} + +template +void +suite:: +run(runner& r) +{ + runner_ = &r; + + try + { + run(); + } + catch(abort_exception const&) + { + // ends the suite + } + catch(std::exception const& e) + { + runner_->fail("unhandled exception: " + + std::string(e.what())); + } + catch(...) + { + runner_->fail("unhandled exception"); + } +} + +#ifndef BEAST_PASS +#define BEAST_PASS() ::webcpp::beast_backend::unit_test::suite::this_suite()->pass() +#endif + +#ifndef BEAST_FAIL +#define BEAST_FAIL() ::webcpp::beast_backend::unit_test::suite::this_suite()->fail("", __FILE__, __LINE__) +#endif + +#ifndef BEAST_EXPECT +/** Check a precondition. + + If the condition is false, the file and line number are reported. +*/ +#define BEAST_EXPECT(cond) ::webcpp::beast_backend::unit_test::suite::this_suite()->expect(cond, __FILE__, __LINE__) +#endif + +#ifndef BEAST_EXPECTS +/** Check a precondition. + + If the condition is false, the file and line number are reported. +*/ +#define BEAST_EXPECTS(cond, reason) ((cond) ? \ + (::webcpp::beast_backend::unit_test::suite::this_suite()->pass(), true) : \ + (::webcpp::beast_backend::unit_test::suite::this_suite()->fail((reason), __FILE__, __LINE__), false)) +#endif + +/** Ensure an exception is thrown +*/ +#define BEAST_THROWS( EXPR, EXCEP ) \ + try { \ + EXPR; \ + BEAST_FAIL(); \ + } \ + catch(EXCEP const&) { \ + BEAST_PASS(); \ + } \ + catch(...) { \ + BEAST_FAIL(); \ + } + +/** Ensure an exception is not thrown +*/ +#define BEAST_NO_THROW( EXPR ) \ + try { \ + EXPR; \ + BEAST_PASS(); \ + } \ + catch(...) { \ + BEAST_FAIL(); \ + } + +} // unit_test +} // beast +} // boost + +//------------------------------------------------------------------------------ + +// detail: +// This inserts the suite with the given manual flag +#define BEAST_DEFINE_TESTSUITE_INSERT(Library,Module,Class,manual) \ + static ::webcpp::beast_backend::unit_test::detail::insert_suite \ + Library ## Module ## Class ## _test_instance( \ + #Class, #Module, #Library, manual) + +//------------------------------------------------------------------------------ + +// Preprocessor directives for controlling unit test definitions. + +// If this is already defined, don't redefine it. This allows +// programs to provide custom behavior for testsuite definitions +// +#ifndef BEAST_DEFINE_TESTSUITE + +/** Enables insertion of test suites into the global container. + The default is to insert all test suite definitions into the global + container. If BEAST_DEFINE_TESTSUITE is user defined, this macro + has no effect. +*/ +#ifndef BEAST_NO_UNIT_TEST_INLINE +#define BEAST_NO_UNIT_TEST_INLINE 0 +#endif + +/** Define a unit test suite. + + Library Identifies the library. + Module Identifies the module. + Class The type representing the class being tested. + + The declaration for the class implementing the test should be the same + as Class ## _test. For example, if Class is aged_ordered_container, the + test class must be declared as: + + @code + + struct aged_ordered_container_test : ::webcpp::beast_backend::unit_test::suite + { + //... + }; + + @endcode + + The macro invocation must appear in the same namespace as the test class. +*/ + +#if BEAST_NO_UNIT_TEST_INLINE +#define BEAST_DEFINE_TESTSUITE(Class,Module,Library) + +#else +#include +#define BEAST_DEFINE_TESTSUITE(Library,Module,Class) \ + BEAST_DEFINE_TESTSUITE_INSERT(Library,Module,Class,false) +#define BEAST_DEFINE_TESTSUITE_MANUAL(Library,Module,Class) \ + BEAST_DEFINE_TESTSUITE_INSERT(Library,Module,Class,true) + +#endif + +#endif + +#if defined(BOOST_GCC) && BOOST_GCC >= 70000 && BOOST_GCC < 80000 +#pragma GCC diagnostic pop +#endif + +//------------------------------------------------------------------------------ + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/suite_info.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/suite_info.hpp new file mode 100644 index 0000000..6b4d698 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/suite_info.hpp @@ -0,0 +1,126 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_SUITE_INFO_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_SUITE_INFO_HPP + +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +class runner; + +/** Associates a unit test type with metadata. */ +class suite_info +{ + using run_type = std::function; + + std::string name_; + std::string module_; + std::string library_; + bool manual_; + run_type run_; + +public: + suite_info( + std::string name, + std::string module, + std::string library, + bool manual, + run_type run) + : name_(std::move(name)) + , module_(std::move(module)) + , library_(std::move(library)) + , manual_(manual) + , run_(std::move(run)) + { + } + + std::string const& + name() const + { + return name_; + } + + std::string const& + module() const + { + return module_; + } + + std::string const& + library() const + { + return library_; + } + + /// Returns `true` if this suite only runs manually. + bool + manual() const + { + return manual_; + } + + /// Return the canonical suite name as a string. + std::string + full_name() const + { + return library_ + "." + module_ + "." + name_; + } + + /// Run a new instance of the associated test suite. + void + run(runner& r) const + { + run_(r); + } + + friend + bool + operator<(suite_info const& lhs, suite_info const& rhs) + { + return + std::tie(lhs.library_, lhs.module_, lhs.name_) < + std::tie(rhs.library_, rhs.module_, rhs.name_); + } +}; + +//------------------------------------------------------------------------------ + +/// Convenience for producing suite_info for a given test type. +template +suite_info +make_suite_info( + std::string name, + std::string module, + std::string library, + bool manual) +{ + return suite_info( + std::move(name), + std::move(module), + std::move(library), + manual, + [](runner& r) + { + Suite{}(r); + } + ); +} + +} // unit_test +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/_experimental/unit_test/suite_list.hpp b/include/webcpp/beast/detail/backend/_experimental/unit_test/suite_list.hpp new file mode 100644 index 0000000..615dc42 --- /dev/null +++ b/include/webcpp/beast/detail/backend/_experimental/unit_test/suite_list.hpp @@ -0,0 +1,85 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_UNIT_TEST_SUITE_LIST_HPP +#define WEBCPP_BEAST_BACKEND_UNIT_TEST_SUITE_LIST_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace unit_test { + +/// A container of test suites. +class suite_list + : public detail::const_container > +{ +private: +#ifndef NDEBUG + std::unordered_set names_; + + using type_index = boost::typeindex::type_index; + std::unordered_set> classes_; +#endif + +public: + /** Insert a suite into the set. + + The suite must not already exist. + */ + template + void + insert( + char const* name, + char const* module, + char const* library, + bool manual); +}; + +//------------------------------------------------------------------------------ + +template +void +suite_list::insert( + char const* name, + char const* module, + char const* library, + bool manual) +{ +#ifndef NDEBUG + { + std::string s; + s = std::string(library) + "." + module + "." + name; + auto const result(names_.insert(s)); + BOOST_ASSERT(result.second); // Duplicate name + } + + { + auto const result(classes_.insert( + boost::typeindex::type_id())); + BOOST_ASSERT(result.second); // Duplicate type + } +#endif + cont().emplace(make_suite_info( + name, module, library, manual)); +} + +} // unit_test +} // beast +} // boost + +#endif + diff --git a/include/webcpp/beast/detail/backend/core.hpp b/include/webcpp/beast/detail/backend/core.hpp new file mode 100644 index 0000000..53d8038 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core.hpp @@ -0,0 +1,52 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_CORE_HPP +#define WEBCPP_BEAST_BACKEND_CORE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/async_base.hpp b/include/webcpp/beast/detail/backend/core/async_base.hpp new file mode 100644 index 0000000..600574c --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/async_base.hpp @@ -0,0 +1,781 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_CORE_ASYNC_BASE_HPP +#define WEBCPP_BEAST_BACKEND_CORE_ASYNC_BASE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + + +/** Base class to assist writing composed operations. + + A function object submitted to intermediate initiating functions during + a composed operation may derive from this type to inherit all of the + boilerplate to forward the executor, allocator, and legacy customization + points associated with the completion handler invoked at the end of the + composed operation. + + The composed operation must be typical; that is, associated with one + executor of an I/O object, and invoking a caller-provided completion + handler when the operation is finished. Classes derived from + @ref async_base will acquire these properties: + + @li Ownership of the final completion handler provided upon construction. + + @li If the final handler has an associated allocator, this allocator will + be propagated to the composed operation subclass. Otherwise, the + associated allocator will be the type specified in the allocator + template parameter, or the default of `std::allocator` if the + parameter is omitted. + + @li If the final handler has an associated executor, then it will be used + as the executor associated with the composed operation. Otherwise, + the specified `Executor1` will be the type of executor associated + with the composed operation. + + @li An instance of `net::executor_work_guard` for the instance of `Executor1` + shall be maintained until either the final handler is invoked, or the + operation base is destroyed, whichever comes first. + + @li Calls to the legacy customization point `asio_handler_is_continuation` + which use argument-dependent lookup, will be forwarded to the + legacy customization points associated with the handler. + + @par Example + + The following code demonstrates how @ref async_base may be be used to + assist authoring an asynchronous initiating function, by providing all of + the boilerplate to manage the final completion handler in a way that + maintains the allocator and executor associations: + + @code + + // Asynchronously read into a buffer until the buffer is full, or an error occurs + template + typename net::async_result::return_type + async_read(AsyncReadStream& stream, net::mutable_buffer buffer, ReadHandler&& handler) + { + using handler_type = WEBCPP_ASIO_BACKEND_HANDLER_TYPE(ReadHandler, void(error_code, std::size_t)); + using base_type = async_base; + + struct op : base_type + { + AsyncReadStream& stream_; + net::mutable_buffer buffer_; + std::size_t total_bytes_transferred_; + + op( + AsyncReadStream& stream, + net::mutable_buffer buffer, + handler_type& handler) + : base_type(std::move(handler), stream.get_executor()) + , stream_(stream) + , buffer_(buffer) + , total_bytes_transferred_(0) + { + (*this)({}, 0, false); // start the operation + } + + void operator()(error_code ec, std::size_t bytes_transferred, bool is_continuation = true) + { + // Adjust the count of bytes and advance our buffer + total_bytes_transferred_ += bytes_transferred; + buffer_ = buffer_ + bytes_transferred; + + // Keep reading until buffer is full or an error occurs + if(! ec && buffer_.size() > 0) + return stream_.async_read_some(buffer_, std::move(*this)); + + // Call the completion handler with the result. If `is_continuation` is + // false, which happens on the first time through this function, then + // `net::post` will be used to call the completion handler, otherwise + // the completion handler will be invoked directly. + + this->complete(is_continuation, ec, total_bytes_transferred_); + } + }; + + net::async_completion init{handler}; + op(stream, buffer, init.completion_handler); + return init.result.get(); + } + + @endcode + + Data members of composed operations implemented as completion handlers + do not have stable addresses, as the composed operation object is move + constructed upon each call to an initiating function. For most operations + this is not a problem. For complex operations requiring stable temporary + storage, the class @ref stable_async_base is provided which offers + additional functionality: + + @li The free function @ref allocate_stable may be used to allocate + one or more temporary objects associated with the composed operation. + + @li Memory for stable temporary objects is allocated using the allocator + associated with the composed operation. + + @li Stable temporary objects are automatically destroyed, and the memory + freed using the associated allocator, either before the final completion + handler is invoked (a Networking requirement) or when the composed operation + is destroyed, whichever occurs first. + + @par Temporary Storage Example + + The following example demonstrates how a composed operation may store a + temporary object. + + @code + + @endcode + + @tparam Handler The type of the completion handler to store. + This type must meet the requirements of CompletionHandler. + + @tparam Executor1 The type of the executor used when the handler has no + associated executor. An instance of this type must be provided upon + construction. The implementation will maintain an executor work guard + and a copy of this instance. + + @tparam Allocator The allocator type to use if the handler does not + have an associated allocator. If this parameter is omitted, then + `std::allocator` will be used. If the specified allocator is + not default constructible, an instance of the type must be provided + upon construction. + + @see stable_async_base +*/ +template< + class Handler, + class Executor1, + class Allocator = std::allocator +> +class async_base +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + : public detail::with_immediate_executor_type + , private boost::empty_value +#endif +{ + static_assert( + net::is_executor::value || net::execution::is_executor::value, + "Executor type requirements not met"); + + Handler h_; + net::executor_work_guard wg1_; + net::cancellation_type act_{net::cancellation_type::terminal}; +public: + /** The type of executor associated with this object. + + If a class derived from @ref webcpp::beast_backend::async_base is a completion + handler, then the associated executor of the derived class will + be this type. + */ + using executor_type = +#if WEBCPP_BEAST_BACKEND_DOXYGEN + __implementation_defined__; +#else + typename + net::associated_executor< + Handler, + typename net::executor_work_guard::executor_type + >::type; +#endif + + /** The type of the immediate executor associated with this object. + + If a class derived from @ref webcpp::beast_backend::async_base is a completion + handler, then the associated immediage executor of the derived class will + be this type. + */ +#if WEBCPP_BEAST_BACKEND_DOXYGEN + using immediate_executor_type = + __implementation_defined__; +#endif + + private: + + virtual + void + before_invoke_hook() + { + } + +public: + /** Constructor + + @param handler The final completion handler. + The type of this object must meet the requirements of CompletionHandler. + The implementation takes ownership of the handler by performing a decay-copy. + + @param ex1 The executor associated with the implied I/O object + target of the operation. The implementation shall maintain an + executor work guard for the lifetime of the operation, or until + the final completion handler is invoked, whichever is shorter. + + @param alloc The allocator to be associated with objects + derived from this class. If `Allocator` is default-constructible, + this parameter is optional and may be omitted. + */ +#if WEBCPP_BEAST_BACKEND_DOXYGEN + template + async_base( + Handler&& handler, + Executor1 const& ex1, + Allocator const& alloc = Allocator()); +#else + template< + class Handler_, + class = typename std::enable_if< + ! std::is_same::type, + async_base + >::value>::type + > + async_base( + Handler_&& handler, + Executor1 const& ex1) + : h_(std::forward(handler)) + , wg1_(ex1) + { + } + + template + async_base( + Handler_&& handler, + Executor1 const& ex1, + Allocator const& alloc) + : boost::empty_value( + boost::empty_init_t{}, alloc) + , h_(std::forward(handler)) + , wg1_(ex1) + { + } +#endif + + /// Move Constructor + async_base(async_base&& other) = default; + + virtual ~async_base() = default; + async_base(async_base const&) = delete; + async_base& operator=(async_base const&) = delete; + + /** The type of allocator associated with this object. + + If a class derived from @ref webcpp::beast_backend::async_base is a completion + handler, then the associated allocator of the derived class will + be this type. + */ + using allocator_type = + net::associated_allocator_t; + + /** Returns the allocator associated with this object. + + If a class derived from @ref webcpp::beast_backend::async_base is a completion + handler, then the object returned from this function will be used + as the associated allocator of the derived class. + */ + allocator_type + get_allocator() const noexcept + { + return net::get_associated_allocator(h_, + boost::empty_value::get()); + } + + /** Returns the executor associated with this object. + + If a class derived from @ref webcpp::beast_backend::async_base is a completion + handler, then the object returned from this function will be used + as the associated executor of the derived class. + */ + executor_type + get_executor() const noexcept + { + return net::get_associated_executor( + h_, wg1_.get_executor()); + } + + /** Returns the immediate executor associated with this handler. + If the handler has none it returns asios default immediate + executor based on the executor of the object. + + If a class derived from @ref webcpp::beast_backend::async_base is a completion + handler, then the object returned from this function will be used + as the associated immediate executor of the derived class. + */ + net::associated_immediate_executor_t< + Handler, + typename net::executor_work_guard::executor_type> + get_immediate_executor() const noexcept + { + return net::get_associated_immediate_executor( + h_, wg1_.get_executor()); + } + + + /** The type of cancellation_slot associated with this object. + + If a class derived from @ref async_base is a completion + handler, then the associated cancellation_slot of the + derived class will be this type. + + The default type is a filtering cancellation slot, + that only allows terminal cancellation. + */ + using cancellation_slot_type = + ::webcpp::beast_backend::detail::filtering_cancellation_slot>; + + /** Returns the cancellation_slot associated with this object. + + If a class derived from @ref async_base is a completion + handler, then the object returned from this function will be used + as the associated cancellation_slot of the derived class. + */ + cancellation_slot_type + get_cancellation_slot() const noexcept + { + return cancellation_slot_type(act_, net::get_associated_cancellation_slot(h_, + net::cancellation_slot())); + } + + /// Set the allowed cancellation types, default is `terminal`. + void set_allowed_cancellation( + net::cancellation_type allowed_cancellation_types = net::cancellation_type::terminal) + { + act_ = allowed_cancellation_types; + } + + /// Returns the handler associated with this object + Handler const& + handler() const noexcept + { + return h_; + } + + /** Returns ownership of the handler associated with this object + + This function is used to transfer ownership of the handler to + the caller, by move-construction. After the move, the only + valid operations on the base object are move construction and + destruction. + */ + Handler + release_handler() + { + return std::move(h_); + } + + /** Invoke the final completion handler, maybe using post. + + This invokes the final completion handler with the specified + arguments forwarded. It is undefined to call either of + @ref webcpp::beast_backend::async_base::complete or + @ref webcpp::beast_backend::async_base::complete_now more than once. + + Any temporary objects allocated with @ref webcpp::beast_backend::allocate_stable will + be automatically destroyed before the final completion handler + is invoked. + + @param is_continuation If this value is `false`, then the + handler will be submitted to the to the immediate executor using + `net::dispatch`. If the handler has no immediate executor, + this will submit to the executor via `net::post`. + Otherwise the handler will be invoked as if by calling + @ref webcpp::beast_backend::async_base::complete_now. + + @param args A list of optional parameters to invoke the handler + with. The completion handler must be invocable with the parameter + list, or else a compilation error will result. + */ + template + void + complete(bool is_continuation, Args&&... args) + { + this->before_invoke_hook(); + if(! is_continuation) + { + auto const ex = this->get_immediate_executor(); + net::dispatch( + ex, + net::append(std::move(h_), std::forward(args)...)); + wg1_.reset(); + } + else + { + wg1_.reset(); + h_(std::forward(args)...); + } + } + + /** Invoke the final completion handler. + + This invokes the final completion handler with the specified + arguments forwarded. It is undefined to call either of + @ref webcpp::beast_backend::async_base::complete or @ref webcpp::beast_backend::async_base::complete_now more than once. + + Any temporary objects allocated with @ref webcpp::beast_backend::allocate_stable will + be automatically destroyed before the final completion handler + is invoked. + + @param args A list of optional parameters to invoke the handler + with. The completion handler must be invocable with the parameter + list, or else a compilation error will result. + */ + template + void + complete_now(Args&&... args) + { + this->before_invoke_hook(); + wg1_.reset(); + h_(std::forward(args)...); + } + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + Handler* + get_legacy_handler_pointer() noexcept + { + return std::addressof(h_); + } +#endif +}; + +//------------------------------------------------------------------------------ + +/** Base class to provide completion handler boilerplate for composed operations. + + A function object submitted to intermediate initiating functions during + a composed operation may derive from this type to inherit all of the + boilerplate to forward the executor, allocator, and legacy customization + points associated with the completion handler invoked at the end of the + composed operation. + + The composed operation must be typical; that is, associated with one + executor of an I/O object, and invoking a caller-provided completion + handler when the operation is finished. Classes derived from + @ref async_base will acquire these properties: + + @li Ownership of the final completion handler provided upon construction. + + @li If the final handler has an associated allocator, this allocator will + be propagated to the composed operation subclass. Otherwise, the + associated allocator will be the type specified in the allocator + template parameter, or the default of `std::allocator` if the + parameter is omitted. + + @li If the final handler has an associated executor, then it will be used + as the executor associated with the composed operation. Otherwise, + the specified `Executor1` will be the type of executor associated + with the composed operation. + + @li An instance of `net::executor_work_guard` for the instance of `Executor1` + shall be maintained until either the final handler is invoked, or the + operation base is destroyed, whichever comes first. + + + Data members of composed operations implemented as completion handlers + do not have stable addresses, as the composed operation object is move + constructed upon each call to an initiating function. For most operations + this is not a problem. For complex operations requiring stable temporary + storage, the class @ref stable_async_base is provided which offers + additional functionality: + + @li The free function @ref ::webcpp::beast_backend::allocate_stable may be used to allocate + one or more temporary objects associated with the composed operation. + + @li Memory for stable temporary objects is allocated using the allocator + associated with the composed operation. + + @li Stable temporary objects are automatically destroyed, and the memory + freed using the associated allocator, either before the final completion + handler is invoked (a Networking requirement) or when the composed operation + is destroyed, whichever occurs first. + + @par Example + + The following code demonstrates how @ref stable_async_base may be be used to + assist authoring an asynchronous initiating function, by providing all of + the boilerplate to manage the final completion handler in a way that maintains + the allocator and executor associations. Furthermore, the operation shown + allocates temporary memory using @ref ::webcpp::beast_backend::allocate_stable for the timer and + message, whose addresses must not change between intermediate operations: + + @code + + // Asynchronously send a message multiple times, once per second + template + auto async_write_messages( + AsyncWriteStream& stream, + T const& message, + std::size_t repeat_count, + WriteHandler&& handler) -> + typename net::async_result< + typename std::decay::type, + void(error_code)>::return_type + { + using handler_type = typename net::async_completion::completion_handler_type; + using base_type = stable_async_base; + + struct op : base_type, webcpp::asio_backend::coroutine + { + // This object must have a stable address + struct temporary_data + { + // Although std::string is in theory movable, most implementations + // use a "small buffer optimization" which means that we might + // be submitting a buffer to the write operation and then + // moving the string, invalidating the buffer. To prevent + // undefined behavior we store the string object itself at + // a stable location. + std::string const message; + + net::steady_timer timer; + + temporary_data(std::string message_, net::io_context& ctx) + : message(std::move(message_)) + , timer(ctx) + { + } + }; + + AsyncWriteStream& stream_; + std::size_t repeats_; + temporary_data& data_; + + op(AsyncWriteStream& stream, std::size_t repeats, std::string message, handler_type& handler) + : base_type(std::move(handler), stream.get_executor()) + , stream_(stream) + , repeats_(repeats) + , data_(allocate_stable(*this, std::move(message), stream.get_executor().context())) + { + (*this)(); // start the operation + } + + // Including this file provides the keywords for macro-based coroutines + #include + + void operator()(error_code ec = {}, std::size_t = 0) + { + reenter(*this) + { + // If repeats starts at 0 then we must complete immediately. But + // we can't call the final handler from inside the initiating + // function, so we post our intermediate handler first. We use + // net::async_write with an empty buffer instead of calling + // net::post to avoid an extra function template instantiation, to + // keep compile times lower and make the resulting executable smaller. + yield net::async_write(stream_, net::const_buffer{}, std::move(*this)); + while(! ec && repeats_-- > 0) + { + // Send the string. We construct a `const_buffer` here to guarantee + // that we do not create an additional function template instantation + // of net::async_write, since we already instantiated it above for + // net::const_buffer. + + yield net::async_write(stream_, + net::const_buffer(net::buffer(data_.message)), std::move(*this)); + if(ec) + break; + + // Set the timer and wait + data_.timer.expires_after(std::chrono::seconds(1)); + yield data_.timer.async_wait(std::move(*this)); + } + } + + // The base class destroys the temporary data automatically, + // before invoking the final completion handler + this->complete_now(ec); + } + + // Including this file undefines the macros for the coroutines + #include + }; + + net::async_completion completion(handler); + std::ostringstream os; + os << message; + op(stream, repeat_count, os.str(), completion.completion_handler); + return completion.result.get(); + } + + @endcode + + @tparam Handler The type of the completion handler to store. + This type must meet the requirements of CompletionHandler. + + @tparam Executor1 The type of the executor used when the handler has no + associated executor. An instance of this type must be provided upon + construction. The implementation will maintain an executor work guard + and a copy of this instance. + + @tparam Allocator The allocator type to use if the handler does not + have an associated allocator. If this parameter is omitted, then + `std::allocator` will be used. If the specified allocator is + not default constructible, an instance of the type must be provided + upon construction. + + @see allocate_stable, async_base +*/ +template< + class Handler, + class Executor1, + class Allocator = std::allocator +> +class stable_async_base + : public async_base< + Handler, Executor1, Allocator> +{ + detail::stable_base* list_ = nullptr; + + void + before_invoke_hook() override + { + detail::stable_base::destroy_list(list_); + } + +public: + /** Constructor + + @param handler The final completion handler. + The type of this object must meet the requirements of CompletionHandler. + The implementation takes ownership of the handler by performing a decay-copy. + + @param ex1 The executor associated with the implied I/O object + target of the operation. The implementation shall maintain an + executor work guard for the lifetime of the operation, or until + the final completion handler is invoked, whichever is shorter. + + @param alloc The allocator to be associated with objects + derived from this class. If `Allocator` is default-constructible, + this parameter is optional and may be omitted. + */ +#if WEBCPP_BEAST_BACKEND_DOXYGEN + template + stable_async_base( + Handler&& handler, + Executor1 const& ex1, + Allocator const& alloc = Allocator()); +#else + template< + class Handler_, + class = typename std::enable_if< + ! std::is_same::type, + stable_async_base + >::value>::type + > + stable_async_base( + Handler_&& handler, + Executor1 const& ex1) + : async_base< + Handler, Executor1, Allocator>( + std::forward(handler), ex1) + { + } + + template + stable_async_base( + Handler_&& handler, + Executor1 const& ex1, + Allocator const& alloc) + : async_base< + Handler, Executor1, Allocator>( + std::forward(handler), ex1, alloc) + { + } +#endif + + /// Move Constructor + stable_async_base(stable_async_base&& other) + : async_base( + std::move(other)) + , list_(boost::exchange(other.list_, nullptr)) + { + } + + /** Destructor + + If the completion handler was not invoked, then any + state objects allocated with @ref allocate_stable will + be destroyed here. + */ + ~stable_async_base() + { + detail::stable_base::destroy_list(list_); + } + + /** Allocate a temporary object to hold operation state. + + The object will be destroyed just before the completion + handler is invoked, or when the operation base is destroyed. + */ + template< + class State, + class Handler_, + class Executor1_, + class Allocator_, + class... Args> + friend + State& + allocate_stable( + stable_async_base< + Handler_, Executor1_, Allocator_>& base, + Args&&... args); +}; + +/** Allocate a temporary object to hold stable asynchronous operation state. + + The object will be destroyed just before the completion + handler is invoked, or when the base is destroyed. + + @tparam State The type of object to allocate. + + @param base The helper to allocate from. + + @param args An optional list of parameters to forward to the + constructor of the object being allocated. + + @see stable_async_base +*/ +template< + class State, + class Handler, + class Executor1, + class Allocator, + class... Args> +State& +allocate_stable( + stable_async_base< + Handler, Executor1, Allocator>& base, + Args&&... args); + +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/basic_stream.hpp b/include/webcpp/beast/detail/backend/core/basic_stream.hpp new file mode 100644 index 0000000..decb8e2 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/basic_stream.hpp @@ -0,0 +1,1587 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_CORE_BASIC_STREAM_HPP +#define WEBCPP_BEAST_BACKEND_CORE_BASIC_STREAM_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN +namespace webcpp { namespace asio_backend { +namespace ssl { +template class stream; +} // ssl +} // asio +} // boost +#endif + +namespace webcpp { namespace beast_backend { + +/** A stream socket wrapper with timeouts, an executor, and a rate limit policy. + + This stream wraps a `net::basic_stream_socket` to provide + the following features: + + @li An Executor may be associated with the stream, which will + be used to invoke any completion handlers which do not already have + an associated executor. This achieves support for + [P1322R0] Networking TS enhancement to enable custom I/O executors. + + @li Timeouts may be specified for each logical asynchronous operation + performing any reading, writing, or connecting. + + @li A RatePolicy may be associated with the stream, to implement + rate limiting through the policy's interface. + + Although the stream supports multiple concurrent outstanding asynchronous + operations, the stream object is not thread-safe. The caller is responsible + for ensuring that the stream is accessed from only one thread at a time. + This includes the times when the stream, and its underlying socket, are + accessed by the networking implementation. To meet this thread safety + requirement, all asynchronous operations must be performed by the stream + within the same implicit strand (only one thread `net::io_context::run`) + or within the same explicit strand, such as an instance of `net::strand`. + + Completion handlers with explicit associated executors (such as those + arising from use of `net::bind_executor`) will be invoked by the stream + using the associated executor. Otherwise, the completion handler will + be invoked by the executor associated with the stream upon construction. + The type of executor used with this stream must meet the following + requirements: + + @li Function objects submitted to the executor shall never run + concurrently with each other. + + The executor type `net::strand` meets these requirements. Use of a + strand as the executor in the stream class template offers an additional + notational convenience: the strand does not need to be specified in + each individual initiating function call. + + Unlike other stream wrappers, the underlying socket is accessed + through the @ref socket member function instead of `next_layer`. + This causes the @ref basic_stream to be returned in calls + to @ref get_lowest_layer. + + @par Usage + + To use this stream declare an instance of the class. Then, before + each logical operation for which a timeout is desired, call + @ref expires_after with a duration, or call @ref expires_at with a + time point. Alternatively, call @ref expires_never to disable the + timeout for subsequent logical operations. A logical operation + is any series of one or more direct or indirect calls to the timeout + stream's asynchronous read, asynchronous write, or asynchronous connect + functions. + + When a timeout is set and a mixed operation is performed (one that + includes both reads and writes, for example) the timeout applies + to all of the intermediate asynchronous operations used in the + enclosing operation. This allows timeouts to be applied to stream + algorithms which were not written specifically to allow for timeouts, + when those algorithms are passed a timeout stream with a timeout set. + + When a timeout occurs the socket will be closed, canceling any + pending I/O operations. The completion handlers for these canceled + operations will be invoked with the error @ref ::webcpp::beast_backend::error::timeout. + + @par Examples + + This function reads an HTTP request with a timeout, then sends the + HTTP response with a different timeout. + + @code + void process_http_1 (tcp_stream& stream, net::yield_context yield) + { + flat_buffer buffer; + http::request req; + + // Read the request, with a 15 second timeout + stream.expires_after(std::chrono::seconds(15)); + http::async_read(stream, buffer, req, yield); + + // Calculate the response + http::response res = make_response(req); + + // Send the response, with a 30 second timeout. + stream.expires_after (std::chrono::seconds(30)); + http::async_write (stream, res, yield); + } + @endcode + + The example above could be expressed using a single timeout with a + simple modification. The function that follows first reads an HTTP + request then sends the HTTP response, with a single timeout that + applies to the entire combined operation of reading and writing: + + @code + void process_http_2 (tcp_stream& stream, net::yield_context yield) + { + flat_buffer buffer; + http::request req; + + // Require that the read and write combined take no longer than 30 seconds + stream.expires_after(std::chrono::seconds(30)); + + http::async_read(stream, buffer, req, yield); + + http::response res = make_response(req); + http::async_write (stream, res, yield); + } + @endcode + + Some stream algorithms, such as `ssl::stream::async_handshake` perform + both reads and writes. A timeout set before calling the initiating function + of such composite stream algorithms will apply to the entire composite + operation. For example, a timeout may be set on performing the SSL handshake + thusly: + + @code + void do_ssl_handshake (net::ssl::stream& stream, net::yield_context yield) + { + // Require that the SSL handshake take no longer than 10 seconds + stream.expires_after(std::chrono::seconds(10)); + + stream.async_handshake(net::ssl::stream_base::client, yield); + } + @endcode + + @par Blocking I/O + + Synchronous functions behave identically as that of the wrapped + `net::basic_stream_socket`. Timeouts are not available when performing + blocking calls. + + @tparam Protocol A type meeting the requirements of Protocol + representing the protocol the protocol to use for the basic stream socket. + A common choice is `net::ip::tcp`. + + @tparam Executor A type meeting the requirements of Executor to + be used for submitting all completion handlers which do not already have an + associated executor. If this type is omitted, the default of `net::any_io_executor` + will be used. + + @par Thread Safety + Distinct objects: Safe.@n + Shared objects: Unsafe. The application must also ensure + that all asynchronous operations are performed within the same + implicit or explicit strand. + + @see + + @li [P1322R0] Networking TS enhancement to enable custom I/O executors. +*/ +template< + class Protocol, + class Executor = net::any_io_executor, + class RatePolicy = unlimited_rate_policy +> +class basic_stream +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + : private detail::stream_base +#endif +{ +public: + /// The type of the underlying socket. + using socket_type = + net::basic_stream_socket; + + /** The type of the executor associated with the stream. + + This will be the type of executor used to invoke completion + handlers which do not have an explicit associated executor. + */ + using executor_type = ::webcpp::beast_backend::executor_type; + + /// Rebinds the stream type to another executor. + template + struct rebind_executor + { + /// The stream type when rebound to the specified executor. + using other = basic_stream< + Protocol, Executor1, RatePolicy>; + }; + + /// The protocol type. + using protocol_type = Protocol; + + /// The endpoint type. + using endpoint_type = typename Protocol::endpoint; + +private: + using op_state = basic_op_state; + static_assert( + net::is_executor::value || net::execution::is_executor::value, + "Executor type requirements not met"); + + struct impl_type + : boost::enable_shared_from_this + , boost::empty_value + { + // must come first + net::basic_stream_socket< + Protocol, Executor> socket; + + op_state read; + op_state write; + net::basic_waitable_timer< + std::chrono::steady_clock, + net::wait_traits< + std::chrono::steady_clock>, + Executor> timer; // rate timer; + + int waiting = 0; + + impl_type(impl_type&&) = default; + + template + explicit + impl_type(std::false_type, Args&&...); + + template + explicit + impl_type(std::true_type, + RatePolicy_&& policy, Args&&...); + + impl_type& operator=(impl_type&&) = delete; + + ::webcpp::beast_backend::executor_type + ex() noexcept + { + return this->socket.get_executor(); + } + + RatePolicy& + policy() noexcept + { + return this->boost::empty_value::get(); + } + + RatePolicy const& + policy() const noexcept + { + return this->boost::empty_value::get(); + } + + template + void on_timer(Executor2 const& ex2); + + void reset(); // set timeouts to never + void close() noexcept; // cancel everything + }; + + // We use shared ownership for the state so it can + // outlive the destruction of the stream_socket object, + // in the case where there is no outstanding read or write + // but the implementation is still waiting on a timer. + boost::shared_ptr impl_; + + template + struct timeout_handler; + + struct ops; + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + // webcpp::asio_backend::ssl::stream needs these + // DEPRECATED + template + friend class webcpp::asio_backend::ssl::stream; + // DEPRECATED + using lowest_layer_type = socket_type; + // DEPRECATED + lowest_layer_type& + lowest_layer() noexcept + { + return impl_->socket; + } + // DEPRECATED + lowest_layer_type const& + lowest_layer() const noexcept + { + return impl_->socket; + } +#endif + +public: + /** Destructor + + This function destroys the stream, cancelling any outstanding + asynchronous operations associated with the socket as if by + calling cancel. + */ + ~basic_stream(); + + /** Constructor + + This constructor creates the stream by forwarding all arguments + to the underlying socket. The socket then needs to be open and + connected or accepted before data can be sent or received on it. + + @param args A list of parameters forwarded to the constructor of + the underlying socket. + */ +#if WEBCPP_BEAST_BACKEND_DOXYGEN + template + explicit + basic_stream(Args&&... args); +#else + template::value>::type> + explicit + basic_stream(Arg0&& argo, Args&&... args); + + + /** Constructor + * + * A constructor that rebinds the executor. + * + * @tparam Executor_ The new executor + * @param other The original socket to be rebound. + */ + template + explicit + basic_stream(basic_stream && other); + + + template + friend class basic_stream; +#endif + + /** Constructor + + This constructor creates the stream with the specified rate + policy, and forwards all remaining arguments to the underlying + socket. The socket then needs to be open and connected or + accepted before data can be sent or received on it. + + @param policy The rate policy object to use. The stream will + take ownership of this object by decay-copy. + + @param args A list of parameters forwarded to the constructor of + the underlying socket. + */ +#if WEBCPP_BEAST_BACKEND_DOXYGEN + template + explicit + basic_stream(RatePolicy_&& policy, Args&&... args); +#else + template::value>::type> + basic_stream( + RatePolicy_&& policy, Arg0&& arg, Args&&... args); +#endif + + /** Move constructor + + @param other The other object from which the move will occur. + + @note Following the move, the moved-from object is in the + same state as if newly constructed. + */ + basic_stream(basic_stream&& other); + + /// Move assignment (deleted). + basic_stream& operator=(basic_stream&&) = delete; + + /// Return a reference to the underlying socket + socket_type& + socket() noexcept + { + return impl_->socket; + } + + /// Return a reference to the underlying socket + socket_type const& + socket() const noexcept + { + return impl_->socket; + } + + /** Release ownership of the underlying socket. + + This function causes all outstanding asynchronous connect, + read, and write operations to be canceled as if by a call + to @ref cancel. Ownership of the underlying socket is then + transferred to the caller. + */ + socket_type + release_socket(); + + //-------------------------------------------------------------------------- + + /// Returns the rate policy associated with the object + RatePolicy& + rate_policy() noexcept + { + return impl_->policy(); + } + + /// Returns the rate policy associated with the object + RatePolicy const& + rate_policy() const noexcept + { + return impl_->policy(); + } + + /** Set the timeout for subsequent logical operations. + + This sets either the read timer, the write timer, or + both timers to expire after the specified amount of time + has elapsed. If a timer expires when the corresponding + asynchronous operation is outstanding, the stream will be + closed and any outstanding operations will complete with the + error @ref ::webcpp::beast_backend::error::timeout. Otherwise, if the timer + expires while no operations are outstanding, and the expiraton + is not set again, the next operation will time out immediately. + + The timer applies collectively to any asynchronous reads + or writes initiated after the expiration is set, until the + expiration is set again. A call to @ref async_connect + counts as both a read and a write. + + @param expiry_time The amount of time after which a logical + operation should be considered timed out. + */ + void + expires_after( + net::steady_timer::duration expiry_time); + + /** Set the timeout for subsequent logical operations. + + This sets either the read timer, the write timer, or both + timers to expire at the specified time point. If a timer + expires when the corresponding asynchronous operation is + outstanding, the stream will be closed and any outstanding + operations will complete with the error @ref ::webcpp::beast_backend::error::timeout. + Otherwise, if the timer expires while no operations are outstanding, + and the expiraton is not set again, the next operation will time out + immediately. + + The timer applies collectively to any asynchronous reads + or writes initiated after the expiration is set, until the + expiration is set again. A call to @ref async_connect + counts as both a read and a write. + + @param expiry_time The time point after which a logical + operation should be considered timed out. + */ + void + expires_at(net::steady_timer::time_point expiry_time); + + /// Disable the timeout for subsequent logical operations. + void + expires_never(); + + /** Cancel all asynchronous operations associated with the socket. + + This function causes all outstanding asynchronous connect, + read, and write operations to finish immediately. Completion + handlers for cancelled operations will receive the error + `net::error::operation_aborted`. Completion handlers not + yet invoked whose operations have completed, will receive + the error corresponding to the result of the operation (which + may indicate success). + */ + void + cancel(); + + /** Close the timed stream. + + This cancels all of the outstanding asynchronous operations + as if by calling @ref cancel, and closes the underlying socket. + */ + void + close(); + + //-------------------------------------------------------------------------- + + /** Get the executor associated with the object. + + This function may be used to obtain the executor object that the + stream uses to dispatch completion handlers without an assocaited + executor. + + @return A copy of the executor that stream will use to dispatch handlers. + */ + executor_type + get_executor() noexcept + { + return impl_->ex(); + } + + /** Connect the stream to the specified endpoint. + + This function is used to connect the underlying socket to the + specified remote endpoint. The function call will block until + the connection is successfully made or an error occurs. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + @param ep The remote endpoint to connect to. + + @throws system_error Thrown on failure. + + @see connect + */ + void + connect(endpoint_type const& ep) + { + socket().connect(ep); + } + + /** Connect the stream to the specified endpoint. + + This function is used to connect the underlying socket to the + specified remote endpoint. The function call will block until + the connection is successfully made or an error occurs. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + @param ep The remote endpoint to connect to. + + @param ec Set to indicate what error occurred, if any. + + @see connect + */ + void + connect(endpoint_type const& ep, error_code& ec) + { + socket().connect(ep, ec); + } + + /** Establishes a connection by trying each endpoint in a sequence. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed operation, is implemented + in terms of calls to the underlying socket's `connect` function. + + @param endpoints A sequence of endpoints. + + @returns The successfully connected endpoint. + + @throws system_error Thrown on failure. If the sequence is + empty, the associated error code is `net::error::not_found`. + Otherwise, contains the error from the last connection attempt. + */ + template::value>::type + #endif + > + typename Protocol::endpoint + connect(EndpointSequence const& endpoints) + { + return net::connect(socket(), endpoints); + } + + /** Establishes a connection by trying each endpoint in a sequence. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed operation, is implemented + in terms of calls to the underlying socket's `connect` function. + + @param endpoints A sequence of endpoints. + + @param ec Set to indicate what error occurred, if any. If the sequence is + empty, set to `net::error::not_found`. Otherwise, contains the error + from the last connection attempt. + + @returns On success, the successfully connected endpoint. Otherwise, a + default-constructed endpoint. + */ + template::value>::type + #endif + > + typename Protocol::endpoint + connect( + EndpointSequence const& endpoints, + error_code& ec + ) + { + return net::connect(socket(), endpoints, ec); + } + + /** Establishes a connection by trying each endpoint in a sequence. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed operation, is implemented + in terms of calls to the underlying socket's `connect` function. + + @param begin An iterator pointing to the start of a sequence of endpoints. + + @param end An iterator pointing to the end of a sequence of endpoints. + + @returns An iterator denoting the successfully connected endpoint. + + @throws system_error Thrown on failure. If the sequence is + empty, the associated error code is `net::error::not_found`. + Otherwise, contains the error from the last connection attempt. + */ + template + Iterator + connect( + Iterator begin, Iterator end) + { + return net::connect(socket(), begin, end); + } + + /** Establishes a connection by trying each endpoint in a sequence. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed operation, is implemented + in terms of calls to the underlying socket's `connect` function. + + @param begin An iterator pointing to the start of a sequence of endpoints. + + @param end An iterator pointing to the end of a sequence of endpoints. + + @param ec Set to indicate what error occurred, if any. If the sequence is + empty, set to webcpp::asio_backend::error::not_found. Otherwise, contains the error + from the last connection attempt. + + @returns On success, an iterator denoting the successfully connected + endpoint. Otherwise, the end iterator. + */ + template + Iterator + connect( + Iterator begin, Iterator end, + error_code& ec) + { + return net::connect(socket(), begin, end, ec); + } + + /** Establishes a connection by trying each endpoint in a sequence. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed operation, is implemented + in terms of calls to the underlying socket's `connect` function. + + @param endpoints A sequence of endpoints. + + @param connect_condition A function object that is called prior to each + connection attempt. The signature of the function object must be: + @code + bool connect_condition( + error_code const& ec, + typename Protocol::endpoint const& next); + @endcode + The @c ec parameter contains the result from the most recent connect + operation. Before the first connection attempt, @c ec is always set to + indicate success. The @c next parameter is the next endpoint to be tried. + The function object should return true if the next endpoint should be tried, + and false if it should be skipped. + + @returns The successfully connected endpoint. + + @throws boost::system::system_error Thrown on failure. If the sequence is + empty, the associated error code is `net::error::not_found`. + Otherwise, contains the error from the last connection attempt. + */ + template< + class EndpointSequence, class ConnectCondition + #if ! WEBCPP_BEAST_BACKEND_DOXYGEN + ,class = typename std::enable_if< + net::is_endpoint_sequence< + EndpointSequence>::value>::type + #endif + > + typename Protocol::endpoint + connect( + EndpointSequence const& endpoints, + ConnectCondition connect_condition + ) + { + return net::connect(socket(), endpoints, connect_condition); + } + + /** Establishes a connection by trying each endpoint in a sequence. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed operation, is implemented + in terms of calls to the underlying socket's `connect` function. + + @param endpoints A sequence of endpoints. + + @param connect_condition A function object that is called prior to each + connection attempt. The signature of the function object must be: + @code + bool connect_condition( + error_code const& ec, + typename Protocol::endpoint const& next); + @endcode + The @c ec parameter contains the result from the most recent connect + operation. Before the first connection attempt, @c ec is always set to + indicate success. The @c next parameter is the next endpoint to be tried. + The function object should return true if the next endpoint should be tried, + and false if it should be skipped. + + @param ec Set to indicate what error occurred, if any. If the sequence is + empty, set to `net::error::not_found`. Otherwise, contains the error + from the last connection attempt. + + @returns On success, the successfully connected endpoint. Otherwise, a + default-constructed endpoint. + */ + template< + class EndpointSequence, class ConnectCondition + #if ! WEBCPP_BEAST_BACKEND_DOXYGEN + ,class = typename std::enable_if< + net::is_endpoint_sequence< + EndpointSequence>::value>::type + #endif + > + typename Protocol::endpoint + connect( + EndpointSequence const& endpoints, + ConnectCondition connect_condition, + error_code& ec) + { + return net::connect(socket(), endpoints, connect_condition, ec); + } + + /** Establishes a connection by trying each endpoint in a sequence. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed operation, is implemented + in terms of calls to the underlying socket's `connect` function. + + @param begin An iterator pointing to the start of a sequence of endpoints. + + @param end An iterator pointing to the end of a sequence of endpoints. + + @param connect_condition A function object that is called prior to each + connection attempt. The signature of the function object must be: + @code + bool connect_condition( + error_code const& ec, + typename Protocol::endpoint const& next); + @endcode + The @c ec parameter contains the result from the most recent connect + operation. Before the first connection attempt, @c ec is always set to + indicate success. The @c next parameter is the next endpoint to be tried. + The function object should return true if the next endpoint should be tried, + and false if it should be skipped. + + @returns An iterator denoting the successfully connected endpoint. + + @throws boost::system::system_error Thrown on failure. If the sequence is + empty, the associated @c error_code is `net::error::not_found`. + Otherwise, contains the error from the last connection attempt. + */ + template< + class Iterator, class ConnectCondition> + Iterator + connect( + Iterator begin, Iterator end, + ConnectCondition connect_condition) + { + return net::connect(socket(), begin, end, connect_condition); + } + + /** Establishes a connection by trying each endpoint in a sequence. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed operation, is implemented + in terms of calls to the underlying socket's `connect` function. + + @param begin An iterator pointing to the start of a sequence of endpoints. + + @param end An iterator pointing to the end of a sequence of endpoints. + + @param connect_condition A function object that is called prior to each + connection attempt. The signature of the function object must be: + @code + bool connect_condition( + error_code const& ec, + typename Protocol::endpoint const& next); + @endcode + The @c ec parameter contains the result from the most recent connect + operation. Before the first connection attempt, @c ec is always set to + indicate success. The @c next parameter is the next endpoint to be tried. + The function object should return true if the next endpoint should be tried, + and false if it should be skipped. + + @param ec Set to indicate what error occurred, if any. If the sequence is + empty, set to `net::error::not_found`. Otherwise, contains the error + from the last connection attempt. + + @returns On success, an iterator denoting the successfully connected + endpoint. Otherwise, the end iterator. + */ + template< + class Iterator, class ConnectCondition> + Iterator + connect( + Iterator begin, Iterator end, + ConnectCondition connect_condition, + error_code& ec) + { + return net::connect(socket(), begin, end, connect_condition, ec); + } + + /** Connect the stream to the specified endpoint asynchronously. + + This function is used to asynchronously connect the underlying + socket to the specified remote endpoint. The function call always + returns immediately. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + If the timeout timer expires while the operation is outstanding, + the operation will be canceled and the completion handler will be + invoked with the error @ref error::timeout. + + @param ep The remote endpoint to which the underlying socket will be + connected. Copies will be made of the endpoint object as required. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + error_code ec // Result of operation + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + + @par Per-Operation Cancellation + + This asynchronous operation supports cancellation for the following + net::cancellation_type values: + + @li @c net::cancellation_type::terminal + @li @c net::cancellation_type::partial + @li @c net::cancellation_type::total + + if they are also supported by the socket's @c async_connect operation. + + @see async_connect + */ + template< + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM1 ConnectHandler = + net::default_completion_token_t + > + WEBCPP_BEAST_BACKEND_ASYNC_RESULT1(ConnectHandler) + async_connect( + endpoint_type const& ep, + ConnectHandler&& handler = + net::default_completion_token_t< + executor_type>{}); + + /** Establishes a connection by trying each endpoint in a sequence asynchronously. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed asynchronous operation, is + implemented in terms of calls to the underlying socket's `async_connect` + function. + + If the timeout timer expires while the operation is outstanding, + the current connection attempt will be canceled and the completion + handler will be invoked with the error @ref error::timeout. + + @param endpoints A sequence of endpoints. This this object must meet + the requirements of EndpointSequence. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + // Result of operation. if the sequence is empty, set to + // net::error::not_found. Otherwise, contains the + // error from the last connection attempt. + error_code const& error, + + // On success, the successfully connected endpoint. + // Otherwise, a default-constructed endpoint. + typename Protocol::endpoint const& endpoint + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + + @par Per-Operation Cancellation + + This asynchronous operation supports cancellation for the following + net::cancellation_type values: + + @li @c net::cancellation_type::terminal + @li @c net::cancellation_type::partial + @li @c net::cancellation_type::total + + if they are also supported by the socket's @c async_connect operation. + + */ + template< + class EndpointSequence, + WEBCPP_ASIO_BACKEND_COMPLETION_TOKEN_FOR( + void(error_code, typename Protocol::endpoint)) + RangeConnectHandler = + net::default_completion_token_t + #if ! WEBCPP_BEAST_BACKEND_DOXYGEN + ,class = typename std::enable_if< + net::is_endpoint_sequence< + EndpointSequence>::value>::type + ,class = typename std::enable_if< + !net::is_connect_condition().begin())>::value + >::type + #endif + > + WEBCPP_ASIO_BACKEND_INITFN_AUTO_RESULT_TYPE( + RangeConnectHandler, + void(error_code, typename Protocol::endpoint)) + async_connect( + EndpointSequence const& endpoints, + RangeConnectHandler&& handler = + net::default_completion_token_t{}); + + /** Establishes a connection by trying each endpoint in a sequence asynchronously. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed asynchronous operation, is + implemented in terms of calls to the underlying socket's `async_connect` + function. + + If the timeout timer expires while the operation is outstanding, + the current connection attempt will be canceled and the completion + handler will be invoked with the error @ref error::timeout. + + @param endpoints A sequence of endpoints. This this object must meet + the requirements of EndpointSequence. + + @param connect_condition A function object that is called prior to each + connection attempt. The signature of the function object must be: + @code + bool connect_condition( + error_code const& ec, + typename Protocol::endpoint const& next); + @endcode + The @c ec parameter contains the result from the most recent connect + operation. Before the first connection attempt, @c ec is always set to + indicate success. The @c next parameter is the next endpoint to be tried. + The function object should return true if the next endpoint should be tried, + and false if it should be skipped. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + // Result of operation. if the sequence is empty, set to + // net::error::not_found. Otherwise, contains the + // error from the last connection attempt. + error_code const& error, + + // On success, the successfully connected endpoint. + // Otherwise, a default-constructed endpoint. + typename Protocol::endpoint const& endpoint + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @par Example + The following connect condition function object can be used to output + information about the individual connection attempts: + @code + struct my_connect_condition + { + bool operator()( + error_code const& ec, + net::ip::tcp::endpoint const& next) + { + if (ec) + std::cout << "Error: " << ec.message() << std::endl; + std::cout << "Trying: " << next << std::endl; + return true; + } + }; + @endcode + + @par Per-Operation Cancellation + + This asynchronous operation supports cancellation for the following + net::cancellation_type values: + + @li @c net::cancellation_type::terminal + @li @c net::cancellation_type::partial + @li @c net::cancellation_type::total + + if they are also supported by the socket's @c async_connect operation. + */ + template< + class EndpointSequence, + class ConnectCondition, + WEBCPP_ASIO_BACKEND_COMPLETION_TOKEN_FOR( + void(error_code, typename Protocol::endpoint)) + RangeConnectHandler = + net::default_completion_token_t + #if ! WEBCPP_BEAST_BACKEND_DOXYGEN + ,class = typename std::enable_if< + net::is_endpoint_sequence< + EndpointSequence>::value>::type + ,class = typename std::enable_if< + net::is_connect_condition().begin())>::value + >::type + #endif + > + WEBCPP_ASIO_BACKEND_INITFN_AUTO_RESULT_TYPE( + RangeConnectHandler, + void(error_code, typename Protocol::endpoint)) + async_connect( + EndpointSequence const& endpoints, + ConnectCondition connect_condition, + RangeConnectHandler&& handler = + net::default_completion_token_t< + executor_type>{}); + + /** Establishes a connection by trying each endpoint in a sequence asynchronously. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The underlying socket is automatically opened if needed. + An automatically opened socket is not returned to the + closed state upon failure. + + The algorithm, known as a composed asynchronous operation, is + implemented in terms of calls to the underlying socket's `async_connect` + function. + + If the timeout timer expires while the operation is outstanding, + the current connection attempt will be canceled and the completion + handler will be invoked with the error @ref error::timeout. + + @param begin An iterator pointing to the start of a sequence of endpoints. + + @param end An iterator pointing to the end of a sequence of endpoints. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + // Result of operation. if the sequence is empty, set to + // net::error::not_found. Otherwise, contains the + // error from the last connection attempt. + error_code const& error, + + // On success, an iterator denoting the successfully + // connected endpoint. Otherwise, the end iterator. + Iterator iterator + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @par Per-Operation Cancellation + + This asynchronous operation supports cancellation for the following + net::cancellation_type values: + + @li @c net::cancellation_type::terminal + @li @c net::cancellation_type::partial + @li @c net::cancellation_type::total + + if they are also supported by the socket's @c async_connect operation. + */ + template< + class Iterator, + WEBCPP_ASIO_BACKEND_COMPLETION_TOKEN_FOR( + void(error_code, Iterator)) + IteratorConnectHandler = + net::default_completion_token_t + #if ! WEBCPP_BEAST_BACKEND_DOXYGEN + ,class = typename std::enable_if< + !net::is_connect_condition::value + >::type + #endif + > + WEBCPP_ASIO_BACKEND_INITFN_AUTO_RESULT_TYPE( + IteratorConnectHandler, + void(error_code, Iterator)) + async_connect( + Iterator begin, Iterator end, + IteratorConnectHandler&& handler = + net::default_completion_token_t{}); + + /** Establishes a connection by trying each endpoint in a sequence asynchronously. + + This function attempts to connect the stream to one of a sequence of + endpoints by trying each endpoint until a connection is successfully + established. + The algorithm, known as a composed asynchronous operation, is + implemented in terms of calls to the underlying socket's `async_connect` + function. + + If the timeout timer expires while the operation is outstanding, + the current connection attempt will be canceled and the completion + handler will be invoked with the error @ref error::timeout. + + @param begin An iterator pointing to the start of a sequence of endpoints. + + @param end An iterator pointing to the end of a sequence of endpoints. + + @param connect_condition A function object that is called prior to each + connection attempt. The signature of the function object must be: + @code + bool connect_condition( + error_code const& ec, + typename Protocol::endpoint const& next); + @endcode + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + // Result of operation. if the sequence is empty, set to + // net::error::not_found. Otherwise, contains the + // error from the last connection attempt. + error_code const& error, + + // On success, an iterator denoting the successfully + // connected endpoint. Otherwise, the end iterator. + Iterator iterator + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @par Per-Operation Cancellation + + This asynchronous operation supports cancellation for the following + net::cancellation_type values: + + @li @c net::cancellation_type::terminal + @li @c net::cancellation_type::partial + @li @c net::cancellation_type::total + + if they are also supported by the socket's @c async_connect operation. + */ + template< + class Iterator, + class ConnectCondition, + WEBCPP_ASIO_BACKEND_COMPLETION_TOKEN_FOR( + void(error_code, Iterator)) + IteratorConnectHandler = + net::default_completion_token_t + #if ! WEBCPP_BEAST_BACKEND_DOXYGEN + ,class = typename std::enable_if< + net::is_connect_condition::value + >::type + #endif + > + WEBCPP_ASIO_BACKEND_INITFN_AUTO_RESULT_TYPE( + IteratorConnectHandler, + void(error_code, Iterator)) + async_connect( + Iterator begin, Iterator end, + ConnectCondition connect_condition, + IteratorConnectHandler&& handler = + net::default_completion_token_t{}); + + //-------------------------------------------------------------------------- + + /** Read some data. + + This function is used to read some data from the stream. + + The call blocks until one of the following is true: + + @li One or more bytes are read from the stream. + + @li An error occurs. + + @param buffers The buffers into which the data will be read. If the + size of the buffers is zero bytes, the call always returns + immediately with no error. + + @returns The number of bytes read. + + @throws system_error Thrown on failure. + + @note The `read_some` operation may not receive all of the requested + number of bytes. Consider using the function `net::read` if you need + to ensure that the requested amount of data is read before the + blocking operation completes. + */ + template + std::size_t + read_some(MutableBufferSequence const& buffers) + { + return impl_->socket.read_some(buffers); + } + + /** Read some data. + + This function is used to read some data from the underlying socket. + + The call blocks until one of the following is true: + + @li One or more bytes are read from the stream. + + @li An error occurs. + + @param buffers The buffers into which the data will be read. If the + size of the buffers is zero bytes, the call always returns + immediately with no error. + + @param ec Set to indicate what error occurred, if any. + + @returns The number of bytes read. + + @note The `read_some` operation may not receive all of the requested + number of bytes. Consider using the function `net::read` if you need + to ensure that the requested amount of data is read before the + blocking operation completes. + */ + template + std::size_t + read_some( + MutableBufferSequence const& buffers, + error_code& ec) + { + return impl_->socket.read_some(buffers, ec); + } + + /** Read some data asynchronously. + + This function is used to asynchronously read data from the stream. + + This call always returns immediately. The asynchronous operation + will continue until one of the following conditions is true: + + @li One or more bytes are read from the stream. + + @li An error occurs. + + The algorithm, known as a composed asynchronous operation, + is implemented in terms of calls to the next layer's `async_read_some` + function. The program must ensure that no other calls to @ref read_some + or @ref async_read_some are performed until this operation completes. + + If the timeout timer expires while the operation is outstanding, + the operation will be canceled and the completion handler will be + invoked with the error @ref error::timeout. + + @param buffers The buffers into which the data will be read. If the size + of the buffers is zero bytes, the operation always completes immediately + with no error. + Although the buffers object may be copied as necessary, ownership of the + underlying memory blocks is retained by the caller, which must guarantee + that they remain valid until the handler is called. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + error_code error, // Result of operation. + std::size_t bytes_transferred // Number of bytes read. + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @note The `async_read_some` operation may not receive all of the requested + number of bytes. Consider using the function `net::async_read` if you need + to ensure that the requested amount of data is read before the asynchronous + operation completes. + + @par Per-Operation Cancellation + + This asynchronous operation supports cancellation for the following + net::cancellation_type values: + + @li @c net::cancellation_type::terminal + @li @c net::cancellation_type::partial + @li @c net::cancellation_type::total + + if they are also supported by the socket's @c async_read_some operation. + */ + template< + class MutableBufferSequence, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 ReadHandler = + net::default_completion_token_t + > + WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(ReadHandler) + async_read_some( + MutableBufferSequence const& buffers, + ReadHandler&& handler = + net::default_completion_token_t{} + ); + + /** Write some data. + + This function is used to write some data to the stream. + + The call blocks until one of the following is true: + + @li One or more bytes are written to the stream. + + @li An error occurs. + + @param buffers The buffers from which the data will be written. If the + size of the buffers is zero bytes, the call always returns immediately + with no error. + + @returns The number of bytes written. + + @throws system_error Thrown on failure. + + @note The `write_some` operation may not transmit all of the requested + number of bytes. Consider using the function `net::write` if you need + to ensure that the requested amount of data is written before the + blocking operation completes. + */ + template + std::size_t + write_some(ConstBufferSequence const& buffers) + { + return impl_->socket.write_some(buffers); + } + + /** Write some data. + + This function is used to write some data to the stream. + + The call blocks until one of the following is true: + + @li One or more bytes are written to the stream. + + @li An error occurs. + + @param buffers The buffers from which the data will be written. If the + size of the buffers is zero bytes, the call always returns immediately + with no error. + + @param ec Set to indicate what error occurred, if any. + + @returns The number of bytes written. + + @throws system_error Thrown on failure. + + @note The `write_some` operation may not transmit all of the requested + number of bytes. Consider using the function `net::write` if you need + to ensure that the requested amount of data is written before the + blocking operation completes. + */ + template + std::size_t + write_some( + ConstBufferSequence const& buffers, + error_code& ec) + { + return impl_->socket.write_some(buffers, ec); + } + + /** Write some data asynchronously. + + This function is used to asynchronously write data to the underlying socket. + + This call always returns immediately. The asynchronous operation + will continue until one of the following conditions is true: + + @li One or more bytes are written to the stream. + + @li An error occurs. + + The algorithm, known as a composed asynchronous operation, + is implemented in terms of calls to the next layer's `async_write_some` + function. The program must ensure that no other calls to @ref async_write_some + are performed until this operation completes. + + If the timeout timer expires while the operation is outstanding, + the operation will be canceled and the completion handler will be + invoked with the error @ref error::timeout. + + @param buffers The buffers from which the data will be written. If the + size of the buffers is zero bytes, the operation always completes + immediately with no error. + Although the buffers object may be copied as necessary, ownership of the + underlying memory blocks is retained by the caller, which must guarantee + that they remain valid until the handler is called. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + error_code error, // Result of operation. + std::size_t bytes_transferred // Number of bytes written. + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. + @note The `async_write_some` operation may not transmit all of the requested + number of bytes. Consider using the function `net::async_write` if you need + to ensure that the requested amount of data is sent before the asynchronous + operation completes. + + @par Per-Operation Cancellation + + This asynchronous operation supports cancellation for the following + net::cancellation_type values: + + @li @c net::cancellation_type::terminal + @li @c net::cancellation_type::partial + @li @c net::cancellation_type::total + + if they are also supported by the socket's @c async_write_some operation. + */ + template< + class ConstBufferSequence, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 WriteHandler = + net::default_completion_token_t + > + WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(WriteHandler) + async_write_some( + ConstBufferSequence const& buffers, + WriteHandler&& handler = + net::default_completion_token_t{}); +}; + +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/bind_handler.hpp b/include/webcpp/beast/detail/backend/core/bind_handler.hpp new file mode 100644 index 0000000..2dcccb1 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/bind_handler.hpp @@ -0,0 +1,132 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BIND_HANDLER_HPP +#define WEBCPP_BEAST_BACKEND_BIND_HANDLER_HPP + +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** Bind parameters to a completion handler, creating a new handler. + + This function creates a new handler which, when invoked, calls + the original handler with the list of bound arguments. Any + parameters passed in the invocation will be substituted for + placeholders present in the list of bound arguments. Parameters + which are not matched to placeholders are silently discarded. + + The passed handler and arguments are forwarded into the returned + handler, whose associated allocator and associated executor will + be the same as those of the original handler. + + @par Example + + This function posts the invocation of the specified completion + handler with bound arguments: + + @code + template + void + signal_aborted (AsyncReadStream& stream, ReadHandler&& handler) + { + net::post( + stream.get_executor(), + bind_handler (std::forward (handler), + net::error::operation_aborted, 0)); + } + @endcode + + @param handler The handler to wrap. + The implementation takes ownership of the handler by performing a decay-copy. + + @param args A list of arguments to bind to the handler. + The arguments are forwarded into the returned object. These + arguments may include placeholders, which will operate in + a fashion identical to a call to `std::bind`. +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +__implementation_defined__ +#else +detail::bind_wrapper< + typename std::decay::type, + typename std::decay::type...> +#endif +bind_handler(Handler&& handler, Args&&... args) +{ + return detail::bind_wrapper< + typename std::decay::type, + typename std::decay::type...>( + std::forward(handler), + std::forward(args)...); +} + +/** Bind parameters to a completion handler, creating a new handler. + + This function creates a new handler which, when invoked, calls + the original handler with the list of bound arguments. Any + parameters passed in the invocation will be forwarded in + the parameter list after the bound arguments. + + The passed handler and arguments are forwarded into the returned + handler, whose associated allocator and associated executor will + will be the same as those of the original handler. + + @par Example + + This function posts the invocation of the specified completion + handler with bound arguments: + + @code + template + void + signal_eof (AsyncReadStream& stream, ReadHandler&& handler) + { + net::post( + stream.get_executor(), + bind_front_handler (std::forward (handler), + net::error::eof, 0)); + } + @endcode + + @param handler The handler to wrap. + The implementation takes ownership of the handler by performing a decay-copy. + + @param args A list of arguments to bind to the handler. + The arguments are forwarded into the returned object. +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +__implementation_defined__ +#else +auto +#endif +bind_front_handler( + Handler&& handler, + Args&&... args) -> + detail::bind_front_wrapper< + typename std::decay::type, + typename std::decay::type...> +{ + return detail::bind_front_wrapper< + typename std::decay::type, + typename std::decay::type...>( + std::forward(handler), + std::forward(args)...); +} + +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffer_ref.hpp b/include/webcpp/beast/detail/backend/core/buffer_ref.hpp new file mode 100644 index 0000000..c08ce96 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffer_ref.hpp @@ -0,0 +1,177 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef WEBCPP_BEAST_BACKEND_BUFFER_REF_HPP +#define WEBCPP_BEAST_BACKEND_BUFFER_REF_HPP + +#include + +namespace webcpp { namespace beast_backend { + +#if !defined(WEBCPP_ASIO_BACKEND_NO_DYNAMIC_BUFFER_V1) + +/** The buffer ref provides a wrapper around beast buffers + * to make them usable with asio dynamic_buffer v1. + * + * v2 is current not supported, so that + * `WEBCPP_ASIO_BACKEND_NO_DYNAMIC_BUFFER_V1` mustn't be defined. + * + * @par Example + * + * @code + * + * ::webcpp::asio_backend::tcp::socket sock; + * ::webcpp::beast_backend::flat_buffer fb; + * ::webcpp::asio_backend::read_until(sock, ref(fb) '\n'); + * + * @endcode + * + * @tparam Buffer The underlying buffer + */ +template +struct buffer_ref +{ + /// The ConstBufferSequence used to represent the readable bytes. + using const_buffers_type = typename Buffer::const_buffers_type; + + /// The MutableBufferSequence used to represent the writable bytes. + using mutable_buffers_type = typename Buffer::mutable_buffers_type; + + /// Returns the number of readable bytes. + std::size_t + size() const noexcept + { + return buffer_.size(); + } + + /// Return the maximum number of bytes, both readable and writable, that can ever be held. + std::size_t + max_size() const noexcept + { + return buffer_.max_size(); + } + + /// Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. + std::size_t + capacity() const noexcept + { + return buffer_.capacity(); + } + + /// Returns a constant buffer sequence representing the readable bytes + const_buffers_type + data() const noexcept + { + return buffer_.data(); + } + + /// Get a list of buffers that represents the output + /// sequence, with the given size. + /** + * Ensures that the output sequence can accommodate @c n bytes, resizing the + * vector object as necessary. + * + * @returns An object of type @c mutable_buffers_type that satisfies + * MutableBufferSequence requirements, representing vector memory at the + * start of the output sequence of size @c n. + * + * @throws std::length_error If size() + n > max_size(). + * + * @note The returned object is invalidated by any @c dynamic_vector_buffer + * or @c vector member function that modifies the input sequence or output + * sequence. + */ + mutable_buffers_type prepare(std::size_t n) + { + return buffer_.prepare(n); + } + + /// Move bytes from the output sequence to the input + /// sequence. + /** + * @param n The number of bytes to append from the start of the output + * sequence to the end of the input sequence. The remainder of the output + * sequence is discarded. + * + * Requires a preceding call prepare(x) where x >= n, and + * no intervening operations that modify the input or output sequence. + * + * @note If @c n is greater than the size of the output sequence, the entire + * output sequence is moved to the input sequence and no error is issued. + */ + void commit(std::size_t n) + { + return buffer_.commit(n); + } + + /// Remove `n` bytes from the readable byte sequence. + /** + * @b DynamicBuffer_v1: Removes @c n characters from the beginning of the + * input sequence. @note If @c n is greater than the size of the input + * sequence, the entire input sequence is consumed and no error is issued. + */ + void consume(std::size_t n) + { + return buffer_.consume(n); + } + + /// The type of the underlying buffer. + using buffer_type = Buffer; + + /// Create a buffer reference around @c buffer. + buffer_ref(Buffer & buffer) : buffer_(buffer) {} + + /// Copy the reference. + buffer_ref(const buffer_ref& buffer) = default; + +private: + Buffer &buffer_; +}; + + +template +class basic_flat_buffer; +template +class flat_static_buffer; +template +class basic_multi_buffer; +template +class static_buffer; + +/// Create a buffer_ref for basic_flat_buffer. +template +inline buffer_ref> ref(basic_flat_buffer & buf) +{ + return buffer_ref>(buf); +} + +/// Create a buffer_ref for flat_static_buffer. +template +inline buffer_ref> ref(flat_static_buffer & buf) +{ + return buffer_ref>(buf); +} + +/// Create a buffer_ref for basic_multi_buffer. +template +inline buffer_ref> ref(basic_multi_buffer & buf) +{ + return buffer_ref>(buf); +} + +/// Create a buffer_ref for static_buffer. +template +inline buffer_ref> ref(static_buffer & buf) +{ + return buffer_ref>(buf); +} + +#endif // !defined(WEBCPP_ASIO_BACKEND_NO_DYNAMIC_BUFFER_V1) + +} +} + +#endif //WEBCPP_BEAST_BACKEND_BUFFER_REF_HPP diff --git a/include/webcpp/beast/detail/backend/core/buffer_traits.hpp b/include/webcpp/beast/detail/backend/core/buffer_traits.hpp new file mode 100644 index 0000000..7868fb5 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffer_traits.hpp @@ -0,0 +1,164 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BUFFER_TRAITS_HPP +#define WEBCPP_BEAST_BACKEND_BUFFER_TRAITS_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** Determine if a list of types satisfy the ConstBufferSequence requirements. + + This metafunction is used to determine if all of the specified types + meet the requirements for constant buffer sequences. This type alias + will be `std::true_type` if each specified type meets the requirements, + otherwise, this type alias will be `std::false_type`. + + @tparam BufferSequence A list of zero or more types to check. If this + list is empty, the resulting type alias will be `std::true_type`. +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +using is_const_buffer_sequence = __see_below__; +#else +using is_const_buffer_sequence = mp11::mp_all< + net::is_const_buffer_sequence< + typename std::decay::type>...>; +#endif + +/** Determine if a list of types satisfy the MutableBufferSequence requirements. + + This metafunction is used to determine if all of the specified types + meet the requirements for mutable buffer sequences. This type alias + will be `std::true_type` if each specified type meets the requirements, + otherwise, this type alias will be `std::false_type`. + + @tparam BufferSequence A list of zero or more types to check. If this + list is empty, the resulting type alias will be `std::true_type`. +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +using is_mutable_buffer_sequence = __see_below__; +#else +using is_mutable_buffer_sequence = mp11::mp_all< + net::is_mutable_buffer_sequence< + typename std::decay::type>...>; +#endif + +/** Type alias for the underlying buffer type of a list of buffer sequence types. + + This metafunction is used to determine the underlying buffer type for + a list of buffer sequence. The equivalent type of the alias will vary + depending on the template type argument: + + @li If every type in the list is a MutableBufferSequence, + the resulting type alias will be `net::mutable_buffer`, otherwise + + @li The resulting type alias will be `net::const_buffer`. + + @par Example + The following code returns the first buffer in a buffer sequence, + or generates a compilation error if the argument is not a buffer + sequence: + @code + template + buffers_type + buffers_front (BufferSequence const& buffers) + { + static_assert( + net::is_const_buffer_sequence::value, + "BufferSequence type requirements not met"); + auto const first = net::buffer_sequence_begin (buffers); + if (first == net::buffer_sequence_end (buffers)) + return {}; + return *first; + } + @endcode + + @tparam BufferSequence A list of zero or more types to check. If this + list is empty, the resulting type alias will be `net::mutable_buffer`. +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +using buffers_type = __see_below__; +#else +using buffers_type = typename std::conditional< + is_mutable_buffer_sequence::value, + net::mutable_buffer, net::const_buffer>::type; +#endif + +/** Type alias for the iterator type of a buffer sequence type. + + This metafunction is used to determine the type of iterator + used by a particular buffer sequence. + + @tparam T The buffer sequence type to use. The resulting + type alias will be equal to the iterator type used by + the buffer sequence. +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +using buffers_iterator_type = __see_below__; +#elif BOOST_WORKAROUND(BOOST_MSVC, < 1910) +using buffers_iterator_type = typename + detail::buffers_iterator_type_helper< + typename std::decay::type>::type; +#else +using buffers_iterator_type = + decltype(net::buffer_sequence_begin( + std::declval())); +#endif + +/** Return the total number of bytes in a buffer or buffer sequence + + This function returns the total number of bytes in a buffer, + buffer sequence, or object convertible to a buffer. Specifically + it may be passed: + + @li A ConstBufferSequence or MutableBufferSequence + + @li A `net::const_buffer` or `net::mutable_buffer` + + @li An object convertible to `net::const_buffer` + + This function is designed as an easier-to-use replacement for + `net::buffer_size`. It recognizes customization points found through + argument-dependent lookup. The call `::webcpp::beast_backend::buffer_bytes(b)` is + equivalent to performing: + @code + using net::buffer_size; + return buffer_size(b); + @endcode + In addition this handles types which are convertible to + `net::const_buffer`; these are not handled by `net::buffer_size`. + + @param buffers The buffer or buffer sequence to calculate the size of. + + @return The total number of bytes in the buffer or sequence. +*/ +#if WEBCPP_BEAST_BACKEND_DOXYGEN +template +std::size_t +buffer_bytes(BufferSequence const& buffers); +#else +WEBCPP_BEAST_BACKEND_INLINE_VARIABLE(buffer_bytes, detail::buffer_bytes_impl) +#endif + +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffered_read_stream.hpp b/include/webcpp/beast/detail/backend/core/buffered_read_stream.hpp new file mode 100644 index 0000000..4bd0c44 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffered_read_stream.hpp @@ -0,0 +1,363 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BUFFERED_READ_STREAM_HPP +#define WEBCPP_BEAST_BACKEND_BUFFERED_READ_STREAM_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** A Stream with attached DynamicBuffer to buffer reads. + + This wraps a Stream implementation so that calls to write are + passed through to the underlying stream, while calls to read will + first consume the input sequence stored in a DynamicBuffer which + is part of the object. + + The use-case for this class is different than that of the + `net::buffered_read_stream`. It is designed to facilitate + the use of `net::read_until`, and to allow buffers + acquired during detection of handshakes to be made transparently + available to callers. A hypothetical implementation of the + buffered version of `net::ssl::stream::async_handshake` + could make use of this wrapper. + + Uses: + + @li Transparently leave untouched input acquired in calls + to `net::read_until` behind for subsequent callers. + + @li "Preload" a stream with handshake input data acquired + from other sources. + + Example: + @code + // Process the next HTTP header on the stream, + // leaving excess bytes behind for the next call. + // + template + void process_http_message( + buffered_read_stream& stream) + { + // Read up to and including the end of the HTTP + // header, leaving the sequence in the stream's + // buffer. read_until may read past the end of the + // headers; the return value will include only the + // part up to the end of the delimiter. + // + std::size_t bytes_transferred = + net::read_until( + stream.next_layer(), stream.buffer(), "\r\n\r\n"); + + // Use buffers_prefix() to limit the input + // sequence to only the data up to and including + // the trailing "\r\n\r\n". + // + auto header_buffers = buffers_prefix( + bytes_transferred, stream.buffer().data()); + + ... + + // Discard the portion of the input corresponding + // to the HTTP headers. + // + stream.buffer().consume(bytes_transferred); + + // Everything we read from the stream + // is part of the content-body. + } + @endcode + + @tparam Stream The type of stream to wrap. + + @tparam DynamicBuffer The type of stream buffer to use. +*/ +template +class buffered_read_stream +{ + static_assert( + net::is_dynamic_buffer::value, + "DynamicBuffer type requirements not met"); + + struct ops; + + DynamicBuffer buffer_; + std::size_t capacity_ = 0; + Stream next_layer_; + +public: + /// The type of the internal buffer + using buffer_type = DynamicBuffer; + + /// The type of the next layer. + using next_layer_type = + typename std::remove_reference::type; + + /** Move constructor. + + @note The behavior of move assignment on or from streams + with active or pending operations is undefined. + */ + buffered_read_stream(buffered_read_stream&&) = default; + + /** Move assignment. + + @note The behavior of move assignment on or from streams + with active or pending operations is undefined. + */ + buffered_read_stream& operator=(buffered_read_stream&&) = default; + + /** Construct the wrapping stream. + + @param args Parameters forwarded to the `Stream` constructor. + */ + template + explicit + buffered_read_stream(Args&&... args); + + /// Get a reference to the next layer. + next_layer_type& + next_layer() noexcept + { + return next_layer_; + } + + /// Get a const reference to the next layer. + next_layer_type const& + next_layer() const noexcept + { + return next_layer_; + } + + using executor_type = + ::webcpp::beast_backend::executor_type; + + /** Get the executor associated with the object. + + This function may be used to obtain the executor object that the stream + uses to dispatch handlers for asynchronous operations. + + @return A copy of the executor that stream will use to dispatch handlers. + */ + executor_type + get_executor() noexcept + { + return next_layer_.get_executor(); + } + + /** Access the internal buffer. + + The internal buffer is returned. It is possible for the + caller to break invariants with this function. For example, + by causing the internal buffer size to increase beyond + the caller defined maximum. + */ + DynamicBuffer& + buffer() noexcept + { + return buffer_; + } + + /// Access the internal buffer + DynamicBuffer const& + buffer() const noexcept + { + return buffer_; + } + + /** Set the maximum buffer size. + + This changes the maximum size of the internal buffer used + to hold read data. No bytes are discarded by this call. If + the buffer size is set to zero, no more data will be buffered. + + Thread safety: + The caller is responsible for making sure the call is + made from the same implicit or explicit strand. + + @param size The number of bytes in the read buffer. + + @note This is a soft limit. If the new maximum size is smaller + than the amount of data in the buffer, no bytes are discarded. + */ + void + capacity(std::size_t size) noexcept + { + capacity_ = size; + } + + /** Read some data from the stream. + + This function is used to read data from the stream. + The function call will block until one or more bytes of + data has been read successfully, or until an error occurs. + + @param buffers One or more buffers into which the data will be read. + + @return The number of bytes read. + + @throws system_error Thrown on failure. + */ + template + std::size_t + read_some(MutableBufferSequence const& buffers); + + /** Read some data from the stream. + + This function is used to read data from the stream. + The function call will block until one or more bytes of + data has been read successfully, or until an error occurs. + + @param buffers One or more buffers into which the data will be read. + + @param ec Set to the error, if any occurred. + + @return The number of bytes read, or 0 on error. + */ + template + std::size_t + read_some(MutableBufferSequence const& buffers, + error_code& ec); + + /** Start an asynchronous read. + + This function is used to asynchronously read data from + the stream. The function call always returns immediately. + + @param buffers One or more buffers into which the data + will be read. Although the buffers object may be copied + as necessary, ownership of the underlying memory blocks + is retained by the caller, which must guarantee that they + remain valid until the handler is called. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + error_code const& error, // result of operation + std::size_t bytes_transferred // number of bytes transferred + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. */ + template< + class MutableBufferSequence, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 ReadHandler = + net::default_completion_token_t> + WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(ReadHandler) + async_read_some( + MutableBufferSequence const& buffers, + ReadHandler&& handler = + net::default_completion_token_t{}); + + /** Write some data to the stream. + + This function is used to write data to the stream. + The function call will block until one or more bytes of the + data has been written successfully, or until an error occurs. + + @param buffers One or more data buffers to be written to the stream. + + @return The number of bytes written. + + @throws system_error Thrown on failure. + */ + template + std::size_t + write_some(ConstBufferSequence const& buffers) + { + static_assert(is_sync_write_stream::value, + "SyncWriteStream type requirements not met"); + return next_layer_.write_some(buffers); + } + + /** Write some data to the stream. + + This function is used to write data to the stream. + The function call will block until one or more bytes of the + data has been written successfully, or until an error occurs. + + @param buffers One or more data buffers to be written to the stream. + + @param ec Set to the error, if any occurred. + + @return The number of bytes written. + */ + template + std::size_t + write_some(ConstBufferSequence const& buffers, + error_code& ec) + { + static_assert(is_sync_write_stream::value, + "SyncWriteStream type requirements not met"); + return next_layer_.write_some(buffers, ec); + } + + /** Start an asynchronous write. + + This function is used to asynchronously write data from + the stream. The function call always returns immediately. + + @param buffers One or more data buffers to be written to + the stream. Although the buffers object may be copied as + necessary, ownership of the underlying memory blocks is + retained by the caller, which must guarantee that they + remain valid until the handler is called. + + @param handler The completion handler to invoke when the operation + completes. The implementation takes ownership of the handler by + performing a decay-copy. The equivalent function signature of + the handler must be: + @code + void handler( + error_code const& error, // result of operation + std::size_t bytes_transferred // number of bytes transferred + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed + by dispatching to the immediate executor. If no + immediate executor is specified, this is equivalent + to using `net::post`. */ + template< + class ConstBufferSequence, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 WriteHandler = + net::default_completion_token_t> + WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(WriteHandler) + async_write_some( + ConstBufferSequence const& buffers, + WriteHandler&& handler = + net::default_completion_token_t{}); +}; + +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffers_adaptor.hpp b/include/webcpp/beast/detail/backend/core/buffers_adaptor.hpp new file mode 100644 index 0000000..2700516 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffers_adaptor.hpp @@ -0,0 +1,236 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BUFFERS_ADAPTOR_HPP +#define WEBCPP_BEAST_BACKEND_BUFFERS_ADAPTOR_HPP + +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** Adapts a MutableBufferSequence into a DynamicBuffer. + + This class wraps a MutableBufferSequence to meet the requirements + of DynamicBuffer. Upon construction the input and output sequences + are empty. A copy of the mutable buffer sequence object is stored; however, + ownership of the underlying memory is not transferred. The caller is + responsible for making sure that referenced memory remains valid + for the duration of any operations. + + The size of the mutable buffer sequence determines the maximum + number of bytes which may be prepared and committed. + + @tparam MutableBufferSequence The type of mutable buffer sequence to adapt. +*/ +template +class buffers_adaptor +{ + static_assert(net::is_mutable_buffer_sequence< + MutableBufferSequence>::value, + "MutableBufferSequence type requirements not met"); + + using iter_type = + buffers_iterator_type; + + template + class subrange; + + MutableBufferSequence bs_; + iter_type begin_; + iter_type out_; + iter_type end_; + std::size_t max_size_; + std::size_t in_pos_ = 0; // offset in *begin_ + std::size_t in_size_ = 0; // size of input sequence + std::size_t out_pos_ = 0; // offset in *out_ + std::size_t out_end_ = 0; // output end offset + + iter_type end_impl() const; + + buffers_adaptor( + buffers_adaptor const& other, + std::size_t nbegin, + std::size_t nout, + std::size_t nend); + +public: + /// The type of the underlying mutable buffer sequence + using value_type = MutableBufferSequence; + + /** Construct a buffers adaptor. + + @param buffers The mutable buffer sequence to wrap. A copy of + the object will be made, but ownership of the memory is not + transferred. + */ + explicit + buffers_adaptor(MutableBufferSequence const& buffers); + + /** Constructor + + This constructs the buffer adaptor in-place from + a list of arguments. + + @param args Arguments forwarded to the buffers constructor. + */ + template + explicit + buffers_adaptor(boost::in_place_init_t, Args&&... args); + + /// Copy Constructor + buffers_adaptor(buffers_adaptor const& other); + + /// Copy Assignment + buffers_adaptor& operator=(buffers_adaptor const&); + + /// Returns the original mutable buffer sequence + value_type const& + value() const + { + return bs_; + } + + //-------------------------------------------------------------------------- + +#if WEBCPP_BEAST_BACKEND_DOXYGEN + /// The ConstBufferSequence used to represent the readable bytes. + using const_buffers_type = __implementation_defined__; + + /// The MutableBufferSequence used to represent the writable bytes. + using mutable_buffers_type = __implementation_defined__; + +#else + using const_buffers_type = subrange; + + using mutable_buffers_type = subrange; +#endif + + /// Returns the number of readable bytes. + std::size_t + size() const noexcept + { + return in_size_; + } + + /// Return the maximum number of bytes, both readable and writable, that can ever be held. + std::size_t + max_size() const noexcept + { + return max_size_; + } + + /// Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation. + std::size_t + capacity() const noexcept + { + return max_size_; + } + + /// Returns a constant buffer sequence representing the readable bytes + const_buffers_type + data() const noexcept; + + /// Returns a constant buffer sequence representing the readable bytes + const_buffers_type + cdata() const noexcept + { + return data(); + } + + /// Returns a mutable buffer sequence representing the readable bytes. + mutable_buffers_type + data() noexcept; + + /** Returns a mutable buffer sequence representing writable bytes. + + Returns a mutable buffer sequence representing the writable + bytes containing exactly `n` bytes of storage. This function + does not allocate memory. Instead, the storage comes from + the underlying mutable buffer sequence. + + All buffer sequences previously obtained using @ref prepare are + invalidated. Buffer sequences previously obtained using @ref data + remain valid. + + @param n The desired number of bytes in the returned buffer + sequence. + + @throws std::length_error if `size() + n` exceeds `max_size()`. + + @esafe + + Strong guarantee. + */ + mutable_buffers_type + prepare(std::size_t n); + + /** Append writable bytes to the readable bytes. + + Appends n bytes from the start of the writable bytes to the + end of the readable bytes. The remainder of the writable bytes + are discarded. If n is greater than the number of writable + bytes, all writable bytes are appended to the readable bytes. + + All buffer sequences previously obtained using @ref prepare are + invalidated. Buffer sequences previously obtained using @ref data + remain valid. + + @param n The number of bytes to append. If this number + is greater than the number of writable bytes, all + writable bytes are appended. + + @esafe + + No-throw guarantee. + */ + void + commit(std::size_t n) noexcept; + + /** Remove bytes from beginning of the readable bytes. + + Removes n bytes from the beginning of the readable bytes. + + All buffers sequences previously obtained using + @ref data or @ref prepare are invalidated. + + @param n The number of bytes to remove. If this number + is greater than the number of readable bytes, all + readable bytes are removed. + + @esafe + + No-throw guarantee. + */ + void + consume(std::size_t n) noexcept; + +private: + + subrange + make_subrange(std::size_t pos, std::size_t n); + + subrange + make_subrange(std::size_t pos, std::size_t n) const; + +#ifndef WEBCPP_BEAST_BACKEND_DOXYGEN + friend struct buffers_adaptor_test_hook; +#endif + +}; + +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffers_cat.hpp b/include/webcpp/beast/detail/backend/core/buffers_cat.hpp new file mode 100644 index 0000000..d3932ee --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffers_cat.hpp @@ -0,0 +1,105 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BUFFERS_CAT_HPP +#define WEBCPP_BEAST_BACKEND_BUFFERS_CAT_HPP + +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** A buffer sequence representing a concatenation of buffer sequences. + @see buffers_cat +*/ +template +class buffers_cat_view +{ + detail::tuple bn_; + +public: + /** The type of buffer returned when dereferencing an iterator. + If every buffer sequence in the view is a MutableBufferSequence, + then `value_type` will be `net::mutable_buffer`. + Otherwise, `value_type` will be `net::const_buffer`. + */ +#if WEBCPP_BEAST_BACKEND_DOXYGEN + using value_type = __see_below__; +#else + using value_type = buffers_type; +#endif + + /// The type of iterator used by the concatenated sequence + class const_iterator; + + /// Copy Constructor + buffers_cat_view(buffers_cat_view const&) = default; + + /// Copy Assignment + buffers_cat_view& operator=(buffers_cat_view const&) = default; + + /** Constructor + @param buffers The list of buffer sequences to concatenate. + Copies of the arguments will be maintained for the lifetime + of the concatenated sequence; however, the ownership of the + memory buffers themselves is not transferred. + */ + explicit + buffers_cat_view(Buffers const&... buffers); + + /// Returns an iterator to the first buffer in the sequence + const_iterator + begin() const; + + /// Returns an iterator to one past the last buffer in the sequence + const_iterator + end() const; +}; + +/** Concatenate 1 or more buffer sequences. + + This function returns a constant or mutable buffer sequence which, + when iterated, efficiently concatenates the input buffer sequences. + Copies of the arguments passed will be made; however, the returned + object does not take ownership of the underlying memory. The + application is still responsible for managing the lifetime of the + referenced memory. + @param buffers The list of buffer sequences to concatenate. + @return A new buffer sequence that represents the concatenation of + the input buffer sequences. This buffer sequence will be a + MutableBufferSequence if each of the passed buffer sequences is + also a MutableBufferSequence; otherwise the returned buffer + sequence will be a ConstBufferSequence. + @see buffers_cat_view +*/ +#if WEBCPP_BEAST_BACKEND_DOXYGEN +template +buffers_cat_view +buffers_cat(BufferSequence const&... buffers) +#else +template +buffers_cat_view +buffers_cat(B1 const& b1, Bn const&... bn) +#endif +{ + static_assert( + is_const_buffer_sequence::value, + "BufferSequence type requirements not met"); + return buffers_cat_view{b1, bn...}; +} + +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffers_generator.hpp b/include/webcpp/beast/detail/backend/core/buffers_generator.hpp new file mode 100644 index 0000000..e57ad04 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffers_generator.hpp @@ -0,0 +1,200 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2022 Seth Heeren (sgheeren at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_CORE_BUFFERS_GENERATOR_HPP +#define WEBCPP_BEAST_BACKEND_CORE_BUFFERS_GENERATOR_HPP + +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** Determine if type satisfies the BuffersGenerator requirements. + + This metafunction is used to determine if the specified type meets the + requirements for a buffers generator. + + The static member `value` will evaluate to `true` if so, `false` otherwise. + + @tparam T a type to check +*/ +#ifdef WEBCPP_BEAST_BACKEND_DOXYGEN +template +struct is_buffers_generator + : integral_constant +{ +}; +#else +template +struct is_buffers_generator + : std::false_type +{ +}; + +template +struct is_buffers_generator< + T, detail::void_t().is_done()), + typename T::const_buffers_type( + std::declval().prepare( + std::declval())), + std::declval().consume( + std::size_t{}) + )>> : std::true_type +{ +}; +#endif + +/** Write all output from a BuffersGenerator to a stream. + + This function is used to write all of the buffers generated + by a caller-provided BuffersGenerator to a stream. The call + will block until one of the following conditions is true: + + @li A call to the generator's `is_done` returns `false`. + + @li An error occurs. + + This operation is implemented in terms of one or more calls + to the stream's `write_some` function. + + @param stream The stream to which the data is to be written. + The type must support the SyncWriteStream concept. + + @param generator The generator to use. + + @param ec Set to the error, if any occurred. + + @return The number of bytes written to the stream. + + @see BuffersGenerator +*/ +template< + class SyncWriteStream, + class BuffersGenerator +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + , typename std::enable_if:: + type>::value>::type* = nullptr +#endif + > +std::size_t +write( + SyncWriteStream& stream, + BuffersGenerator&& generator, + ::webcpp::beast_backend::error_code& ec); + +/** Write all output from a BuffersGenerator to a stream. + + This function is used to write all of the buffers generated + by a caller-provided BuffersGenerator to a stream. The call + will block until one of the following conditions is true: + + @li A call to the generator's `is_done` returns `false`. + + @li An error occurs. + + This operation is implemented in terms of one or more calls + to the stream's `write_some` function. + + @param stream The stream to which the data is to be written. + The type must support the SyncWriteStream concept. + + @param generator The generator to use. + + @return The number of bytes written to the stream. + + @throws system_error Thrown on failure. + + @see BuffersGenerator +*/ +template< + class SyncWriteStream, + class BuffersGenerator +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + , typename std::enable_if:: + type>::value>::type* = nullptr +#endif + > +std::size_t +write( + SyncWriteStream& stream, + BuffersGenerator&& generator); + +/** Write all output from a BuffersGenerator asynchronously to a + stream. + + This function is used to write all of the buffers generated + by a caller-provided `BuffersGenerator` to a stream. The + function call always returns immediately. The asynchronous + operation will continue until one of the following + conditions is true: + + @li A call to the generator's `is_done` returns `false`. + + @li An error occurs. + + This operation is implemented in terms of zero or more calls + to the stream's `async_write_some` function, and is known as + a composed operation. The program must ensure that + the stream performs no other writes until this operation + completes. + + @param stream The stream to which the data is to be written. + The type must support the SyncWriteStream concept. + + @param generator The generator to use. + + @param token The completion handler to invoke when the + operation completes. The implementation takes ownership of + the handler by performing a decay-copy. The equivalent + function signature of the handler must be: + @code + void handler( + error_code const& error, // result of operation + std::size_t bytes_transferred // the number of bytes written to the stream + ); + @endcode + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed in a + manner equivalent to using `net::post`. + + @see BuffersGenerator +*/ +template< + class AsyncWriteStream, + class BuffersGenerator, + WEBCPP_BEAST_BACKEND_ASYNC_TPARAM2 CompletionToken + = net::default_completion_token_t> +#if !WEBCPP_BEAST_BACKEND_DOXYGEN + , typename std::enable_if::value>::type* = nullptr +#endif + > +WEBCPP_BEAST_BACKEND_ASYNC_RESULT2(CompletionToken) +async_write( + AsyncWriteStream& stream, + BuffersGenerator generator, + CompletionToken&& token + = net::default_completion_token_t>{}); + +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffers_prefix.hpp b/include/webcpp/beast/detail/backend/core/buffers_prefix.hpp new file mode 100644 index 0000000..c4056e3 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffers_prefix.hpp @@ -0,0 +1,201 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BUFFERS_PREFIX_HPP +#define WEBCPP_BEAST_BACKEND_BUFFERS_PREFIX_HPP + +#include +#include +#include // for in_place_init_t +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1910) +#include +#endif + +namespace webcpp { namespace beast_backend { + +/** A buffer sequence adaptor that shortens the sequence size. + + The class adapts a buffer sequence to efficiently represent + a shorter subset of the original list of buffers starting + with the first byte of the original sequence. + + @tparam BufferSequence The buffer sequence to adapt. +*/ +template +class buffers_prefix_view +{ + using iter_type = + buffers_iterator_type; + + BufferSequence bs_; + std::size_t size_ = 0; + std::size_t remain_ = 0; + iter_type end_{}; + + void + setup(std::size_t size); + + buffers_prefix_view( + buffers_prefix_view const& other, + std::size_t dist); + +public: + /** The type for each element in the list of buffers. + + If the type `BufferSequence` meets the requirements of + MutableBufferSequence, then `value_type` is + `net::mutable_buffer`. Otherwise, `value_type` is + `net::const_buffer`. + + @see buffers_type + */ +#if WEBCPP_BEAST_BACKEND_DOXYGEN + using value_type = __see_below__; +#elif BOOST_WORKAROUND(BOOST_MSVC, < 1910) + using value_type = typename std::conditional< + boost::is_convertible::value_type, + net::mutable_buffer>::value, + net::mutable_buffer, + net::const_buffer>::type; +#else + using value_type = buffers_type; +#endif + +#if WEBCPP_BEAST_BACKEND_DOXYGEN + /// A bidirectional iterator type that may be used to read elements. + using const_iterator = __implementation_defined__; + +#else + class const_iterator; + +#endif + + /// Copy Constructor + buffers_prefix_view(buffers_prefix_view const&); + + /// Copy Assignment + buffers_prefix_view& operator=(buffers_prefix_view const&); + + /** Construct a buffer sequence prefix. + + @param size The maximum number of bytes in the prefix. + If this is larger than the size of passed buffers, + the resulting sequence will represent the entire + input sequence. + + @param buffers The buffer sequence to adapt. A copy of + the sequence will be made, but ownership of the underlying + memory is not transferred. The copy is maintained for + the lifetime of the view. + */ + buffers_prefix_view( + std::size_t size, + BufferSequence const& buffers); + + /** Construct a buffer sequence prefix in-place. + + @param size The maximum number of bytes in the prefix. + If this is larger than the size of passed buffers, + the resulting sequence will represent the entire + input sequence. + + @param args Arguments forwarded to the contained buffer's constructor. + */ + template + buffers_prefix_view( + std::size_t size, + boost::in_place_init_t, + Args&&... args); + + /// Returns an iterator to the first buffer in the sequence + const_iterator + begin() const; + + /// Returns an iterator to one past the last buffer in the sequence + const_iterator + end() const; + +#if ! WEBCPP_BEAST_BACKEND_DOXYGEN + std::size_t + buffer_bytes_impl() const noexcept + { + return size_; + } +#endif +}; + +//------------------------------------------------------------------------------ + +/** Returns a prefix of a constant or mutable buffer sequence. + + The returned buffer sequence points to the same memory as the + passed buffer sequence, but with a size that is equal to or + smaller. No memory allocations are performed; the resulting + sequence is calculated as a lazy range. + + @param size The maximum size of the returned buffer sequence + in bytes. If this is greater than or equal to the size of + the passed buffer sequence, the result will have the same + size as the original buffer sequence. + + @param buffers An object whose type meets the requirements + of BufferSequence. The returned value will + maintain a copy of the passed buffers for its lifetime; + however, ownership of the underlying memory is not + transferred. + + @return A constant buffer sequence that represents the prefix + of the original buffer sequence. If the original buffer sequence + also meets the requirements of MutableBufferSequence, + then the returned value will also be a mutable buffer sequence. +*/ +template +buffers_prefix_view +buffers_prefix( + std::size_t size, BufferSequence const& buffers) +{ + static_assert( + net::is_const_buffer_sequence::value, + "BufferSequence type requirements not met"); + return buffers_prefix_view(size, buffers); +} + +/** Returns the first buffer in a buffer sequence + + This returns the first buffer in the buffer sequence. + If the buffer sequence is an empty range, the returned + buffer will have a zero buffer size. + + @param buffers The buffer sequence. If the sequence is + mutable, the returned buffer sequence will also be mutable. + Otherwise, the returned buffer sequence will be constant. +*/ +template +buffers_type +buffers_front(BufferSequence const& buffers) +{ + auto const first = + net::buffer_sequence_begin(buffers); + if(first == net::buffer_sequence_end(buffers)) + return {}; + return *first; +} + +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffers_range.hpp b/include/webcpp/beast/detail/backend/core/buffers_range.hpp new file mode 100644 index 0000000..6f2073e --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffers_range.hpp @@ -0,0 +1,127 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BUFFERS_RANGE_HPP +#define WEBCPP_BEAST_BACKEND_BUFFERS_RANGE_HPP + +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** Returns an iterable range representing a buffer sequence. + + This function returns an iterable range representing the + passed buffer sequence. The values obtained when iterating + the range will be `net::const_buffer`, unless the underlying + buffer sequence is a MutableBufferSequence, in which case + the value obtained when iterating will be a `net::mutable_buffer`. + + @par Example + + The following function returns the total number of bytes in + the specified buffer sequence. A copy of the buffer sequence + is maintained for the lifetime of the range object: + + @code + template + std::size_t buffer_sequence_size (BufferSequence const& buffers) + { + std::size_t size = 0; + for (auto const buffer : buffers_range (buffers)) + size += buffer.size(); + return size; + } + @endcode + + @param buffers The buffer sequence to adapt into a range. The + range object returned from this function will contain a copy + of the passed buffer sequence. + + @return An object of unspecified type which meets the requirements + of ConstBufferSequence. If `buffers` is a mutable buffer + sequence, the returned object will also meet the requirements of + MutableBufferSequence. + + @see buffers_range_ref +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +__implementation_defined__ +#else +detail::buffers_range_adaptor +#endif +buffers_range(BufferSequence const& buffers) +{ + static_assert( + is_const_buffer_sequence::value, + "BufferSequence type requirements not met"); + return detail::buffers_range_adaptor< + BufferSequence>(buffers); +} + +/** Returns an iterable range representing a buffer sequence. + + This function returns an iterable range representing the + passed buffer sequence. The values obtained when iterating + the range will be `net::const_buffer`, unless the underlying + buffer sequence is a MutableBufferSequence, in which case + the value obtained when iterating will be a `net::mutable_buffer`. + + @par Example + + The following function returns the total number of bytes in + the specified buffer sequence. A reference to the original + buffers is maintained for the lifetime of the range object: + + @code + template + std::size_t buffer_sequence_size_ref (BufferSequence const& buffers) + { + std::size_t size = 0; + for (auto const buffer : buffers_range_ref (buffers)) + size += buffer.size(); + return size; + } + @endcode + + @param buffers The buffer sequence to adapt into a range. The + range returned from this function will maintain a reference to + these buffers. The application is responsible for ensuring that + the lifetime of the referenced buffers extends until the range + object is destroyed. + + @return An object of unspecified type which meets the requirements + of ConstBufferSequence. If `buffers` is a mutable buffer + sequence, the returned object will also meet the requirements of + MutableBufferSequence. + + @see buffers_range +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +__implementation_defined__ +#else +detail::buffers_range_adaptor +#endif +buffers_range_ref(BufferSequence const& buffers) +{ + static_assert( + is_const_buffer_sequence::value, + "BufferSequence type requirements not met"); + return detail::buffers_range_adaptor< + BufferSequence const&>(buffers); +} + +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffers_suffix.hpp b/include/webcpp/beast/detail/backend/core/buffers_suffix.hpp new file mode 100644 index 0000000..bfbc36b --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffers_suffix.hpp @@ -0,0 +1,146 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BUFFERS_SUFFIX_HPP +#define WEBCPP_BEAST_BACKEND_BUFFERS_SUFFIX_HPP + +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** Adaptor to progressively trim the front of a BufferSequence. + + This adaptor wraps a buffer sequence to create a new sequence + which may be incrementally consumed. Bytes consumed are removed + from the front of the buffer. The underlying memory is not changed, + instead the adaptor efficiently iterates through a subset of + the buffers wrapped. + + The wrapped buffer is not modified, a copy is made instead. + Ownership of the underlying memory is not transferred, the application + is still responsible for managing its lifetime. + + @tparam BufferSequence The buffer sequence to wrap. + + @par Example + + This function writes the entire contents of a buffer sequence + to the specified stream. + + @code + template + void send(SyncWriteStream& stream, ConstBufferSequence const& buffers) + { + buffers_suffix bs{buffers}; + while(buffer_bytes(bs) > 0) + bs.consume(stream.write_some(bs)); + } + @endcode +*/ +template +class buffers_suffix +{ + using iter_type = + buffers_iterator_type; + + BufferSequence bs_; + iter_type begin_{}; + std::size_t skip_ = 0; + + template + buffers_suffix(Deduced&& other, std::size_t dist) + : bs_(std::forward(other).bs_) + , begin_(std::next( + net::buffer_sequence_begin(bs_), + dist)) + , skip_(other.skip_) + { + } + +public: + /** The type for each element in the list of buffers. + + If BufferSequence meets the requirements of + MutableBufferSequence, then this type will be + `net::mutable_buffer`, otherwise this type will be + `net::const_buffer`. + */ +#if WEBCPP_BEAST_BACKEND_DOXYGEN + using value_type = __see_below__; +#else + using value_type = buffers_type; +#endif + +#if WEBCPP_BEAST_BACKEND_DOXYGEN + /// A bidirectional iterator type that may be used to read elements. + using const_iterator = __implementation_defined__; + +#else + class const_iterator; + +#endif + + /// Constructor + buffers_suffix(); + + /// Copy Constructor + buffers_suffix(buffers_suffix const&); + + /** Constructor + + A copy of the buffer sequence is made. Ownership of the + underlying memory is not transferred or copied. + */ + explicit + buffers_suffix(BufferSequence const& buffers); + + /** Constructor + + This constructs the buffer sequence in-place from + a list of arguments. + + @param args Arguments forwarded to the buffers constructor. + */ + template + explicit + buffers_suffix(boost::in_place_init_t, Args&&... args); + + /// Copy Assignment + buffers_suffix& operator=(buffers_suffix const&); + + /// Get a bidirectional iterator to the first element. + const_iterator + begin() const; + + /// Get a bidirectional iterator to one past the last element. + const_iterator + end() const; + + /** Remove bytes from the beginning of the sequence. + + @param amount The number of bytes to remove. If this is + larger than the number of bytes remaining, all the + bytes remaining are removed. + */ + void + consume(std::size_t amount); +}; + +} // beast +} // boost + +#include + +#endif diff --git a/include/webcpp/beast/detail/backend/core/buffers_to_string.hpp b/include/webcpp/beast/detail/backend/core/buffers_to_string.hpp new file mode 100644 index 0000000..f92e76a --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/buffers_to_string.hpp @@ -0,0 +1,62 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_BUFFERS_TO_STRING_HPP +#define WEBCPP_BEAST_BACKEND_BUFFERS_TO_STRING_HPP + +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { + +/** Return a string representing the contents of a buffer sequence. + + This function returns a string representing an entire buffer + sequence. Nulls and unprintable characters in the buffer + sequence are inserted to the resulting string as-is. No + character conversions are performed. + + @param buffers The buffer sequence to convert + + @par Example + + This function writes a buffer sequence converted to a string + to `std::cout`. + + @code + template + void print(ConstBufferSequence const& buffers) + { + std::cout << buffers_to_string(buffers) << std::endl; + } + @endcode +*/ +template +std::string +buffers_to_string(ConstBufferSequence const& buffers) +{ + static_assert( + net::is_const_buffer_sequence::value, + "ConstBufferSequence type requirements not met"); + std::string result; + result.reserve(buffer_bytes(buffers)); + for(auto const buffer : buffers_range_ref(buffers)) + result.append(static_cast( + buffer.data()), buffer.size()); + return result; +} + +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/core/detail/allocator.hpp b/include/webcpp/beast/detail/backend/core/detail/allocator.hpp new file mode 100644 index 0000000..66aaec2 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/detail/allocator.hpp @@ -0,0 +1,42 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_DETAIL_ALLOCATOR_HPP +#define WEBCPP_BEAST_BACKEND_DETAIL_ALLOCATOR_HPP + +#include +#ifdef BOOST_NO_CXX11_ALLOCATOR +#include +#else +#include +#endif + +namespace webcpp { namespace beast_backend { +namespace detail { + +// This is a workaround for allocator_traits +// implementations which falsely claim C++11 +// compatibility. + +#ifdef BOOST_NO_CXX11_ALLOCATOR +template +using allocator_traits = boost::container::allocator_traits; + +#else +template +using allocator_traits = std::allocator_traits; + +#endif + +} // detail +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/core/detail/async_base.hpp b/include/webcpp/beast/detail/backend/core/detail/async_base.hpp new file mode 100644 index 0000000..fdbfa1f --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/detail/async_base.hpp @@ -0,0 +1,60 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_CORE_DETAIL_ASYNC_BASE_HPP +#define WEBCPP_BEAST_BACKEND_CORE_DETAIL_ASYNC_BASE_HPP + +#include + +#include + +namespace webcpp { namespace beast_backend { +namespace detail { + +struct stable_base +{ + static + void + destroy_list(stable_base*& list) + { + while(list) + { + auto next = list->next_; + list->destroy(); + list = next; + } + } + + stable_base* next_ = nullptr; + +protected: + stable_base() = default; + virtual ~stable_base() = default; + + virtual void destroy() = 0; +}; + +template +struct with_immediate_executor_type +{ +}; + +template +struct with_immediate_executor_type> +{ + using immediate_executor_type = typename Handler::immediate_executor_type; +}; + +} // detail +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/core/detail/base64.hpp b/include/webcpp/beast/detail/backend/core/detail/base64.hpp new file mode 100644 index 0000000..05696ae --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/detail/base64.hpp @@ -0,0 +1,88 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_DETAIL_BASE64_HPP +#define WEBCPP_BEAST_BACKEND_DETAIL_BASE64_HPP + +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace detail { + +namespace base64 { + +WEBCPP_BEAST_BACKEND_DECL +char const* +get_alphabet(); + +WEBCPP_BEAST_BACKEND_DECL +signed char const* +get_inverse(); + +/// Returns max chars needed to encode a base64 string +WEBCPP_BEAST_BACKEND_DECL +std::size_t constexpr +encoded_size(std::size_t n) +{ + return 4 * ((n + 2) / 3); +} + +/// Returns max bytes needed to decode a base64 string +inline +std::size_t constexpr +decoded_size(std::size_t n) +{ + return n / 4 * 3; // requires n&3==0, smaller +} + +/** Encode a series of octets as a padded, base64 string. + + The resulting string will not be null terminated. + + @par Requires + + The memory pointed to by `out` points to valid memory + of at least `encoded_size(len)` bytes. + + @return The number of characters written to `out`. This + will exclude any null termination. +*/ +WEBCPP_BEAST_BACKEND_DECL +std::size_t +encode(void* dest, void const* src, std::size_t len); + +/** Decode a padded base64 string into a series of octets. + + @par Requires + + The memory pointed to by `out` points to valid memory + of at least `decoded_size(len)` bytes. + + @return The number of octets written to `out`, and + the number of characters read from the input string, + expressed as a pair. +*/ +WEBCPP_BEAST_BACKEND_DECL +std::pair +decode(void* dest, char const* src, std::size_t len); + +} // base64 + +} // detail +} // beast +} // boost + +#ifdef WEBCPP_BEAST_BACKEND_HEADER_ONLY +#include +#endif + +#endif diff --git a/include/webcpp/beast/detail/backend/core/detail/base64.ipp b/include/webcpp/beast/detail/backend/core/detail/base64.ipp new file mode 100644 index 0000000..76c54c6 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/detail/base64.ipp @@ -0,0 +1,202 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +/* + Portions from http://www.adp-gmbh.ch/cpp/common/base64.html + Copyright notice: + + base64.cpp and base64.h + + Copyright (C) 2004-2008 Rene Nyffenegger + + This source code is provided 'as-is', without any express or implied + warranty. In no event will the author be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this source code must not be misrepresented; you must not + claim that you wrote the original source code. If you use this source code + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original source code. + + 3. This notice may not be removed or altered from any source distribution. + + Rene Nyffenegger rene.nyffenegger@adp-gmbh.ch +*/ + +#ifndef WEBCPP_BEAST_BACKEND_DETAIL_BASE64_IPP +#define WEBCPP_BEAST_BACKEND_DETAIL_BASE64_IPP + +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace detail { + +namespace base64 { + +char const* +get_alphabet() +{ + static char constexpr tab[] = { + "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/" + }; + return &tab[0]; +} + +signed char const* +get_inverse() +{ + static signed char constexpr tab[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0-15 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 16-31 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, // 32-47 + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, // 48-63 + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79 + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, // 80-95 + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111 + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, // 112-127 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 128-143 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 144-159 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 160-175 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 176-191 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 192-207 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 208-223 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 224-239 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // 240-255 + }; + return &tab[0]; +} + +/** Encode a series of octets as a padded, base64 string. + + The resulting string will not be null terminated. + + @par Requires + + The memory pointed to by `out` points to valid memory + of at least `encoded_size(len)` bytes. + + @return The number of characters written to `out`. This + will exclude any null termination. +*/ +std::size_t +encode(void* dest, void const* src, std::size_t len) +{ + char* out = static_cast(dest); + char const* in = static_cast(src); + auto const tab = base64::get_alphabet(); + + for(auto n = len / 3; n--;) + { + *out++ = tab[ (in[0] & 0xfc) >> 2]; + *out++ = tab[((in[0] & 0x03) << 4) + ((in[1] & 0xf0) >> 4)]; + *out++ = tab[((in[2] & 0xc0) >> 6) + ((in[1] & 0x0f) << 2)]; + *out++ = tab[ in[2] & 0x3f]; + in += 3; + } + + switch(len % 3) + { + case 2: + *out++ = tab[ (in[0] & 0xfc) >> 2]; + *out++ = tab[((in[0] & 0x03) << 4) + ((in[1] & 0xf0) >> 4)]; + *out++ = tab[ (in[1] & 0x0f) << 2]; + *out++ = '='; + break; + + case 1: + *out++ = tab[ (in[0] & 0xfc) >> 2]; + *out++ = tab[((in[0] & 0x03) << 4)]; + *out++ = '='; + *out++ = '='; + break; + + case 0: + break; + } + + return out - static_cast(dest); +} + +/** Decode a padded base64 string into a series of octets. + + @par Requires + + The memory pointed to by `out` points to valid memory + of at least `decoded_size(len)` bytes. + + @return The number of octets written to `out`, and + the number of characters read from the input string, + expressed as a pair. +*/ +std::pair +decode(void* dest, char const* src, std::size_t len) +{ + char* out = static_cast(dest); + auto in = reinterpret_cast(src); + unsigned char c3[3], c4[4] = {0,0,0,0}; + int i = 0; + int j = 0; + + auto const inverse = base64::get_inverse(); + + while(len-- && *in != '=') + { + auto const v = inverse[*in]; + if(v == -1) + break; + ++in; + c4[i] = v; + if(++i == 4) + { + c3[0] = (c4[0] << 2) + ((c4[1] & 0x30) >> 4); + c3[1] = ((c4[1] & 0xf) << 4) + ((c4[2] & 0x3c) >> 2); + c3[2] = ((c4[2] & 0x3) << 6) + c4[3]; + + for(i = 0; i < 3; i++) + *out++ = c3[i]; + i = 0; + } + } + + if(i) + { + c3[0] = ( c4[0] << 2) + ((c4[1] & 0x30) >> 4); + c3[1] = ((c4[1] & 0xf) << 4) + ((c4[2] & 0x3c) >> 2); + c3[2] = ((c4[2] & 0x3) << 6) + c4[3]; + + for(j = 0; j < i - 1; j++) + *out++ = c3[j]; + } + + return {out - static_cast(dest), + in - reinterpret_cast(src)}; +} + +} // base64 + +} // detail +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/core/detail/bind_continuation.hpp b/include/webcpp/beast/detail/backend/core/detail/bind_continuation.hpp new file mode 100644 index 0000000..7609db7 --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/detail/bind_continuation.hpp @@ -0,0 +1,110 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_DETAIL_BIND_CONTINUATION_HPP +#define WEBCPP_BEAST_BACKEND_DETAIL_BIND_CONTINUATION_HPP + +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace detail { + +#if 0 +/** Mark a completion handler as a continuation. + + This function wraps a completion handler to associate it with an + executor whose `post` operation is remapped to the `defer` operation. + It is used by composed asynchronous operation implementations to + indicate that a completion handler submitted to an initiating + function represents a continuation of the current asynchronous + flow of control. + + @param handler The handler to wrap. + The implementation takes ownership of the handler by performing a decay-copy. + + @see + + @li [N4242] Executors and Asynchronous Operations, Revision 1 +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +__implementation_defined__ +#else +net::executor_binder< + typename std::decay::type, + detail::remap_post_to_defer< + net::associated_executor_t>> +#endif +bind_continuation(CompletionHandler&& handler) +{ + return net::bind_executor( + detail::remap_post_to_defer< + net::associated_executor_t>( + net::get_associated_executor(handler)), + std::forward(handler)); +} + +/** Mark a completion handler as a continuation. + + This function wraps a completion handler to associate it with an + executor whose `post` operation is remapped to the `defer` operation. + It is used by composed asynchronous operation implementations to + indicate that a completion handler submitted to an initiating + function represents a continuation of the current asynchronous + flow of control. + + @param ex The executor to use + + @param handler The handler to wrap + The implementation takes ownership of the handler by performing a decay-copy. + + @see + + @li [N4242] Executors and Asynchronous Operations, Revision 1 +*/ +template +#if WEBCPP_BEAST_BACKEND_DOXYGEN +__implementation_defined__ +#else +net::executor_binder::type, + detail::remap_post_to_defer> +#endif +bind_continuation( + Executor const& ex, CompletionHandler&& handler) +{ + return net::bind_executor( + detail::remap_post_to_defer(ex), + std::forward(handler)); +} +#else +// VFALCO I turned these off at the last minute because they cause +// the completion handler to be moved before the initiating +// function is invoked rather than after, which is a foot-gun. +// +// REMINDER: Uncomment the tests when this is put back +template +F&& +bind_continuation(F&& f) +{ + return std::forward(f); +} +#endif + +} // detail +} // beast +} // boost + +#endif diff --git a/include/webcpp/beast/detail/backend/core/detail/bind_handler.hpp b/include/webcpp/beast/detail/backend/core/detail/bind_handler.hpp new file mode 100644 index 0000000..dc7135d --- /dev/null +++ b/include/webcpp/beast/detail/backend/core/detail/bind_handler.hpp @@ -0,0 +1,321 @@ +// Generated by upstream/sync.py; edit its pinned inputs, not this file. +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +#ifndef WEBCPP_BEAST_BACKEND_DETAIL_BIND_HANDLER_HPP +#define WEBCPP_BEAST_BACKEND_DETAIL_BIND_HANDLER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace webcpp { namespace beast_backend { +namespace detail { + +//------------------------------------------------------------------------------ +// +// bind_handler +// +//------------------------------------------------------------------------------ + +template +class bind_wrapper +{ + using args_type = detail::tuple; + + Handler h_; + args_type args_; + + template