319 questions
1 vote
1 answer
92 views
Monitor boost io_context availability
I want to set up a watchdog that checks whether the io_context workers can pick up tasks within a reasonable time and are not stuck running long or blocking operations. To achieve this, I've ...
2 votes
1 answer
74 views
Boost.Beast async_connect fails after upgrading Boost 1.78 to 1.89
I have a Websocket class that connects asynchronously using Boost.Asio and Boost.Beast. The following code was working fine with Boost 1.78, but after updating to the latest Boost version, I now get a ...
2 votes
1 answer
169 views
How to parse multipart/form-data from http::request<http::string_body> object?
I am reading a http::request<http::string_body> request from the network using boost::beast, which is of type multipart/form-data. The request contains files and strings. How can I get each part ...
3 votes
1 answer
101 views
Why prepare_payload removes Transfer-Encoding: chunked from http::response?
I create http::response<string_body> and call prepare_payload() after the response is built like this http::response<http::string_body> res; res.version(11); res.result(http::status::ok); ...
3 votes
1 answer
99 views
Is it correct to reset the connection in websocket::stream_base::decorator callback?
I have a websocket server where I call websocket::stream::async_accept to perform a handshake with the client. I also set a decorator to modify the headers like this conn->get_websocket_stream()....
4 votes
1 answer
64 views
Does http::response_parser inherits limits from source parser?
I create http::response_parser<http::buffer_body> and set header_limit and body_limit like this auto parser = std::make_shared<http::response_parser<http::buffer_body>>(); parser->...
2 votes
1 answer
109 views
call ssl::stream::async_shutdown after read operation cancelled
I have one active async operation, it is http::async_read. At the moment when I want to close the ssl connection, I cancel this async operation on the socket by calling ip::tcp::socket::cancel. Then I ...
3 votes
1 answer
59 views
Correct way to convert http::response_parser<http::buffer_body> to http::response_parser<http::string_body>
I have a response parser of type http::response_parser<http::buffer_body>, which I need to convert to a parser of type http::response_parser<http::string_body>. I do the conversion after ...
2 votes
1 answer
119 views
Access the http response body before the entire response has been read
I need to read the response from an HTTP server like this: first call boost::beast::http::async_read_header to get headers, then read the response body (if any). To read the body I use boost::beast::...
0 votes
0 answers
77 views
control_callback is not called after sending close frame
The documentation for websocket::stream::async_close says: This function is used to asynchronously send a close frame, which begins the websocket closing handshake. The session ends when both ends of ...
2 votes
1 answer
80 views
Call async_ping and/or async_close when there is an incompleted async_write operation
The boost documentation has me confused. The boost 1.68.0 documentation for websocket::stream::async_ping says: This operation is implemented in terms of one or more calls to the next layer's ...
3 votes
1 answer
160 views
Correct use of ping/async_ping with websockets
Let's say we have a websocket client based on boost::beast. At some point we want to send a ping frame to the server. To do this, boost::beast::websocket::stream offers two options: Use the ping ...
3 votes
1 answer
152 views
Correct way to read & write data to boost::beast::websocket::stream
When we write data to plain socket or ssl::stream, it is recommended to use message queue to send data. In this case, I store messages in queue of type std::queue<std::string> and generally use ...
2 votes
1 answer
78 views
How to read and modify boost::beast::flat_buffer
I need to read data from boost::beast::flat_buffer into a std::string, then modify the string object and write the result back into boost::beast::flat_buffer. To convert boost::beast::flat_buffer into ...
1 vote
1 answer
106 views
What exactly boost::beast::websocket::stream::set_option method does do
That's how documentation describes boost::beast::websocket::stream::set_option: Set the permessage-deflate extension options. https://live.boost.org/doc/libs/1_68_0/libs/beast/doc/html/beast/ref/...