class request_parser - 5cript/attender GitHub Wiki

class request_parser

Summary

Members Descriptions
public request_parser()
public bool feed(http_connection_interface * connection)
public request_header get_header() const
public bool finished() const
public std::string & get_buffer() Returns the header buffer.
public std::string read_front(size_type length) Returns the first 'length' bytes from the header buffer and remote this from the buffer.
public bool is_buffer_empty() const
public void rewind() Rewind the header parser to header entries.
public boost::optional< std::string > get_field(std::string const & key) const

Members


public request_parser()


public bool feed(http_connection_interface * connection)

Returns: Returns true if the parser finished parsing the header.


public request_header get_header() const

Returns: Returns the parsed header.


public bool finished() const

Returns: Returns true, if the header end was consumed by the parser.


public std::string & get_buffer()

Returns the header buffer.

The parser will consume from the front and upon finishing, this buffer will contain the rest that potentially contains the body.


public std::string read_front(size_type length)

Returns the first 'length' bytes from the header buffer and remote this from the buffer.

Parameters

  • length The amount of bytes to read and remove.

Returns: Returns the read string. Warning: this might be smaller than 'length'.


public bool is_buffer_empty() const

Returns: get_buffer().empty();


public void rewind()

Rewind the header parser to header entries.

Required for 100-continue.


public boost::optional< std::string > get_field(std::string const & key) const

Parameters

  • key A header entry key, such as "Content-Length"

Returns: Returns the value associated with the key.