soup.cookie

Module for [Cookie] class

class Cookie

Types 1

classCookie : gobject.boxed.Boxed

Implements HTTP cookies, as described by

RFC 6265.

To have a class@Session handle cookies for your appliction automatically, use a class@CookieJar.

@name and @value will be set for all cookies. If the cookie is generated from a string that appears to have no name, then @name will be the empty string.

@domain and @path give the host or domain, and path within that host/domain, to restrict this cookie to. If @domain starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has @domain as a suffix). Otherwise, it is a hostname and must match exactly.

@expires will be non-null if the cookie uses either the original "expires" attribute, or the newer "max-age" attribute. If @expires is null, it indicates that neither "expires" nor "max-age" was specified, and the cookie expires at the end of the session.

If @http_only is set, the cookie should not be exposed to untrusted code (eg, javascript), so as to minimize the danger posed by cross-site scripting attacks.

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup)
GType _gType() @property
Cookie self()Returns `this`, for use in `with` statements.
bool appliesToUri(glib.uri.Uri uri)Tests if cookie should be sent to uri.
soup.cookie.Cookie copy()Copies cookie. Returns: a copy of cookie
bool domainMatches(string host)Checks if the cookie's domain and host match.
bool equal(soup.cookie.Cookie cookie2)Tests if cookie1 and cookie2 are equal.
string getDomain()Gets cookie's domain. Returns: cookie's domain
glib.date_time.DateTime getExpires()Gets cookie's expiration time. Returns: cookie's expiration time, which is owned by cookie and should not be modified or freed.
bool getHttpOnly()Gets cookie's HttpOnly attribute. Returns: cookie's HttpOnly attribute
string getName()Gets cookie's name. Returns: cookie's name
string getPath()Gets cookie's path. Returns: cookie's path
soup.types.SameSitePolicy getSameSitePolicy()Returns the same-site policy for this cookie. Returns: a #SoupSameSitePolicy
bool getSecure()Gets cookie's secure attribute. Returns: cookie's secure attribute
string getValue()Gets cookie's value. Returns: cookie's value
void setDomain(string domain)Sets cookie's domain to domain.
void setExpires(glib.date_time.DateTime expires)Sets cookie's expiration time to expires.
void setHttpOnly(bool httpOnly)Sets cookie's HttpOnly attribute to http_only.
void setMaxAge(int maxAge)Sets cookie's max age to max_age.
void setName(string name)Sets cookie's name to name.
void setPath(string path)Sets cookie's path to path.
void setSameSitePolicy(soup.types.SameSitePolicy policy)When used in conjunction with [soup.cookie_jar.CookieJar.getCookieListWithSameSiteInfo] this sets the policy of when this cookie should be exposed.
void setSecure(bool secure)Sets cookie's secure attribute to secure.
void setValue(string value)Sets cookie's value to value.
string toCookieHeader()Serializes cookie in the format used by the Cookie header (ie, for returning a cookie from a `classSession` to a server). Returns: the header
string toSetCookieHeader()Serializes cookie in the format used by the Set-Cookie header.
soup.cookie.Cookie parse(string header, glib.uri.Uri origin = null)Parses header and returns a #SoupCookie.
Constructors
this(void * ptr, Flag!"Take" take)
this(string name, string value, string domain, string path, int maxAge)Creates a new #SoupCookie with the given attributes.