#include <response.hpp>
Inherits pion::http::message.
Public Member Functions | |
response (const http::request &http_request_ptr) | |
response (const std::string &request_method) | |
response (const response &http_response) | |
copy constructor | |
response (void) | |
virtual | ~response () |
virtual destructor | |
virtual void | clear (void) |
clears all response data | |
virtual bool | is_content_length_implied (void) const |
the content length may be implied for certain types of responses | |
void | update_request_info (const http::request &http_request) |
void | set_status_code (unsigned int n) |
sets the HTTP response status code | |
void | set_status_message (const std::string &msg) |
sets the HTTP response status message | |
unsigned int | get_status_code (void) const |
returns the HTTP response status code | |
const std::string & | get_status_message (void) const |
returns the HTTP response status message | |
void | set_cookie (const std::string &name, const std::string &value) |
void | set_cookie (const std::string &name, const std::string &value, const std::string &path) |
void | set_cookie (const std::string &name, const std::string &value, const std::string &path, const unsigned long max_age) |
void | set_cookie (const std::string &name, const std::string &value, const unsigned long max_age) |
void | delete_cookie (const std::string &name) |
deletes cookie called name by adding a Set-Cookie header (cookie has no path) | |
void | delete_cookie (const std::string &name, const std::string &path) |
deletes cookie called name by adding a Set-Cookie header (cookie has a path) | |
void | set_last_modified (const unsigned long t) |
sets the time that the response was last modified (Last-Modified) | |
Protected Member Functions | |
virtual void | update_first_line (void) const |
updates the string containing the first line for the HTTP message | |
virtual void | append_cookie_headers (void) |
appends HTTP headers for any cookies defined by the http::message |
response: container for HTTP response information
Definition at line 27 of file response.hpp.
pion::http::response::response | ( | const http::request & | http_request_ptr | ) | [inline] |
constructs a new response object for a particular request
http_request_ptr | the request that this is responding to |
Definition at line 37 of file response.hpp.
References update_request_info().
pion::http::response::response | ( | const std::string & | request_method | ) | [inline] |
constructs a new response object for a particular request method
request_method | the method used by the HTTP request we are responding to |
Definition at line 49 of file response.hpp.
pion::http::response::response | ( | void | ) | [inline] |
default constructor: you are strongly encouraged to use one of the other constructors, since response parsing is influenced by the request method
Definition at line 64 of file response.hpp.
void pion::http::response::set_cookie | ( | const std::string & | name, | |
const std::string & | value, | |||
const unsigned long | max_age | |||
) | [inline] |
sets a cookie by adding a Set-Cookie header (see RFC 2109)
name | the name of the cookie | |
value | the value of the cookie | |
max_age | the life of the cookie, in seconds (0 = discard) |
Definition at line 169 of file response.hpp.
References pion::http::message::add_header(), and pion::http::types::make_set_cookie_header().
void pion::http::response::set_cookie | ( | const std::string & | name, | |
const std::string & | value, | |||
const std::string & | path, | |||
const unsigned long | max_age | |||
) | [inline] |
sets a cookie by adding a Set-Cookie header (see RFC 2109)
name | the name of the cookie | |
value | the value of the cookie | |
path | the path of the cookie | |
max_age | the life of the cookie, in seconds (0 = discard) |
Definition at line 155 of file response.hpp.
References pion::http::message::add_header(), and pion::http::types::make_set_cookie_header().
void pion::http::response::set_cookie | ( | const std::string & | name, | |
const std::string & | value, | |||
const std::string & | path | |||
) | [inline] |
sets a cookie by adding a Set-Cookie header (see RFC 2109) the cookie will be discarded by the user-agent when it closes
name | the name of the cookie | |
value | the value of the cookie | |
path | the path of the cookie |
Definition at line 140 of file response.hpp.
References pion::http::message::add_header(), and pion::http::types::make_set_cookie_header().
void pion::http::response::set_cookie | ( | const std::string & | name, | |
const std::string & | value | |||
) | [inline] |
sets a cookie by adding a Set-Cookie header (see RFC 2109) the cookie will be discarded by the user-agent when it closes
name | the name of the cookie | |
value | the value of the cookie |
Definition at line 127 of file response.hpp.
References pion::http::message::add_header(), and pion::http::types::make_set_cookie_header().
Referenced by append_cookie_headers().
void pion::http::response::update_request_info | ( | const http::request & | http_request | ) | [inline] |
Updates HTTP request information for the response object (use this if the response cannot be constructed using the request)
http_request | the request that this is responding to |
Definition at line 95 of file response.hpp.
References pion::http::request::get_method(), pion::http::message::get_version_major(), pion::http::message::get_version_minor(), and pion::http::message::set_chunks_supported().
Referenced by response().