|
| ~parser ()=default |
| Destructor. More...
|
|
| parser () |
| Constructor. More...
|
|
| parser (parser const &)=delete |
| Constructor. More...
|
|
parser & | operator= (parser const &)=delete |
| Assignment. More...
|
|
| parser (parser &&other)=default |
|
template<class Arg1 , class... ArgN, class = typename std::enable_if< ! detail::is_parser<typename std::decay<Arg1>::type>::value>::type> |
| parser (Arg1 &&arg1, ArgN &&...argn) |
|
template<class OtherBody , class... Args, class = typename std::enable_if< ! std::is_same<Body, OtherBody>::value>::type> |
| parser (parser< isRequest, OtherBody, Allocator > &&parser, Args &&...args) |
|
value_type const & | get () const |
|
value_type & | get () |
|
value_type | release () |
|
template<class Callback > |
void | on_chunk_header (Callback &cb) |
|
template<class Callback > |
void | on_chunk_body (Callback &cb) |
|
| basic_parser (basic_parser const &)=delete |
| Constructor. More...
|
|
| basic_parser () |
| Constructor. More...
|
|
| basic_parser (basic_parser< isRequest, OtherDerived > &&) |
|
| ~basic_parser () |
| Destructor. More...
|
|
basic_parser & | operator= (basic_parser const &)=delete |
| Constructor. More...
|
|
basic_parser & | base () |
|
basic_parser const & | base () const |
|
bool | got_some () const |
| Returns true if the parser has received at least one byte of input. More...
|
|
bool | is_done () const |
|
bool | is_header_done () const |
|
bool | is_upgrade () const |
|
bool | is_chunked () const |
|
bool | is_keep_alive () const |
|
boost::optional< std::uint64_t > | content_length () const |
|
bool | need_eof () const |
|
void | body_limit (std::uint64_t v) |
|
void | header_limit (std::uint32_t v) |
|
bool | eager () const |
| Returns true if the eager parse option is set. More...
|
|
void | eager (bool v) |
|
bool | skip () |
| Returns true if the skip parse option is set. More...
|
|
void | skip (bool v) |
|
std::size_t | put (ConstBufferSequence const &buffers, error_code &ec) |
|
std::size_t | put (boost::asio::const_buffers_1 const &buffer, error_code &ec) |
|
void | put_eof (error_code &ec) |
|
template<bool isRequest, class Body, class Allocator = std::allocator<char>>
class boost::beast::http::parser< isRequest, Body, Allocator >
An HTTP/1 parser for producing a message.
This class uses the basic HTTP/1 wire format parser to convert a series of octets into a message using the basic_fields container to represent the fields.
- Template Parameters
-
isRequest | Indicates whether a request or response will be parsed. |
Body | The type used to represent the body. This must meet the requirements of Body. |
Allocator | The type of allocator used with the basic_fields container. |
- Note
- A new instance of the parser is required for each message.
template<bool isRequest, class Body , class Allocator>
template<class OtherBody , class... Args, class >
Construct a parser from another parser, changing the Body type.
This constructs a new parser by move constructing the header from another parser with a different body type. The constructed-from parser must not have any parsed body octets or initialized BodyWriter, otherwise an exception is generated.
- Example
request_parser<empty_body> req0;
...
If an exception is thrown, the state of the constructed-from parser is undefined.
- Parameters
-
parser | The other parser to construct from. After this call returns, the constructed-from parser may only be destroyed. |
args | Optional arguments forwarded to the message constructor. |
- Exceptions
-
std::invalid_argument | Thrown when the constructed-from parser has already initialized a body writer. |
- Note
- This function participates in overload resolution only if the other parser uses a different body type.
template<bool isRequest, class Body, class Allocator = std::allocator<char>>
template<class Callback >
Set a callback to be invoked on chunk body data
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.
- Example
auto callback =
{
};
parser.on_chunk_body(callback);
- Parameters
-
cb | The function to set, which must be invocable with this equivalent signature: std::size_t std::uint64_t remain, |
template<bool isRequest, class Body, class Allocator = std::allocator<char>>
template<class Callback >
Set a callback to be invoked on each chunk header.
The callback will be invoked once for every chunk in the message payload, as well as once for the last chunk. The invocation happens after the chunk header is available but before any body octets have been parsed.
The extensions are provided in raw, validated form, use chunk_extensions::parse to parse the extensions into a structured container for easier access. The implementation type-erases the callback without requiring a dynamic allocation. For this reason, the callback object is passed by a non-constant reference.
- Example
auto callback =
{
};
parser.on_chunk_header(callback);
- Parameters
-
cb | The function to set, which must be invocable with this equivalent signature: |
template<bool isRequest, class Body, class Allocator = std::allocator<char>>
Returns ownership of the parsed message.
Ownership is transferred to the caller. Depending on the parser's progress, parts of this object may be incomplete.
- Requires
value_type is MoveConstructible