![]() |
Home | Libraries | People | FAQ | More |
Set a callback to be invoked on chunk body data.
template< class Callback> void on_chunk_body( Callback& cb);
The provided function object will be invoked one or more times to provide buffers corresponding to the chunk body for the current chunk. The callback receives the number of octets remaining in this chunk body including the octets in the buffer provided. The callback must return the number of octets actually consumed. Any octets not consumed will be presented again in a subsequent invocation of the callback. The implementation type-erases the callback without requiring a dynamic allocation. For this reason, the callback object is passed by a non-constant reference.
auto callback = [](std::uint64_t remain, [link beast.ref.boost__beast__string_view `string_view`] [link beast.ref.boost__beast__http__field `body`], [link beast.ref.boost__beast__error_code `error_code`]& ec) { //... }; [link beast.ref.boost__beast__http__parser.parser `parser`].on_chunk_body(callback);
Name |
Description |
---|---|
|
The function to set, which must be invocable with this equivalent signature: std::size_t [link beast.ref.boost__beast__http__parser.on_chunk_header `on_chunk_header`]( std::uint64_t remain, // Octets remaining in this chunk, includes `body` [link beast.ref.boost__beast__string_view `string_view`] [link beast.ref.boost__beast__http__field `body`], // A buffer holding some or all of the remainder of the chunk body [link beast.ref.boost__beast__error_code `error_code`]& ec); // May be set by the callback to indicate an error |