Questions tagged [beast]

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
1

votes
1

answer
186

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
1

votes
2

answer
203

Views

Boost beast compilation error

d:\boost\boost\beast\core\detail\ostream.hpp(263): error C2955: 'boost::beast::detail::ostream_helper': use of class template requires template argument list When compiling example project: http_server_small.cpp (from 'beast') boost\beast\core\detail\ostream.hpp: template ostream_helper:: ostream_he...
Yuri Yaryshev
1

votes
1

answer
81

Views

bad_weak_ptr while using class inheriting from boost::asio::io_context::service

I started to practice using boost asio & boost beast to develop my own basic server and connection class. Recently I've encountered bad_weak_ptr exception and I can't figure out how to manage the problem. Here is the code: class server : public boost::asio::io_context::service { tcp::endpoint endpoi...
0x07
1

votes
1

answer
212

Views

boost beast websocket connection close handler

I am new to boost and i am trying to write a simple chat application for websocket. For reference i'm using the websocket-server-sync example from the website. I made a global vector that stores websocket::streams, and in the do_session method after creating the websocket i push it in the vector. st...
iron24
1

votes
1

answer
41

Views

using different request parser depending on the queried route

I'm Implementing a mini http server using boost beast. the server has two different routes POST /upload/... and the other one is POST /info. The first one is used for uploading some big files and the other one is for hadling json objects. To keep the performance as hight as possible am I trying to...
Mohamed El
1

votes
1

answer
35

Views

Store a STL map into a Boost ConstBufferSequence

I'm trying to store a std::map in a boost::beast::multi_buffer. So far I've been using boost::asio::buffer_copy and boost::asio::buffer to store vectors and PODs. However, I couldn't find a way to store a STL map. I've tried this: auto t_map = std::map(); // CODES is an enum type auto t_map_size = t...
Shmwel
1

votes
3

answer
57

Views

Using Boost::Beast for CPU-heavy REST APIs, Should I use Async or Sync way to implement them to expect the better latency?

I'm trying to use boost::beast to implement a web service providing some REST APIs. These APIs are CPU-heavy, almost no disk or db I/O. My goal is to optimize for latency with OK throughput. Should I use sync or async way to implement them? Thanks!
NonStatic
1

votes
2

answer
41

Views

Call a boost function without callback

I am using boost-beast library for a websocket connection. You can refer to this example for the understanding what is happening. I have used the same example, but changed a few things: split the on_handshake(beast::error_code ec) into three functions A(beast::error_code ec),B(beast::error_code ec)...
RC0993

View additional questions