![]() |
Webdar 1.0.0
Web user interface to libdar
|
class answer provides easy means to set an HTTP answer and means to sent it back to a proto_connexion object More...
#include <answer.hpp>
Public Member Functions | |
answer () | |
class constructor | |
answer (const answer &ref) | |
copy constructor | |
answer (answer &&ref) noexcept=default | |
move constructor | |
answer & | operator= (const answer &ref) |
assignment copy operator | |
answer & | operator= (answer &&ref) noexcept=default |
assignment move operator | |
~answer ()=default | |
destructor | |
void | clear () |
clear all information from the object | |
void | set_status (unsigned int status_code) |
set answer status code and reason [MANDATORY] | |
void | set_reason (const std::string &reason_phrase) |
set reason [optional] | |
void | set_version (unsigned int maj, unsigned int min) |
set version info [MANDATORY] | |
void | add_cookie (const std::string &key, const std::string &value) |
add cookie to the answer [optional] | |
void | add_body (const std::string &key) |
adds the body to the answer [optional] More... | |
void | drop_body_keep_header () |
removes the body keeping header untouched (Content-Length in particular) | |
void | set_attribute (const std::string &key, const std::string &value) |
set a given attribute to the HTTP header | |
void | add_attribute_member (const std::string &key, const std::string &value) |
bool | is_valid () const |
whether the minimal parameters have been set | |
unsigned int | get_status_code () const |
get answer status code and reason | |
const std::string | get_reason () const |
get reason | |
unsigned int | get_maj_version () const |
get integer part of the version info | |
unsigned int | get_min_version () const |
get decimal part of the version info | |
const std::string | get_body () const |
get the current body of the answer | |
bool | find_attribute (const std::string &key, std::string &value) const |
void | write (proto_connexion &output) |
send the answer | |
class answer provides easy means to set an HTTP answer and means to sent it back to a proto_connexion object
void answer::add_attribute_member | ( | const std::string & | key, |
const std::string & | value | ||
) |
add an attribute to a possibly already existing message header
void answer::add_body | ( | const std::string & | key | ) |
adds the body to the answer [optional]
bool answer::find_attribute | ( | const std::string & | key, |
std::string & | value | ||
) | const |
retrieve the value of an attribute of the HTTP answer
[in] | key | is the key's attribute to look for |
[out] | value | is the associated value of the attribute if such attribute exists |