Comments (7)
You can utilize a http::buffer_body and a fixed size buffer for that purpose, these examples might help:
https://www.boost.org/doc/libs/1_84_0/libs/beast/doc/html/beast/more_examples/http_relay.html
https://www.boost.org/doc/libs/1_84_0/libs/beast/doc/html/beast/using_http/parser_stream_operations/incremental_read.html
from beast.
file_body
can do exactly what you say
from beast.
file_body
can do exactly what you say
If I understand correctly, they want to use boost::asio::stream_file
and perform the write operation asynchronously.
from beast.
@vinniefalco @ashtum I don't need async write operation. If I understand file_body correctly, it is only the body content that is serialized to file, while I need the entire request serialized to a single file. Is my understanding of file_body correct?
I'm trying the HTTP Relay example now, it does look like exactly what I'm after, but if there are simpler/better/more efficient solutions I'd love to learn about them :)
from beast.
You want your file to have the HTTP headers?
from beast.
@vinniefalco Well, yes I do. Serializing the whole request to a single file for later processing instead of spreading it across multiple files makes it a bit easier to keep track. I might change it, but it's what I currently do. The HTTP Relay example was perfect - thanks @ashtum :)
from beast.
No the relay example is not perfect. If you want the HTTP headers in the file then you should do the following:
- read the header
- write the header to a new file yourself
- read the rest of the body, appending into the new file using
file_body
with a single call tohttp::async_read
Thanks
from beast.
Related Issues (20)
- How to establish mapping between C++ classes and database tables using Boost Beast. HOT 3
- Any possibility to make dependency on Boost not required(like ASIO does)? HOT 2
- Chat-Multi Code of Boost Beast is crashing when made some changes. HOT 5
- Question about field used hash function HOT 6
- Web link is broken HOT 1
- Websocket Async Client as a DLL HOT 1
- CI should build documentation on Windows platform
- Beast Server Exits for reasons that Client is disconnecting? HOT 2
- Any benefit to multiple sockets between a server and a single client instance using Boost Beast? HOT 4
- Using a minimal executor causes compile errors with beast::websocket HOT 3
- How to check whether there is any available data on the stream HOT 4
- [HELP] Server heartbeat and response HOT 2
- Limitation of `websocket::stream::accept(...)` and `websocket::stream::async_accept(...)`. HOT 3
- Session communication without Mutex? HOT 4
- The beast Server Exits frequently HOT 3
- Beast shouldn't have a root Jamfile
- Timeout for async_write, which must not happen at all HOT 7
- stream.async_connect() ambiguous overload with asio::as_tuple(asio::use_awaitable) HOT 3
- The `http_client_sync_ssl` example doesn't seem to work with Python's basic HTTPS server HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beast.