class cookie - 5cript/attender GitHub Wiki
class cookie
A cookie helper class that contains cookie data and provides utilitarian functions.
Summary
| Members | Descriptions |
|---|---|
public explicit cookie() |
Creates a fresh session cookie. |
public explicit cookie(std::string const & name,std::string const & value) |
Create a cookie, setting only name and value. |
public cookie & set_name(std::string const & name) |
Set cookie name. |
public cookie & set_value(std::string const & value) |
Set cookie value. |
public cookie & set_expiry(date const & expires) |
Set cookie expiration date. |
public cookie & make_session_cookie() |
Removes the expiration date. |
public cookie & set_secure(bool secure) |
Set whether or not the cookie shall be a secure cookie. |
public cookie & set_http_only(bool http_only) |
Set whether or not, the cookie shall be accessible by scripting languages. |
public cookie & set_domain(std::string const & domain) |
Set the Domain attribute of the cookie. |
public cookie & set_path(std::string const & path) |
Set the path on which the cookie shall be accessible from. |
public cookie & set_max_age(uint64_t age) |
Set the path on which the cookie shall be accessible from. |
public cookie & set_same_site(std::string const & same_site) |
|
public std::string get_name() const |
Returns the cookie name. |
public std::string get_value() const |
Returns the cookie value. |
public bool is_secure() const |
Returns whether the cookie is secure or not. |
public bool is_http_only() const |
Returns whether the cookie is "HttpOnly" or not. |
public std::string get_path() const |
Returns the path attribution. |
public std::string get_domain() const |
Returns the domain attribution. |
public uint64_t get_max_age() const |
Get the maximum age of the cookie. |
public std::string get_same_site() const |
|
public std::string to_set_cookie_string() const |
Creates a set cookie string. |
Members
public explicit cookie()
Creates a fresh session cookie.
public explicit cookie(std::string const & name,std::string const & value)
Create a cookie, setting only name and value.
public cookie & set_name(std::string const & name)
Set cookie name.
public cookie & set_value(std::string const & value)
Set cookie value.
public cookie & set_expiry(date const & expires)
Set cookie expiration date.
public cookie & make_session_cookie()
Removes the expiration date.
All cookies are session cookies after creation, so no need to call this for fresh cookies.
public cookie & set_secure(bool secure)
Set whether or not the cookie shall be a secure cookie.
Parameters
secureThe cookie will only be used over HTTPS if true.
public cookie & set_http_only(bool http_only)
Set whether or not, the cookie shall be accessible by scripting languages.
This feature implemented by some browsers reduces XSS vulnerability.
Parameters
http_onlyThe cookie will not be accessible by JavaScript etc when true.
public cookie & set_domain(std::string const & domain)
Set the Domain attribute of the cookie.
public cookie & set_path(std::string const & path)
Set the path on which the cookie shall be accessible from.
public cookie & set_max_age(uint64_t age)
Set the path on which the cookie shall be accessible from.
public cookie & set_same_site(std::string const & same_site)
public std::string get_name() const
Returns the cookie name.
public std::string get_value() const
Returns the cookie value.
public bool is_secure() const
Returns whether the cookie is secure or not.
public bool is_http_only() const
Returns whether the cookie is "HttpOnly" or not.
public std::string get_path() const
Returns the path attribution.
public std::string get_domain() const
Returns the domain attribution.
public uint64_t get_max_age() const
Get the maximum age of the cookie.
public std::string get_same_site() const
public std::string to_set_cookie_string() const
Creates a set cookie string.