Add http::message_generator

This commit is contained in:
sehe
2022-05-20 17:04:57 -07:00
committed by Vinnie Falco
parent 84e689c447
commit 740879a995
10 changed files with 553 additions and 28 deletions

View File

@@ -16,6 +16,11 @@ The generator will be asked to produce buffers. The consuming code will signal
how much of the data has been consumed, and repeatedly query for buffers until
no more data is available, or the generator indicates an error condition.
In this way, serializers can be adapted as [*BuffersGenerator], for example
[link beast.ref.boost__beast__http__message_generator
`http::message_generator`] which provides a type-erased interface for a variety
of concrete http message types.
Overloads of [link beast.ref.boost__beast__write `write`] and [link
beast.ref.boost__beast__async_write `async_write`] operations are provided as
free functions. These operations will consume the output of a
@@ -33,6 +38,7 @@ In this table:
* `G` denotes a type meeting the requirements of [*BuffersGenerator].
* `g` denotes a value of type `G`.
* `c` denotes a possibly-const value of type `G`.
* `n` is a value of type `std::size_t`.
* `ec` is a value of type [link beast.ref.boost__beast__error_code `error_code&`].
@@ -46,7 +52,7 @@ In this table:
This is the type of buffer returned by `g.prepare(ec)`.
]
][
[`g.is_done()`]
[`c.is_done()`]
[`bool`]
[
Called to ask the generator for its completion status.
@@ -56,8 +62,6 @@ In this table:
[*Note:] The result of invoking `prepare` on `g` once it has completed
is unspecified.
This member function does not alter the state of the generator.
]
][
[`g.prepare(ec)`]
@@ -106,7 +110,7 @@ In this table:
]
][
[`is_buffers_generator<G>`]
[`std::true_type`]
[`std::bool_constant`]
[
An alias for `std::true_type` for `G`, otherwise an alias
for `std::false_type`.
@@ -121,7 +125,7 @@ In this table:
{
using const_buffers_type = net::const_buffer;
bool is_done();
bool is_done() const;
const_buffers_type prepare( error_code& ec );
void consume( std::size_t n );
};
@@ -132,6 +136,8 @@ In this table:
[heading Models]
* [link beast.ref.boost__beast__http__message_generator `http::message_generator`]
[heading Algorithms]
* [link beast.ref.boost__beast__async_write `async_write`]

View File

@@ -205,6 +205,7 @@
<member><link linkend="beast.ref.boost__beast__http__file_body">file_body</link></member>
<member><link linkend="beast.ref.boost__beast__http__header">header</link></member>
<member><link linkend="beast.ref.boost__beast__http__message">message</link></member>
<member><link linkend="beast.ref.boost__beast__http__message_generator">message_generator</link></member>
<member><link linkend="beast.ref.boost__beast__http__parser">parser</link></member>
<member><link linkend="beast.ref.boost__beast__http__request">request</link></member>
<member><link linkend="beast.ref.boost__beast__http__request_header">request_header</link></member>