websocketpp  0.3.0
C++/Boost Asio based websocket client/server library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Public Member Functions | List of all members
websocketpp::http::parser::request Class Reference

Stores, parses, and manipulates HTTP requests. More...

#include <request.hpp>

Inheritance diagram for websocketpp::http::parser::request:
websocketpp::http::parser::parser

Public Types

typedef request type
 
typedef lib::shared_ptr< typeptr
 

Public Member Functions

bool parse_complete (std::istream &s)
 DEPRECATED parse a complete header (

MUST be in the istream)
 
size_t consume (const char *buf, size_t len)
 Process bytes in the input buffer. More...
 
bool ready () const
 Returns whether or not the request is ready for reading.
 
std::string raw ()
 Returns the full raw request.
 
void set_method (const std::string &method)
 Set the HTTP method. Must be a valid HTTP token.
 
const std::string & get_method () const
 Return the request method.
 
void set_uri (const std::string &uri)
 Set the HTTP uri. Must be a valid HTTP uri. More...
 
const std::string & get_uri () const
 Return the requested URI.
 
- Public Member Functions inherited from websocketpp::http::parser::parser
std::string const & get_version () const
 Get the HTTP version string. More...
 
void set_version (std::string const &version)
 Set HTTP parser Version. More...
 
std::string const & get_header (std::string const &key) const
 Get the value of an HTTP header. More...
 
bool get_header_as_plist (std::string const &key, parameter_list &out) const
 Extract an HTTP parameter list from a parser header. More...
 
void append_header (std::string const &key, std::string const &val)
 Append a value to an existing HTTP header. More...
 
void replace_header (std::string const &key, std::string const &val)
 Set a value for an HTTP header, replacing an existing value. More...
 
void remove_header (std::string const &key)
 Remove a header from the parser. More...
 
std::string const & get_body () const
 Set HTTP body. More...
 
void set_body (std::string const &value)
 Set body content. More...
 
bool parse_parameter_list (std::string const &in, parameter_list &out) const
 Extract an HTTP parameter list from a string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from websocketpp::http::parser::parser
bool parse_headers (std::istream &s)
 Parse headers from an istream. More...
 
void process_header (std::string::iterator begin, std::string::iterator end)
 Process a header line. More...
 
std::string raw_headers () const
 Generate and return the HTTP headers as a string. More...
 
- Protected Attributes inherited from websocketpp::http::parser::parser
std::string m_version
 
header_list m_headers
 
std::string m_body
 

Detailed Description

Stores, parses, and manipulates HTTP requests.

http::request provides the following functionality for working with HTTP requests.

Definition at line 48 of file request.hpp.

Member Function Documentation

size_t websocketpp::http::parser::request::consume ( const char *  buf,
size_t  len 
)
inline

Process bytes in the input buffer.

Process up to len bytes from input buffer buf. Returns the number of bytes processed. Bytes left unprocessed means bytes left over after the final header delimiters.

Consume is a streaming processor. It may be called multiple times on one request and the full headers need not be available before processing can begin. If the end of the request was reached during this call to consume the ready flag will be set. Further calls to consume once ready will be ignored.

Consume will throw an http::exception in the case of an error. Typical error reasons include malformed requests, incomplete requests, and max header size being reached.

Parameters
bufPointer to byte buffer
lenSize of byte buffer
Returns
Number of bytes processed.

Definition at line 67 of file request.hpp.

void websocketpp::http::parser::request::set_uri ( const std::string &  uri)
inline

Set the HTTP uri. Must be a valid HTTP uri.

Set HTTP body.

Sets the body of the HTTP object and fills in the appropriate content length header

Parameters
valueThe value to set the body to.

Definition at line 159 of file request.hpp.


The documentation for this class was generated from the following file: