Skip to content

websocketpp::http::request_reader

zaphoyd edited this page Nov 27, 2011 · 1 revision

class websocketpp::http::request_reader provides functionality for reading HTTP requests.

Types

See websocketpp::http for types defined globally for the websocketpp::http module.

Member functions

Signature Description
request() Default constructor initializes to a NULL state that is not valid for reading.
void consume(std::istream& input) Consumes bytes from input until \r\n\r\n or EOF. Throws an http::exception if the parser determines that the request so far cannot be a valid HTTP request.
bool ready() Returns whether or not the request paser is in a valid state for reading. Invalid states are: default constructed before reset has been called, after consume has been called but before enough data has been consumed to represent a complete HTTP request.
std::string get_method() const Returns the value of the current HTTP request method. E.g. GET, POST, etc
std::string get_uri() const Returns the value of the current HTTP request uri/resource
std::string get_request() const Compiles the current request and returns the raw source HTTP request source.
std::string get_header(const std::string& key) const Returns the value of the header with key key.

Thread safety

Distinct Objects: Safe
Shared Objects: Unsafe

Requirements

Header: websocketpp/http/parser.hpp
Library: libwebsocketpp