Questions tagged [beast]

1

votes
1

answer
288

Views

HTTP Pipelining vs. WebSocket in Boost.Beast advanced server example

I have a question to this Boost.Beast example: https://github.com/boostorg/beast/blob/908f84cb3c023ed7c5bd19e2e5283d3218a6d820/example/advanced/server/advanced_server.cpp In line 643 a WebSocket upgrade is done. However, if I understand it correctly, there may still be HTTP write commands in the que...
Benjamin Buch
1

votes
1

answer
43

Views

Multiple subscriptions with different subscription rate design through boost::beast

I am trying to design a system where I am creating a tree like structure and users can subscribe to any branch of the tree. Ex: If a tree looks like A--B--C | D Here A is the parent of B and B is the parent of C and D Now, a user places a subscription request of 5 seconds on the branch A-B-D. A 5 se...
Shubhi Agarwal
1

votes
2

answer
262

Views

Boost::Beast Non Blocking Read for Websockets?

We have an app that is entirely synchronous, and will always be because it is basically a command line interpreter to send low level commands to our hardware, and you cant have two commands going to the hardware at the same time. I will only ever have 1 client socket for this configuration operating...
user1024792
1

votes
0

answer
114

Views

Boost.Beast C4702 “unreachable” compiler warning on MSVC++ build

Building with Boost-1.67.0 and VS on Windows, I get a C4702 'unreachable' warning for boost::beast::http::detail::verb_to_string(verb v), in boost/beast/http/impl/verb.ipp: template inline string_view verb_to_string(verb v) { switch(v) { case verb::delete_: return 'DELETE'; case verb::get:...
badfd
1

votes
1

answer
163

Views

Angular5 + SocketIO to Boost::Beast

So i am using the tutorial here to setup my socket.io connection using Angular 5.x https://blog.codewithdan.com/2017/11/07/pushing-real-time-data-to-an-angular-service-using-web-sockets/ There are two scenarios happening and im not sure why one is working and one isnt, so im hoping someone can assis...
user1024792
1

votes
1

answer
308

Views

How to use boost::http::response_parser for parsing string?

I wanted to parse my own data using response_parser of boost::http. All the documentation I found is linked with http::request of boost. I have written my own SSLLink to get data. I want to feed the data incrementally to response_parser and check if a complete message has been parsed. I found this a...
bonacci
1

votes
1

answer
41

Views

HTTP Header Field not recognised

I'm trying to make use of boost::beast in order to communicate over HTTP with a server. I'm working on the Clientside and want to send a Request containing at least the following Header field: 'X-API-SIGNATURE'. I'm creating the Request as follows: http::request request; request.version(11); request...
Kaot
1

votes
1

answer
142

Views

Cmake ignores all my directives on where to find boost in boost::beast repository

I'm using Ubuntu 16.04 (with boost 1.58), and I have to develop a project with boost::beast. so I got the latest version of boost (1.67), and now I'm trying to compile the beast repository to play with the examples. I compiled boost in the simplest way possible. I did ./bootstrap then ./bjam, and it...
1

votes
0

answer
68

Views

Streaming some data from PHP to C++

My goal is to send, from a C++ app, a simple GET query to PHP, such as 'do re mi fa sol' and get some data I can play. The PHP script will return a stream of bytes that I will interpret in the C++ client. I read one byte to know the nature of the next segment (text or WAV audio file). I read 2 bytes...
Horsetopus
1

votes
1

answer
44

Views

What is the best way to decode Ntrip 1.0 protocal using boost::beast

I am currently using boost::beast to implement a ntrip 1.0 client. It has the request like: GET /BUCU1 HTTP/1.0 User-Agent: NTRIP GNSSInternetRadio/1.2.0 Authorization: Basic aHVnb2JlbjpodWdvYmVuMTIz And the response like: ICY 200 OK It has the non-standard http response. I as the beast http client...
Tao Li
1

votes
1

answer
95

Views

about boost beast websocket api : async_close, async_write

I have read the official document.I'm confused that the document conflict itself. Here is the document picked from the official: However, this code is well-formed: ws.async_read(b, [](error_code, std::size_t){}); ws.async_write(b.data(), [](error_code, std::size_t){}); ws.async_ping({}, {}); ws.asyn...
user9928049
1

votes
1

answer
183

Views

Boost::Beast Websocket Bidirection Stream (C++)

I'm looking into using the Boost::Beast websocket library to create an asynchronous bidirectional pipe to pass data between a server and a client. I leveraged some code from the async example (I can post some at a later time if necessary, don't have access to it now). I currently have a class which...
nhruch
1

votes
1

answer
297

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 have a variable: boost::beast::websocket::stream _ws After an async disconnect is initiated and comple...
john_zac
1

votes
0

answer
77

Views

boost::beast ws_.async_handshake breaks when synchorneous function works

I've built an app that connects to bitmex through boost::beast. The synchronous call works fine using the code provided at: https://www.boost.org/doc/libs/develop/libs/beast/example/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp however the code that does the same thing asynchronously at:...
user10055921
1

votes
1

answer
356

Views

Error reconnecting boost beast (asio) websocket and http connection after disconnect

I am creating a client application that connects to a server using a an ssl Websocket connection and an ssl Http (Keep-Alive) connection and I am using boost::beast package to do the same. So as to detect a dead connection i have implemented a simple ping-pong mechanism. These all work fine, but an...
john_zac
1

votes
1

answer
32

Views

“Body requirements not met” when passing a req to a method in c++ (Boost Beast library)

I am trying to pass a req to a method. My code is: void handle_request(boost::beast::string_view doc_root, http::request req, Send send) { some code here } but when I try to compile it, I am getting this error: 'Body requirements not met' How can I fix it? The error doesn't come from these lines, bu...
mans
2

votes
2

answer
195

Views

Boost Beast Async Server Failing with Assertion failed: (id_ != T::id) on multiple aync calls

Assertion failed: (id_ != T::id), function try_lock, file /usr/local/include/boost/beast/websocket/detail/stream_base.hpp, line 91. // Echoes back all received WebSocket messages class session : public std::enable_shared_from_this { websocket::stream ws_; boost::asio::strand< boost::asio::io_context...
VikramChopde
1

votes
1

answer
94

Views

Undefined symbol boost::system:detail::system_category_instance

I've build boost with c++17 standard with clang on macOS Mojave when compiling my playground program that uses beast and asio I get the following error: This is my make file: cmake_minimum_required (VERSION 3.13.1) project (Playground) set(Boost_USE_STATIC_LIBS ON) set(Boost_USER_MULITHREADED ON)...
Fabian
1

votes
0

answer
165

Views

C++ Boost Beast empty response body

I'm playing around with the Beast part of Boost and I'm trying to create a simple http client that can be used to /GET the content form a web resource (simple HTML or REST services). I've used the example that can be found in github repo of beast for a sync http client and moved it to a simple class...
Fabian
1

votes
1

answer
59

Views

Beast websocket idiomatic shutdown?

I have my C++ program. The main thread creates a new thread that is dedicated to only handling a websocket. This new thread reads and writes using for example boost beast's async_read() calls. It is much like https://www.boost.org/doc/libs/1_69_0/libs/beast/example/websocket/server/async/websocket_s...
user782220
1

votes
1

answer
60

Views

boost beast async_write increases memory footprint dramatically

I am currently experimenting with the boost beast library and now very surprised by it's memory footprint. I've found out by using three different response types (string, file, dynamic) the program size grows up to 6Mb. To get closer to the cause, I took the small server example from the library and...
Mohamed El
1

votes
1

answer
31

Views

How do I pass the model type in boost beast websocket

I am working with c++11, beast library and IBM speech to text web service. The websocket interface (to connect) needs the authentication token as request header while the handshake is performed. Refering to this code available in the Watson documents it looks like I have to pass the model type (if I...
RC0993
1

votes
1

answer
58

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 separated by \r\n until the connection is terminated. I managed to adapt boost beast client example t...
1

votes
0

answer
38

Views

Is it possible to handle a blocking read function with timeout?

I am working on boost websockets for asynchronous communication between the client and server. Now I am printing the time elapsed during the program with boost::timer::auto_cpu_timer. It is displaying the time elapsed in seconds. My program snippet is given below: This function sends the data to the...
RC0993
1

votes
1

answer
870

Views

SslStream, BEAST and TLS 1.1

With the recent advent of BEAST (exploits a vulnerability in SSL/TLS1.0 where the initial bytes of the payload are always the same) I looked into the SslStream class to see if it supported TLS 1.1, TLS 1.2, etc. It only supports (SslProtocol) SSL 2 and 3 (which both predate TLS) and TLS 1.0. Given t...
Jonathan Dickinson
1

votes
1

answer
107

Views

What are the requirements to read and write from an http stream (in boost::beast)?

I would like to use boost::beast to read and write to etcd. For starts, I'd like to be able to do these examples with boost beast. They're easily doable with curl. Etcd can be seen as a key/value store. The functions to set/get (put/range in the examples page) are easy to do with the boost::beast cl...
1

votes
1

answer
607

Views

How to pass read handler to async_read for Beast websocket?

How do I pass in a callback to async_read? I tried the following but it won't compile. I based this off of modifying code from the docs #include #include #include #include #include #include #include #include #include #include #include #include using tcp = boost::asio::ip::tcp; namespace...
user782220
1

votes
1

answer
273

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 in Postman with the following POST request: POST /o/oauth2/device/code HTTP/1.1 Host: accounts.google...
user2828781
1

votes
1

answer
57

Views

how to keep on websocket on boost::beast?

I referenced here documents about boost::beast websocket-async. I removed 'ws_.async_close(websocket::close_code::normal...' on on_read function in order to avoid disconnection. But beast websocket is disconnected by ending on_read. std::make_shared(ios)->run(host, port, text); ios.run(); // I want...
geeeek
1

votes
1

answer
230

Views

boost beast WebSocket upgrade handshake failed

Using the example code of boost::beast(https://www.boost.org/doc/libs/1_66_0/libs/beast/example/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp), I got: Error: WebSocket upgrade handshake failed To make sure the server is ok, i created a test using https://www.websocket.org/echo.html, and it...
定坤宋
1

votes
1

answer
377

Views

boost-beast websocket server that also accept http connections

I need to implement a simple asynchronous websocket server using boost beast that can accept both websocket and standard http connections. I've tried something like this: ... // ws is a boost::beast::websocket::stream ws.async_accept_ex( [](boost::beast::websocket::response_type& res) { res.set(boos...
1

votes
2

answer
78

Views

Why does Boost Variant use the template constructor instead of the move constructor for boost::beast::websocket::stream?

I am trying to wrap boost::beast::websocket::stream (for 2 specific T) in a boost::variant to allow treating TLS ([T = boost::asio::ssl::stream]) and non-TLS ([T = boost::asio::ip::tcp::socket]) websockets the same. I am stuck at a compilation failure. The simplest failing example that I can come up...
Chris Hunt
1

votes
2

answer
225

Views

Boost Asio and Beast mulitpart/form-data save binary from streambuf

My results look like... POST /post HTTP/1.1 Host: localhost:3003 User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0 Accept: */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://localhost:3003/profile Content-type: multipart/form...
forresttales
1

votes
1

answer
0

Views

How to read the header of a bad request in beast::websocket?

I have a websocket server(listening the loopback interface) that should respond to a GET request. Here's how I do that ws_.async_accept_ex( [self = shared_from_this()](websocket::response_type& res) // { if (res.result_int() == 400) { // bad request, assume HTTP GET osstream response; /* invoke requ...
Johnny
1

votes
1

answer
0

Views

Watson Text-to-Speech via C++ Boost Websockets - “No such host is known”

I've been unable to connect to Watson's Text-To-Speech service via websockets in C++ using the Boost Beast library I've got code that successfully interfaces with echo.websocket.org on port 80, but it does not work with Watson's url. I've tried using variants of protocols (http(s), ws(s), and unspec...
user2855323
1

votes
1

answer
0

Views

Boost beast manupulate http response headers durring accept

I would like to manipulate the http response sent to the websocket client durring accept. I've read the examples and the manual, I can pare the request, check if it's a websocket upgrade request, but I can't manipulate the response. It would be nice to have the websocket library to prepare the respo...
E.T.
1

votes
1

answer
0

Views

Two Rails applications, one userbase, looking for a simplest solution to handle this

I have two Rails applications, let's call them A and B. A has existing user base and i want these users to be able to log in to B with the username and password managed in A. B is altered version of Altered Beast forum and it would be nice if users of my application do not have to create another use...
Priit
1

votes
1

answer
2.8k

Views

OpenSSL: modes of operation in cipher suites

I am studying the BEAST attack for SSL 3.0 and TLS 1.0. To know the set of cipher suites supported by SSL 3.0, I typed in the following command: [email protected]:~$ openssl ciphers -V | grep SSLv3 0xC0,0x14 - ECDHE-RSA-AES256-SHA SSLv3 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA1 0xC0,0x0A - ECDHE-ECDS...
1

votes
1

answer
59

Views

Can't do https-request with boost beast

Im using mingw64. How can I make https-request using boost beast lib? I got code below and it works, but I recieve answer: '400 The plain HTTP request was sent to HTTPS port' What should I complete here to make https request? OpenSSL is installed. #include #include #include #include #include #i...
Eugene
1

votes
1

answer
103

Views

Boost Beast WebSockets with several indeterminate writes per read

Using boost/beast websockets in C++ I've read up on the issues with beast websockets not supporting non-blocking reads, and the fact that there's no way to check if data is available, and that doing reads and writes in separate threads is probably not thread safe. The issue I have, then, is figuring...
Jeremy Thorne

View additional questions