class request_header - 5cript/attender GitHub Wiki
class request_header
Parser and storage for http header with access methods.
Summary
| Members | Descriptions |
|---|---|
public friend request_handler |
|
public std::string get_path() const |
Returns just the path part. |
public std::string get_method() const |
Returns the request method. |
public std::string get_url() const |
Returns the whole request url part after the host. |
public std::string get_protocol() const |
Returns the protocol "HTTP" or "HTTPS". |
public std::string get_version() const |
Returns the http version. |
public std::string to_string() const |
Get the entire header as a string. |
public boost::optional< std::string > get_field(std::string const & key) const |
Return a header field. |
public boost::optional< std::string > get_query(std::string const & key) const |
Get a query paramter "/bla?x=2" will yield 2 for key "x". |
public boost::optional< std::string > get_cookie(std::string const & name) const |
Get cookie by name. |
public request_header() = default |
|
public request_header(request_header_intermediate const & intermediate) |
|
public request_header(request_header const &) = default |
|
public request_header(request_header &&) = default |
|
public request_header & operator=(request_header const &) = default |
|
public request_header & operator=(request_header &&) = default |
Members
public friend request_handler
public std::string get_path() const
Returns just the path part.
A request on "/bla?x=asdf" returns "/bla".
public std::string get_method() const
Returns the request method.
"GET", "PUT", ...
public std::string get_url() const
Returns the whole request url part after the host.
"/bla?y=asdf" returns "/bla?y=asdf".
public std::string get_protocol() const
Returns the protocol "HTTP" or "HTTPS".
public std::string get_version() const
Returns the http version.
for example "1.1"
public std::string to_string() const
Get the entire header as a string.
public boost::optional< std::string > get_field(std::string const & key) const
Return a header field.
public boost::optional< std::string > get_query(std::string const & key) const
Get a query paramter "/bla?x=2" will yield 2 for key "x".
Parameters
keyThe query key.
public boost::optional< std::string > get_cookie(std::string const & name) const
Get cookie by name.
Parameters
thename of the cookie.