### Struct

# Soup Cookie

since: 3.0

#### Description [src]

    struct SoupCookie {
      /* No available fields */
    }

Implements HTTP cookies, as described by RFC 6265.

To have a `SoupSession` handle cookies for your appliction automatically, use a `SoupCookieJar`.

`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.

Available since: 3.0

#### Constructors

###### soup_cookie_new

Creates a new `SoupCookie` with the given attributes.

since: 3.0

#### Functions

###### soup_cookie_parse

Parses `header` and returns a `SoupCookie`.

since: 3.0

#### Instance methods

###### soup_cookie_applies_to_uri

Tests if `cookie` should be sent to `uri`.

since: 3.0

###### soup_cookie_copy

Copies `cookie`.

since: 3.0

###### soup_cookie_domain_matches

Checks if the `cookie`‘s domain and `host` match.

since: 3.0

###### soup_cookie_equal

Tests if `cookie1` and `cookie2` are equal.

since: 3.0

###### soup_cookie_free

Frees `cookie`.

since: 3.0

###### soup_cookie_get_domain

Gets `cookie`‘s domain.

since: 3.0

###### soup_cookie_get_expires

Gets `cookie`‘s expiration time.

since: 3.0

###### soup_cookie_get_http_only

Gets `cookie`‘s HttpOnly attribute.

since: 3.0

###### soup_cookie_get_name

Gets `cookie`‘s name.

since: 3.0

###### soup_cookie_get_path

Gets `cookie`‘s path.

since: 3.0

###### soup_cookie_get_same_site_policy

Returns the same-site policy for this cookie.

since: 3.0

###### soup_cookie_get_secure

Gets `cookie`‘s secure attribute.

since: 3.0

###### soup_cookie_get_value

Gets `cookie`‘s value.

since: 3.0

###### soup_cookie_set_domain

Sets `cookie`‘s domain to `domain`.

since: 3.0

###### soup_cookie_set_expires

Sets `cookie`‘s expiration time to `expires`.

since: 3.0

###### soup_cookie_set_http_only

Sets `cookie`‘s HttpOnly attribute to `http_only`.

since: 3.0

###### soup_cookie_set_max_age

Sets `cookie`‘s max age to `max_age`.

since: 3.0

###### soup_cookie_set_name

Sets `cookie`‘s name to `name`.

since: 3.0

###### soup_cookie_set_path

Sets `cookie`‘s path to `path`.

since: 3.0

###### soup_cookie_set_same_site_policy

When used in conjunction with `soup_cookie_jar_get_cookie_list_with_same_site_info()` this sets the policy of when this cookie should be exposed.

since: 3.0

###### soup_cookie_set_secure

Sets `cookie`‘s secure attribute to `secure`.

since: 3.0

###### soup_cookie_set_value

Sets `cookie`‘s value to `value`.

since: 3.0

###### soup_cookie_to_cookie_header

Serializes `cookie` in the format used by the Cookie header (ie, for returning a cookie from a `SoupSession` to a server).

since: 3.0

###### soup_cookie_to_set_cookie_header

Serializes `cookie` in the format used by the Set-Cookie header.

since: 3.0