| Home | Libraries | People | FAQ | More

#### http::parser

An HTTP/1 parser for producing a message.

##### Synopsis

Defined in header `<boost/beast/http/parser.hpp>`

    template<
        bool isRequest,
        class Body,
        class Allocator = std::allocator<char>>
    class parser :
        public http::basic_parser< isRequest >

##### Types

Name | Description
--- | ---
is_request | true if this parser parses requests, false for responses.
value_type | The type of message returned by the parser.

##### Member Functions

Name | Description
--- | ---
body_limit | Set the limit on the payload body.
chunked | Returns true if the last value for Transfer-Encoding is "chunked".
content_length | Returns the optional value of Content-Length if known.
eager | Returns true if the eager parse option is set. Set the eager parse option.
get | Returns the parsed message.
got_some | Returns true if the parser has received at least one byte of input.
header_limit | Set a limit on the total size of the header.
is_done | Returns true if the message is complete.
is_header_done | Returns true if a the parser has produced the full header.
keep_alive | Returns true if the message has keep-alive connection semantics.
need_eof | Returns true if the message semantics require an end of file.
on_chunk_body | Set a callback to be invoked on chunk body data.
on_chunk_header | Set a callback to be invoked on each chunk header.
operator= | Assignment (disallowed)
parser | Constructor (disallowed) Constructor. Construct a parser from another parser, changing the Body type.
put | Write a buffer sequence to the parser.
put_eof | Inform the parser that the end of stream was reached.
release | Returns ownership of the parsed message.
skip | Returns true if the skip parse option is set. Set the skip parse option.
upgrade | Returns true if the message is an upgrade message.
~parser | Destructor.

##### Description

This class uses the basic HTTP/1 wire format parser to convert a series of octets into a `http::message` using the `http::basic_fields` container to represent the fields.

##### Template Parameters

Type | Description
--- | ---
`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 `http::basic_fields` container.

##### Remarks

A new instance of the parser is required for each message.

Convenience header `<boost/beast/http.hpp>`