43 questions
3
votes
1
answer
2k
views
How do I make this HTTPS connection persistent in Beast?
I'm making about 30,000 queries to a GraphQL server; because I have a high-latency connection, I'm doing many queries in parallel, using threads. Currently each query makes a new connection; I'd like ...
2
votes
1
answer
2k
views
boost::beast http chunked response buffer
I have response parser boost::beast::http::parser<false, boost::beast::http::buffer_body>. As i understand, buffer_body means that the response body data should be stored in the user-provided ...
1
vote
1
answer
1k
views
Chrome DevTools Protocol using Boost Beast
I`m trying to use a web socket client that connects to a server using Boost library. The situation is that the server sometimes sends pre-determined amounts of JSON messages, but sometimes more.
From ...
10
votes
2
answers
12k
views
C++ Send data in body with Boost.asio and Beast library
I've to use a C++ library for sending data to a REST-Webservice of our company.
I start with Boost and Beast and with the example given here under Code::Blocks in a Ubuntu 16.04 enviroment.
The ...
5
votes
1
answer
5k
views
Boost Beast Async Websocket Server How to interface with session?
So I don't know why but I can't wrap my head around the boost Beast websocket server and how you can (or should) interact with it.
The basic program I made looks like this, across 2 classes (...
4
votes
1
answer
5k
views
C++ Boost 1.66 using Beast http request Parser for parsing an string
I'm not using beast http server in my project but I was searching for a solution to parse an http request in form of std::string in my program ,is it possible to use boost/beast/http/parser.hpp in ...
3
votes
1
answer
6k
views
io_context.run() in a separate thread blocks
I have a RESTServer.hpp implemented using boost.beast as shown below.
#pragma once
#include <boost/property_tree/json_parser.hpp>
#include <boost/beast/core.hpp>
#include <boost/beast/...
3
votes
1
answer
2k
views
How to co_await for a change in a variable using boost coroutine ts?
Context
I build a webserver using boost coroutine ts, boost asio and boost beast.
There is a coroutine for reading and one for writing.
There is a message_to_send queue where messages get pushed to ...
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 ...
2
votes
1
answer
843
views
Why is `net::dispatch` needed when the I/O object already has an executor?
I'm learning Boost.Beast & Boost.Asio from this example libs/beast/example/http/server/async-ssl/http_server_async_ssl.cpp - 1.77.0.
As far as I know, all I/O operations that happen on a I/O ...
1
vote
1
answer
2k
views
boost-beast specify source endpoint to bind to
I'm using boost::beast for TCP connections, with an async flow. I'm wondering what the most appropriate way is to specify the source IP/port to bind to.
I illustrate one attempt below,
...
1
vote
2
answers
2k
views
Boost Beast, Handshake, Keep-Alive
I am trying to setup a service for interrogating a distant database based on Boost Beast.
Even if the context and the issues are totally different, I have found this question on SO:
HTTP Delay from ...
1
vote
2
answers
1k
views
how do i return the response back to caller asynchronously using a final callback dispatched from on_read handler?
I need to expose an async REST api for c++ clients, that internally uses boost::beast for sending REST requests / receiving responses.
The starting point is http_client_async.cpp example.
Now the ...
6
votes
1
answer
3k
views
Boost::beast: Multiple async_write calls are firing an assertion error
I'm writing tests for my full-duplex server, and when I do multiple (sequential) async_write calls (although covered with a strand), I get the following assertion error from boost::beast in the file ...
6
votes
1
answer
3k
views
Problems making a sync http request through proxy using Boost Beast
I've modified the http_sync example to connect through a proxy, I've tested with wireshark and the problem is that after I send the http connect request, the proxy returns with the code 200 OK, and my ...
5
votes
0
answers
2k
views
Boost Beast reconnect websocket connection after close
I am using boost::beast to create a websocket connection and so far it seems to work fine. But I am unable to figure out if i should replace the websocket::stream variable after disconnect.
i.e. I ...
4
votes
2
answers
767
views
HTTP Delay from AWS Instance to Bitmex with Boost Beast and Ubuntu 18
I have an AWS ec2 instance in eu-west-1c which is the same data centre as the target server - www.bitmex.com. If I run $ping bitmex.com from the instance the average round trip time is ~0.4 ...
4
votes
1
answer
3k
views
Device or resource busy in container from scratch and alpine, but not on ubuntu
I edited the question, but my problem was manifesting itself in an alpine container. I now get the same problem in a container from scratch. This is the same question but a bit more narrowed down.
As ...
4
votes
1
answer
2k
views
Why does Boost-Beast give me a partial message exception
I´m trying to use the boost beast http library for an HTTP Client. It´s working without any issues when I´m using a simulated server, however when I try connecting to the real server, boost::beast::...
4
votes
1
answer
2k
views
SSL tunnel with Boost::Beast
I want to connect to a proxy server that only allows HTTP connections, to speak with the target server by HTTPS.
The proxy server documentation states that the only way to do that is by means of the ...
3
votes
1
answer
2k
views
gmock SetArgReferee: Set a non-copyable non-moveable object
I'm using gmock and have mocked a function that takes
boost::beast::http::response_parser as an out parameter. Function
signature looks something like:
error_code readFromSocket(boost::beast::http::...
3
votes
1
answer
598
views
boost async ws server checking client information
How do i check client information as user-agent from boost async web socket server ?
I have checked:
https://www.boost.org/doc/libs/develop/libs/beast/example/websocket/server/async/...
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
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
1k
views
boost beast memory usage for bulk requests
I run this
boost-beast-client-async-ssl example and it's OK. But, if I create 10000 sessions at same time, my program memory usage grows up to 400 MB and never down. I'd test without ssl (simple ...
2
votes
1
answer
598
views
Does mulithreaded http processing with boost asio require strands?
In the boost asio documentation for strands it says:
Strands may be either implicit or explicit, as illustrated by the following alternative approaches:
...
Where there is a single chain of ...
2
votes
2
answers
2k
views
Boost Beast async_write() With Queue
I have the following code:
std::queue< nlohmann::json > outgoingMessages;
void session::do_write( void ) {
if ( outgoingMessages.size() > 0 ) {
auto message = outgoingMessages....
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::...
2
votes
2
answers
2k
views
How do I avoid body_limit error in boost's beast and correctly handle large messages
I have cases when there is a chunked response which is too big for beast, and I want to stop before I get to beast's body_limit, and continue handling the message from that point using plain boost::...
2
votes
2
answers
999
views
Using Tcp timeout in beast 1.70.0
I have just now updated the boost library from 1.68.0 to 1.70.0 to get the timeouts operations in (beast) websocket ssl client async example.
In the above link you will see:
void
on_resolve(
...
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/...
1
vote
1
answer
2k
views
OAuth2 with beast boost returns temporary redirect 307
I'm trying to implement an app with access to google drive in beast boost C++ usingoauth2 authentication.
https://developers.google.com/identity/protocols/OAuth2ForDevices
I try to get the user code ...
1
vote
1
answer
2k
views
How can I convert serialized data in boost::beast to a string so that I could process it in a FIFO manner?
I have an application of a client where I need to receive http "long running requests" from a server. I send a command, and after getting the header of the response, I have to just receive json data ...
1
vote
1
answer
1k
views
linking errors for boost for visual studio linux project
I am having issues compiling asio code through visual studio linux project. I keep getting the following linking error :
Linking objects
1>D:\C++\test_beastboost\test_beastboost\obj\x64\Debug\main....
1
vote
1
answer
2k
views
How does beast async_read() work & is there an option for it?
I am not very familiar with the boost::asio fundamentals. I am working on a task where I have connected to a web server and reading the response. The response is thrown at a random period, i.e. as and ...
1
vote
0
answers
615
views
Erroneous implementation of boost-beast sync http server
I'm trying to display an image file in the browser through a boost beast http server. Using the example from here I wrote the following:
#include <iostream>
#include <string>
#include <...
1
vote
1
answer
2k
views
Boost.beast : how to return json response only
code : https://gist.github.com/Naseefabu/173c928603e564879683ccdf10d9d0f8
When i run this and print the response to the console:
Sending GET /api/v3/time HTTP/1.1
Host: api.binance.com
content-type: ...
1
vote
1
answer
2k
views
boost.beast : HTTP/1.1 400 Bad Request
#include <boost/beast/http.hpp>
#include <boost/beast/ssl.hpp>
#include <boost/beast/version.hpp>
#include <boost/asio/executor.hpp>
#include <boost/asio/strand.hpp>
#...
1
vote
1
answer
1k
views
How to write content to file asynchronously with boost::beast or boost::asio?
Based on websocket_client_async_ssl.cpp, I modify the function of on_read so that I can save the content into a local file.
class session : public std::enable_shared_from_this<session>
{
std:...
1
vote
2
answers
771
views
C++ - Inconsistent behavior with Boost streambuf deflating?
Problem Statement
I'm trying to build a websocket connection to the OKEX exchange using their websocket API. I am using Boost::Beast websockets.
The problem is that OKEX's servers don't follow the ...
1
vote
0
answers
473
views
Memory leak of ssl::context using Boost::Beast
I'm attempting to solve a memory leak in my application that appears to only occur when I close the application.
I've installed Deleaker, and it's pointed me to a function I adapted from a Boost/Beast ...
0
votes
1
answer
846
views
Is boost::beast::static_string memcopyable/trivial type?
I am looking for a string implementation with fixed upper size that can be used in memcopy environment and that is trivially constructible and copyable.
I found boost beast static_string, but IDK if ...
0
votes
0
answers
221
views
Boost.best websocket ios.run() exits after sending a request and receiving one reply not receiving subsequent messages
I am using boost beast websocket to subscribe to messages by sending a subscription message and should get back subscription reply and then the subscribed messages. The subscription reply is received ...