Public Types | |
typedef uripp::path | uri_path_type |
URI path type. | |
Public Member Functions | |
cookie_attrs () | |
const std::string & | domain () const |
void | domain (const std::string &v) |
const uri_path_type & | path () const |
void | path (const uri_path_type &v) |
size_t | max_age () const |
void | max_age (size_t v) |
Set max age, and if not zero reset discard. | |
bool | discard () const |
void | discard (bool v) |
Set discard, and if true set max age to 0. | |
bool | secure () const |
void | secure (bool v) |
bool | http_only () const |
void | http_only (bool v) |
const http_word & | comment () const |
Comment for user agent only, not returned, no side-effects. | |
void | comment (const http_word &v) |
size_t | version () const |
Version, defaults to 1. | |
void | version (size_t v) |
bool | set (const http_token &name, const http_word &value) |
std::ostream & | operator<< (std::ostream &os) const |
Stream out in HTTP header format. | |
Static Public Attributes | |
static const char | SEPARATOR_CSTR [3] |
separator cstr ("; ") | |
static size_t | VERSION |
version (1) |
restcgi::cookie_attrs::cookie_attrs | ( | ) |
Construct with default values and full security.
void restcgi::cookie_attrs::comment | ( | const http_word & | v | ) | [inline] |
Set comment.
bool restcgi::cookie_attrs::discard | ( | ) | const [inline] |
Discard the cookie immediately. Use this instead of setting the max_age to 0. Defaults to not discard immediately (false), i.e. use max_age, if set, or discard when user agent exits. (Note "discard" is also the name of a RFC2965 attribute that has the same effect. Here, Discard
is not sent explicitly, rather, it causes Max-Age=0
to be sent.)
void restcgi::cookie_attrs::domain | ( | const std::string & | v | ) |
Set domain.
std::invalid_argument | if not valid. |
const std::string& restcgi::cookie_attrs::domain | ( | ) | const [inline] |
Domain with which to match for returning cookie. Must begin with a dot and contain another dot. The cookie will be rejected if the string resulting from subtracting this string as a suffix from the request-host domain contains a dot. In other words, you can only widen the domain applicability of the cookie by at most one level. Defaults to the request-host (no leading dot, exact match).
void restcgi::cookie_attrs::http_only | ( | bool | v | ) |
Set HTTP only.
bool restcgi::cookie_attrs::http_only | ( | ) | const [inline] |
Cookie is for HTTP only, do not allow scripts to access. Defaults to false. (Microsoft IE 6 SP1 feature but now supported by other browsers.)
size_t restcgi::cookie_attrs::max_age | ( | ) | const [inline] |
The lifetime of the cookie in seconds. Default is to discard the associated cookie when the user agent exits.
void restcgi::cookie_attrs::path | ( | const uri_path_type & | v | ) |
Set path.
const uri_path_type& restcgi::cookie_attrs::path | ( | ) | const [inline] |
Path with which to match for returning cookie. Must be a prefix of the request URI path. Defaults to the path of the request URI that generated the Set-Cookie response, up to, but not including, the right-most '/'.
void restcgi::cookie_attrs::secure | ( | bool | v | ) |
Set secure.
bool restcgi::cookie_attrs::secure | ( | ) | const [inline] |
Send only over secure channel. Defaults to not secure channel only (false).
bool restcgi::cookie_attrs::set | ( | const http_token & | name, | |
const http_word & | value | |||
) |
Set attribute with name to value, returning whether attribute exists and value is valid. This is for use when setting cookies in a request (e.g. domain string constraints not enforced).
void restcgi::cookie_attrs::version | ( | size_t | v | ) |
Set version.