Cookie
Object Hierarchy:
Description:
An HTTP cookie.
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 "max-age" attribute specified in
RFC 2109. 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.
Namespace: Soup
Package: libsoup-2.4
Content:
Static methods:
-
public static Cookie parse (string header, URI origin)
Parses header and returns a Cookie. (If
header contains multiple cookies, only the first one will be parsed.)
Creation methods:
Methods:
-
public bool applies_to_uri (URI uri)
Tests if cookie should be sent to uri.
-
public Cookie copy ()
Copies cookie.
-
public bool domain_matches (string host)
Checks if the cookie's domain and host match in the sense that cookie
should be sent when making a request to host, or that cookie should be accepted when receiving a
response from host.
-
public bool equal (Cookie cookie2)
Tests if cookie1 and cookie2 are equal.
-
public void free ()
Frees cookie
-
public unowned string get_domain ()
Gets cookie's domain
-
public unowned Date get_expires ()
Gets cookie's expiration time
-
public bool get_http_only ()
Gets cookie's HttpOnly attribute
-
public unowned string get_name ()
Gets cookie's name
-
public unowned string get_path ()
Gets cookie's path
-
public bool get_secure ()
Gets cookie's secure attribute
-
public unowned string get_value ()
Gets cookie's value
-
public void set_domain (string domain)
Sets cookie's domain to domain
-
public void set_expires (Date expires)
Sets cookie's expiration time to expires. If expires is
null, cookie will be a session cookie and will expire at the end of the client's session.
-
public void set_http_only (bool http_only)
Sets cookie's HttpOnly attribute to http_only. If true,
cookie will be marked as "http only", meaning it should not be exposed to web page scripts or other untrusted code.
-
public void set_max_age (int max_age)
-
public void set_name (string name)
Sets cookie's name to name
-
public void set_path (string path)
Sets cookie's path to path
-
public void set_secure (bool secure)
Sets cookie's secure attribute to secure. If true, cookie
will only be transmitted from the client to the server over secure (https) connections.
-
public void set_value (string value)
Sets cookie's value to value
-
public string to_cookie_header ()
Serializes cookie in the format used by the Cookie header (ie, for returning a cookie from
a Session to a server).
-
public string to_set_cookie_header ()
Serializes cookie in the format used by the Set-Cookie header (ie, for sending a cookie
from a Server to a client).
Fields: