From a12f2b8bc3171bfc6c0b49073189652f7674623a Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 5 May 2026 21:53:52 -0400 Subject: [PATCH 1/5] Generalize the socket/proxy for unified http->ws read/write/dispatch. --- .../bitcoin/network/channels/channel_http.hpp | 8 +- include/bitcoin/network/net/proxy.hpp | 4 +- include/bitcoin/network/net/socket.hpp | 20 ++-- src/channels/channel_http.cpp | 92 +++++++++---------- src/net/proxy_actions.cpp | 34 ++++++- src/net/socket.cpp | 83 +++++++++++++---- src/net/socket_http.cpp | 61 ++---------- 7 files changed, 162 insertions(+), 140 deletions(-) diff --git a/include/bitcoin/network/channels/channel_http.hpp b/include/bitcoin/network/channels/channel_http.hpp index cb4f2598b..a7e89ccbb 100644 --- a/include/bitcoin/network/channels/channel_http.hpp +++ b/include/bitcoin/network/channels/channel_http.hpp @@ -93,14 +93,12 @@ class BCT_API channel_http virtual void handle_receive(const code& ec, size_t bytes, const http::request_cptr& request) NOEXCEPT; virtual void handle_send(const code& ec, size_t bytes, - const http::response_cptr& response, - const result_handler& handler) NOEXCEPT; + const std::string& message, const result_handler& handler) NOEXCEPT; private: void handle_unauthorized(const code& ec) NOEXCEPT; - void log_message(const http::request& request, - size_t bytes) const NOEXCEPT; - void log_message(const http::response& response, + std::string log_message(const http::response& response) const NOEXCEPT; + std::string log_message(const http::request& request, size_t bytes) const NOEXCEPT; // This is thread safe. diff --git a/include/bitcoin/network/net/proxy.hpp b/include/bitcoin/network/net/proxy.hpp index fd18eb1c1..7b801c7e7 100644 --- a/include/bitcoin/network/net/proxy.hpp +++ b/include/bitcoin/network/net/proxy.hpp @@ -169,7 +169,7 @@ class BCT_API proxy count_handler&& handler) NOEXCEPT; /// Write http response to the socket (json buffer in body). - virtual void write(http::response& response, + virtual void write(http::response&& response, count_handler&& handler) NOEXCEPT; private: @@ -177,6 +177,8 @@ class BCT_API proxy typedef std::deque queue; // For write buffering. + void do_http_write(const http::response_ptr& response, + const count_handler& handler) NOEXCEPT; void do_ws_write(const asio::const_buffer& payload, bool binary, const count_handler& handler) NOEXCEPT; void do_tcp_write(const asio::const_buffer& payload, diff --git a/include/bitcoin/network/net/socket.hpp b/include/bitcoin/network/net/socket.hpp index e69bfa077..9974b09d3 100644 --- a/include/bitcoin/network/net/socket.hpp +++ b/include/bitcoin/network/net/socket.hpp @@ -170,7 +170,7 @@ class BCT_API socket count_handler&& handler) NOEXCEPT; /// Write http response to the socket, handler posted to socket strand. - virtual void http_write(http::response& response, + virtual void http_write(http::response&& response, count_handler&& handler) NOEXCEPT; /// Properties. @@ -203,6 +203,9 @@ class BCT_API socket /// Get the network threadpool iocontext. virtual asio::context& service() const NOEXCEPT; + /// The socket was upgraded to a websocket (requires strand). + virtual bool is_websocket() const NOEXCEPT; + protected: using ws_t = std::variant, ref>; using tcp_t = std::variant, ref>; @@ -222,9 +225,6 @@ class BCT_API socket /// The socket was upgraded to ssl (requires strand). bool is_secure() const NOEXCEPT; - /// The socket was upgraded to a websocket (requires strand). - bool is_websocket() const NOEXCEPT; - /// The socket is not upgraded (asio::socket). bool is_base() const NOEXCEPT; @@ -245,6 +245,10 @@ class BCT_API socket const count_handler& handler) NOEXCEPT; void async_write(const asio::const_buffer& buffer, bool binary, const count_handler& handler) NOEXCEPT; + void async_read_http(http::flat_buffer& buffer, http::request& request, + const count_handler& handler) NOEXCEPT; + void async_write_http(http::response&& response, + const count_handler& handler) NOEXCEPT; private: using http_parser = boost::beast::http::request_parser; @@ -339,7 +343,7 @@ class BCT_API socket void do_http_read(ref buffer, const ref& request, const count_handler& handler) NOEXCEPT; - void do_http_write(const ref& response, + void do_http_write(const http::response_ptr& response, const count_handler& handler) NOEXCEPT; // handle @@ -368,9 +372,6 @@ class BCT_API socket // read/write (tcp/ws) void handle_async(const boost_code& ec, size_t size, const count_handler& handler,const std::string& operation) NOEXCEPT; - void handle_async_read(const boost_code& ec, size_t size, - const asio::mutable_buffer& buffer, const http::flat_buffer_ptr& flat, - const count_handler& handler) NOEXCEPT; // rpc void handle_rpc_read(const code& ec, size_t bytes, @@ -383,11 +384,12 @@ class BCT_API socket void handle_body_notify(boost_code ec, size_t size, size_t total, const notify_state::ptr& out, const count_handler& handler) NOEXCEPT; - // http (generic/rpc) + // http/ws (native/rpc) void handle_http_read(const boost_code& ec, size_t size, const ref& request, const http_parser_ptr& parser, const count_handler& handler) NOEXCEPT; void handle_http_write(const boost_code& ec, size_t size, + const http::response_ptr& request, const count_handler& handler) NOEXCEPT; // utility diff --git a/src/channels/channel_http.cpp b/src/channels/channel_http.cpp index bf03585e5..15a2c01cd 100644 --- a/src/channels/channel_http.cpp +++ b/src/channels/channel_http.cpp @@ -115,7 +115,7 @@ void channel_http::handle_receive(const code& ec, size_t bytes, } reading_ = false; - log_message(*request, bytes); + LOGA(log_message(*request, bytes)); dispatch(request); } @@ -165,45 +165,38 @@ void channel_http::send(response&& response, result_handler&& handler) NOEXCEPT BC_ASSERT(stranded()); assign_json_buffer(response); - const auto out = system::move_shared(std::move(response)); - count_handler complete = std::bind(&channel_http::handle_send, - shared_from_base(), _1, _2, out, std::move(handler)); + auto message = log_message(response); - if (!out) - { - complete(error::bad_alloc, {}); - return; - } - - // response has been moved to out. - write(*out, std::move(complete)); + write(std::move(response), + std::bind(&channel_http::handle_send, + shared_from_base(), _1, _2, std::move(message), + std::move(handler))); } void channel_http::handle_send(const code& ec, size_t bytes, - const response_cptr& response, const result_handler& handler) NOEXCEPT + const std::string& message, const result_handler& handler) NOEXCEPT { - if (ec) - stop(ec); - - log_message(*response, bytes); + if (ec) stop(ec); + LOGA(boost::format(message) % bytes); handler(ec); } // private -void channel_http::assign_json_buffer(response& response) NOEXCEPT +void channel_http::assign_json_buffer(response& ) NOEXCEPT { - if (const auto& body = response.body(); - body.contains()) - { - auto& value = body.get(); - value.buffer = response_buffer_; - } + // TODO: limit to http (not full duplex safe). + ////if (const auto& body = response.body(); + //// body.contains()) + ////{ + //// auto& value = body.get(); + //// value.buffer = response_buffer_; + ////} } // unauthorized helpers // ---------------------------------------------------------------------------- -bool channel_http::unauthorized(const http::request& request) NOEXCEPT +bool channel_http::unauthorized(const request& request) NOEXCEPT { return options_.authorize() && (options_.credential() != request[field::authorization]); @@ -218,35 +211,34 @@ void channel_http::handle_unauthorized(const code& ec) NOEXCEPT // log helpers // ---------------------------------------------------------------------------- -void channel_http::log_message(const request& LOG_ONLY(request), - size_t LOG_ONLY(bytes)) const NOEXCEPT +std::string channel_http::log_message(const request& request, + size_t bytes) const NOEXCEPT { - LOG_ONLY(const auto scheme = secure() ? "https" : "http";) - LOG_ONLY(const auto version = "http/" + serialize(request.version() / 10) + - "." + serialize(request.version() % 10);) - - LOGA(scheme << " [" << request.method_string() - << "] " << version - << " (" << (request.chunked() ? "c" : serialize(bytes)) - << ") " << (request.keep_alive() ? "keep" : "drop") - << " [" << endpoint() << "]" - << " {" << (split(request[field::accept], ",").front()) << "...}" - << " " << request.target()); + const std::string scheme = secure() ? "https" : "http"; + const std::string method = request.method_string(); + const std::string keep = request.keep_alive() ? "keep" : "drop"; + const std::string size = request.chunked() ? "c" : serialize(bytes); + const std::string accept = split(request[field::accept], ",").front(); + const std::string version = "http/" + serialize(request.version() / 10) + + "." + serialize(request.version() % 10); + + return scheme + " [" + method + "] " + version + " (" + size + ") " + + keep + " [" + endpoint().to_string() + "] " + + "{" + accept + "...} " + std::string(request.target()); } -void channel_http::log_message(const response& LOG_ONLY(response), - size_t LOG_ONLY(bytes)) const NOEXCEPT +std::string channel_http::log_message(const response& response) const NOEXCEPT { - LOG_ONLY(const auto scheme = secure() ? "https" : "http";) - LOG_ONLY(const auto version = "http/" + serialize(response.version() / 10) - + "." + serialize(response.version() % 10);) - - LOGA(scheme << " [" << status_string(response.result()) - << "] " << version - << " (" << (response.chunked() ? "c" : serialize(bytes)) - << ") " << (response.keep_alive() ? "keep" : "drop") - << " [" << endpoint() << "]" - << " {" << (response[field::content_type]) << "}"); + const std::string scheme = secure() ? "https" : "http"; + const std::string status = status_string(response.result()); + const std::string keep = response.keep_alive() ? "keep" : "drop"; + const std::string version = "http/" + serialize(response.version() / 10) + + "." + serialize(response.version() % 10); + + // %1% is required placeholder for response size (filled by caller). + return scheme + " [" + status + "] " + version + " (%1%) " + + keep + " [" + endpoint().to_string() + "] " + + "{" + std::string(response[field::content_type]) + "}"; } BC_POP_WARNING() diff --git a/src/net/proxy_actions.cpp b/src/net/proxy_actions.cpp index 5e6022bd0..0a9795f1e 100644 --- a/src/net/proxy_actions.cpp +++ b/src/net/proxy_actions.cpp @@ -26,6 +26,9 @@ namespace libbitcoin { namespace network { +// Shared pointers required in handler parameters so closures control lifetime. +BC_PUSH_WARNING(NO_VALUE_OR_CONST_REF_SHARED_PTR) +BC_PUSH_WARNING(SMART_PTR_NOT_NEEDED) BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT) using namespace system; @@ -166,13 +169,38 @@ void proxy::read(http::flat_buffer& buffer, http::request& request, socket_->http_read(buffer, request, std::move(handler)); } -// Writes are composed but http is half duplex so there is no interleave risk. -void proxy::write(http::response& response, +void proxy::write(http::response&& response, count_handler&& handler) NOEXCEPT { - socket_->http_write(response, std::move(handler)); + if (socket_->is_websocket()) + { + // Pointer ships moveable message through the send queue. + const auto out = move_shared(std::move(response)); + writer call = std::bind(&proxy::do_http_write, + shared_from_this(), out, std::move(handler)); + + boost::asio::dispatch(strand(), + std::bind(&proxy::do_write, + shared_from_this(), std::move(call))); + } + else + { + // http is half duplex so there is no interleave risk. + socket_->http_write(std::move(response), std::move(handler)); + } } +// private +void proxy::do_http_write(const http::response_ptr& response, + const count_handler& handler) NOEXCEPT +{ + socket_->http_write(std::move(*response), + std::bind(&proxy::handle_write, + shared_from_this(), _1, _2, handler)); +} + +BC_POP_WARNING() +BC_POP_WARNING() BC_POP_WARNING() } // namespace network diff --git a/src/net/socket.cpp b/src/net/socket.cpp index 9d0492942..95255e743 100644 --- a/src/net/socket.cpp +++ b/src/net/socket.cpp @@ -124,6 +124,13 @@ asio::context& socket::service() const NOEXCEPT return service_; } +bool socket::is_websocket() const NOEXCEPT +{ + BC_ASSERT(stranded()); + return std::holds_alternative(socket_) || + std::holds_alternative(socket_); +} + // Context. // ---------------------------------------------------------------------------- // protected @@ -141,13 +148,6 @@ bool socket::is_secure() const NOEXCEPT std::holds_alternative(socket_); } -bool socket::is_websocket() const NOEXCEPT -{ - BC_ASSERT(stranded()); - return std::holds_alternative(socket_) || - std::holds_alternative(socket_); -} - bool socket::is_base() const NOEXCEPT { BC_ASSERT(stranded()); @@ -376,29 +376,74 @@ void socket::async_read(const asio::mutable_buffer& buffer, } } -// private -void socket::handle_async_read(const boost_code& ec, size_t size, - const asio::mutable_buffer& buffer, const http::flat_buffer_ptr& flat, +void socket::async_read_http(http::flat_buffer& buffer, http::request& request, const count_handler& handler) NOEXCEPT { BC_ASSERT(stranded()); - if (ec) + try { - handler(error::ws_to_error_code(ec), size); - return; + if (is_websocket()) + { + // The body reader processes a websocket read just like a + // beast::http::async_read but without the headers. The expected + // body type (parser) must be preselected on the request object. + body_read(buffer, request, move_copy(handler)); + } + else + { + // Explicit parser override gives access to limits. + auto parser = to_shared(); + parser->body_limit(maximum_); + parser->header_limit(limit(maximum_)); + + VARIANT_DISPATCH_FUNCTION(boost::beast::http::async_read, + get_tcp(), buffer, *parser, + std::bind(&socket::handle_http_read, + shared_from_this(), _1, _2, std::ref(request), parser, + handler)); + } } - - if (size != buffer.size()) + catch (const std::exception& e) { - handler(error::bad_size, size); - return; + LOGF("Exception @ async_read_http: " << e.what()); + handler(error::operation_failed, {}); } +} + +void socket::async_write_http(http::response&& response, + const count_handler& handler) NOEXCEPT +{ + BC_ASSERT(stranded()); - std::memcpy(buffer.data(), flat->data().data(), size); - handler(error::success, size); + try + { + if (is_websocket()) + { + // The body writer processes a websocket write just like a + // beast::http::async_write but without the headers. The expected + // body type (serializer) is determined by caller-assigned body. + body_write(std::move(response), move_copy(handler)); + } + else + { + const auto out = move_shared(std::move(response)); + VARIANT_DISPATCH_FUNCTION(boost::beast::http::async_write, + get_tcp(), *out, + std::bind(&socket::handle_http_write, + shared_from_this(), _1, _2, out, handler)); + } + } + catch (const std::exception& e) + { + LOGF("Exception @ async_write_http: " << e.what()); + handler(error::operation_failed, {}); + } } +// Handlers. +// ---------------------------------------------------------------------------- + // private void socket::handle_async(const boost_code& ec, size_t size, const count_handler& handler, const std::string& operation) NOEXCEPT diff --git a/src/net/socket_http.cpp b/src/net/socket_http.cpp index 2cd9a3a18..2dcf14836 100644 --- a/src/net/socket_http.cpp +++ b/src/net/socket_http.cpp @@ -32,7 +32,6 @@ namespace network { using namespace system; using namespace std::placeholders; -namespace beast = boost::beast; // Shared pointers required in handler parameters so closures control lifetime. BC_PUSH_WARNING(NO_VALUE_OR_CONST_REF_SHARED_PTR) @@ -56,34 +55,7 @@ void socket::do_http_read(ref buffer, const count_handler& handler) NOEXCEPT { BC_ASSERT(stranded()); - - if (is_websocket()) - { - handler(error::service_stopped, {}); - return; - } - - try - { - // Explicit parser override gives access to limits. - auto parser = to_shared(); - - // Causes http::error::body_limit on completion. - parser->body_limit(maximum_); - - // Causes http::error::header_limit on completion. - parser->header_limit(limit(maximum_)); - - VARIANT_DISPATCH_FUNCTION(beast::http::async_read, - get_tcp(), buffer.get(), *parser, - std::bind(&socket::handle_http_read, - shared_from_this(), _1, _2, request, parser, handler)); - } - catch (const std::exception& e) - { - LOGF("Exception @ do_http_read: " << e.what()); - handler(error::operation_failed, {}); - } + async_read_http(buffer.get(), request.get(), handler); } // private @@ -99,7 +71,7 @@ void socket::handle_http_read(const boost_code& ec, size_t size, return; } - if (!ec && beast::websocket::is_upgrade(parser->get())) + if (!ec && boost::beast::websocket::is_upgrade(parser->get())) { handler(set_websocket(parser->get()), size); return; @@ -118,43 +90,26 @@ void socket::handle_http_read(const boost_code& ec, size_t size, // HTTP (write). // ---------------------------------------------------------------------------- -void socket::http_write(http::response& response, +void socket::http_write(http::response&& response, count_handler&& handler) NOEXCEPT { + const auto out = move_shared(std::move(response)); boost::asio::dispatch(strand_, std::bind(&socket::do_http_write, shared_from_this(), - std::ref(response), std::move(handler))); + out, std::move(handler))); } // private -void socket::do_http_write(const ref& response, +void socket::do_http_write(const http::response_ptr& response, const count_handler& handler) NOEXCEPT { BC_ASSERT(stranded()); - - if (is_websocket()) - { - handler(error::service_stopped, {}); - return; - } - - try - { - VARIANT_DISPATCH_FUNCTION(beast::http::async_write, - get_tcp(), response.get(), - std::bind(&socket::handle_http_write, - shared_from_this(), _1, _2, handler)); - } - catch (const std::exception& e) - { - LOGF("Exception @ do_http_write: " << e.what()); - handler(error::operation_failed, {}); - } + async_write_http(std::move(*response), handler); } // private void socket::handle_http_write(const boost_code& ec, size_t size, - const count_handler& handler) NOEXCEPT + const http::response_ptr&, const count_handler& handler) NOEXCEPT { BC_ASSERT(stranded()); From 2126ed62a76a9bae21773e71e60ad8e444d997c5 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 5 May 2026 22:38:11 -0400 Subject: [PATCH 2/5] Derive body writer ws framing binary/text from body type. --- include/bitcoin/network/messages/http_body.hpp | 17 +++++++++++++++++ src/net/socket_body.cpp | 3 +-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/bitcoin/network/messages/http_body.hpp b/include/bitcoin/network/messages/http_body.hpp index 507f379b5..1efd31987 100644 --- a/include/bitcoin/network/messages/http_body.hpp +++ b/include/bitcoin/network/messages/http_body.hpp @@ -259,6 +259,23 @@ struct BCT_API body { } + inline bool binary() const NOEXCEPT + { + return std::visit(overload + { + [&](const std::monostate&) NOEXCEPT { return false; }, + [&](const empty_writer&) NOEXCEPT { return false; }, + [&](const data_writer&) NOEXCEPT { return true; }, + [&](const file_writer&) NOEXCEPT { return true; }, + [&](const span_writer&) NOEXCEPT { return true; }, + [&](const buffer_writer&) NOEXCEPT { return true; }, + [&](const string_writer&) NOEXCEPT { return false; }, + [&](const json_writer&) NOEXCEPT { return false; }, + [&](const rpc::writer&) NOEXCEPT { return false; }, + [&](const rpc::notifier&) NOEXCEPT { return false; } + }, writer_); + } + void init(boost_code& ec) NOEXCEPT; out_buffer get(boost_code& ec) NOEXCEPT; diff --git a/src/net/socket_body.cpp b/src/net/socket_body.cpp index 583b6d134..52aa2328f 100644 --- a/src/net/socket_body.cpp +++ b/src/net/socket_body.cpp @@ -166,8 +166,7 @@ void socket::do_body_write(boost_code ec, size_t total, out->more = buffer.value().second; const auto& data = buffer.value().first; - // TODO: derive websocket binary/text from body type mapping. - async_write(data, false, + async_write(data, out->writer.binary(), std::bind(&socket::handle_body_write, shared_from_this(), _1, _2, total, out, handler)); } From c6715666e21d9c97b9910a7a68c2b1257f6eae4d Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 5 May 2026 22:47:35 -0400 Subject: [PATCH 3/5] Prepare buffer.max_size() in async_read variable tcp call path. --- src/net/socket.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/net/socket.cpp b/src/net/socket.cpp index 95255e743..12a85a107 100644 --- a/src/net/socket.cpp +++ b/src/net/socket.cpp @@ -336,9 +336,8 @@ void socket::async_read(http::flat_buffer& buffer, } else { - constexpr auto size = rpc::writer::default_buffer; VARIANT_DISPATCH_METHOD(get_tcp(), - async_read_some(buffer.prepare(size), + async_read_some(buffer.prepare(buffer.max_size()), std::bind(&socket::handle_async, shared_from_this(), _1, _2, handler, "async_read_some"))); } From 2a358941763f68ba39d84cbd3a643ab075c40fea Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 5 May 2026 22:51:51 -0400 Subject: [PATCH 4/5] Whitespace. --- include/bitcoin/network/net/socket.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/bitcoin/network/net/socket.hpp b/include/bitcoin/network/net/socket.hpp index 9974b09d3..ebc3a2041 100644 --- a/include/bitcoin/network/net/socket.hpp +++ b/include/bitcoin/network/net/socket.hpp @@ -218,7 +218,6 @@ class BCT_API socket const config::address& address, const config::endpoint& endpoint, bool proxied, bool inbound) NOEXCEPT; - /// Context. /// ----------------------------------------------------------------------- From f7a75fca56fd06d39e6a75f1e5932bc2b51b3238 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 5 May 2026 23:00:11 -0400 Subject: [PATCH 5/5] Comments. --- include/bitcoin/network/net/proxy.hpp | 4 +++- include/bitcoin/network/net/socket.hpp | 2 +- src/net/proxy_actions.cpp | 2 +- src/net/socket_http.cpp | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/bitcoin/network/net/proxy.hpp b/include/bitcoin/network/net/proxy.hpp index 7b801c7e7..6cc4aeba2 100644 --- a/include/bitcoin/network/net/proxy.hpp +++ b/include/bitcoin/network/net/proxy.hpp @@ -161,14 +161,16 @@ class BCT_API proxy virtual void write(rpc::request&& notification, count_handler&& handler) NOEXCEPT; - /// HTTP (generic/rpc). + /// HTTP/WS (generic/rpc). /// ----------------------------------------------------------------------- /// Read http request from the socket, using provided buffer. + /// If socket is websocket request body type must have been set by caller. virtual void read(http::flat_buffer& buffer, http::request& request, count_handler&& handler) NOEXCEPT; /// Write http response to the socket (json buffer in body). + /// If socket is websocket body is written (headers ignored). virtual void write(http::response&& response, count_handler&& handler) NOEXCEPT; diff --git a/include/bitcoin/network/net/socket.hpp b/include/bitcoin/network/net/socket.hpp index ebc3a2041..4b2cc6591 100644 --- a/include/bitcoin/network/net/socket.hpp +++ b/include/bitcoin/network/net/socket.hpp @@ -162,7 +162,7 @@ class BCT_API socket virtual void body_notify(http::request&& notification, count_handler&& handler) NOEXCEPT; - /// HTTP (generic/rpc). + /// HTTP/WS (generic/rpc). /// ----------------------------------------------------------------------- /// Read http request from the socket, handler posted to socket strand. diff --git a/src/net/proxy_actions.cpp b/src/net/proxy_actions.cpp index 0a9795f1e..0ba82e9e6 100644 --- a/src/net/proxy_actions.cpp +++ b/src/net/proxy_actions.cpp @@ -158,7 +158,7 @@ void proxy::do_notification_write(const rpc::request_ptr& notification, shared_from_this(), _1, _2, handler)); } -// HTTP (generic/rpc). +// HTTP/WS (generic/rpc). // ---------------------------------------------------------------------------- // Method reading() is invoked directly if read() is called from strand(). diff --git a/src/net/socket_http.cpp b/src/net/socket_http.cpp index 2dcf14836..77c34572d 100644 --- a/src/net/socket_http.cpp +++ b/src/net/socket_http.cpp @@ -38,7 +38,7 @@ BC_PUSH_WARNING(NO_VALUE_OR_CONST_REF_SHARED_PTR) BC_PUSH_WARNING(SMART_PTR_NOT_NEEDED) BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT) -// HTTP (read). +// HTTP/WS (read). // ---------------------------------------------------------------------------- void socket::http_read(http::flat_buffer& buffer, @@ -87,7 +87,7 @@ void socket::handle_http_read(const boost_code& ec, size_t size, handler(code, size); } -// HTTP (write). +// HTTP/WS (write). // ---------------------------------------------------------------------------- void socket::http_write(http::response&& response,