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 soup.session.Session handle cookies for your appliction automatically, use a soup.cookie_jar.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) nothrow
GType _getGType() static nothrow
GType _gType() @property nothrow
Cookie self() nothrowReturns `this`, for use in `with` statements.
bool appliesToUri(glib.uri.Uri uri) nothrowTests if cookie should be sent to uri.
soup.cookie.Cookie copy() nothrowCopies cookie. Returns: a copy of cookie
bool domainMatches(string host) nothrowChecks if the cookie's domain and host match.
bool equal(soup.cookie.Cookie cookie2) nothrowTests if cookie1 and cookie2 are equal.
string getDomain() nothrowGets cookie's domain. Returns: cookie's domain
glib.date_time.DateTime getExpires() nothrowGets cookie's expiration time. Returns: cookie's expiration time, which is owned by cookie and should not be modified or freed.
bool getHttpOnly() nothrowGets cookie's HttpOnly attribute. Returns: cookie's HttpOnly attribute
string getName() nothrowGets cookie's name. Returns: cookie's name
string getPath() nothrowGets cookie's path. Returns: cookie's path
soup.types.SameSitePolicy getSameSitePolicy() nothrowReturns the same-site policy for this cookie. Returns: a #SoupSameSitePolicy
bool getSecure() nothrowGets cookie's secure attribute. Returns: cookie's secure attribute
string getValue() nothrowGets cookie's value. Returns: cookie's value
void setDomain(string domain) nothrowSets cookie's domain to domain.
void setExpires(glib.date_time.DateTime expires) nothrowSets cookie's expiration time to expires.
void setHttpOnly(bool httpOnly) nothrowSets cookie's HttpOnly attribute to http_only.
void setMaxAge(int maxAge) nothrowSets cookie's max age to max_age.
void setName(string name) nothrowSets cookie's name to name.
void setPath(string path) nothrowSets cookie's path to path.
void setSameSitePolicy(soup.types.SameSitePolicy policy) nothrowWhen used in conjunction with [soup.cookie_jar.CookieJar.getCookieListWithSameSiteInfo] this sets the policy of when this cookie should be exposed.
void setSecure(bool secure) nothrowSets cookie's secure attribute to secure.
void setValue(string value) nothrowSets cookie's value to value.
string toCookieHeader() nothrowSerializes cookie in the format used by the Cookie header (ie, for returning a cookie from a [soup.session.Session] to a server). Returns: the header
string toSetCookieHeader() nothrowSerializes cookie in the format used by the Set-Cookie header.
soup.cookie.Cookie parse(string header, glib.uri.Uri origin = null) static nothrowParses 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.