CookieJar

A #SoupCookieJar stores #SoupCookie<!-- -->s and arrange for them to be sent with the appropriate #SoupMessage<!-- -->s. #SoupCookieJar implements #SoupSessionFeature, so you can add a cookie jar to a session with soup_session_add_feature() or soup_session_add_feature_by_type().

Note that the base #SoupCookieJar class does not support any form of long-term cookie persistence.

Constructors

this
this(SoupCookieJar* soupCookieJar, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new #SoupCookieJar. The base #SoupCookieJar class does not support persistent storage of cookies; use a subclass for that.

Members

Functions

addCookie
void addCookie(Cookie cookie)

Adds @cookie to @jar, emitting the 'changed' signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past).

addCookieFull
void addCookieFull(Cookie cookie, URI uri, URI firstParty)

Adds @cookie to @jar, emitting the 'changed' signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past).

addCookieWithFirstParty
void addCookieWithFirstParty(URI firstParty, Cookie cookie)

Adds @cookie to @jar, emitting the 'changed' signal if we are modifying an existing cookie or adding a valid new cookie ('valid' means that the cookie's expire date is not in the past).

addOnChanged
gulong addOnChanged(void delegate(Cookie, Cookie, CookieJar) dlg, ConnectFlags connectFlags)

Emitted when @jar changes. If a cookie has been added, @new_cookie will contain the newly-added cookie and @old_cookie will be %NULL. If a cookie has been deleted, @old_cookie will contain the to-be-deleted cookie and @new_cookie will be %NULL. If a cookie has been changed, @old_cookie will contain its old value, and @new_cookie its new value.

allCookies
ListSG allCookies()

Constructs a #GSList with every cookie inside the @jar. The cookies in the list are a copy of the original, so you have to free them when you are done with them.

deleteCookie
void deleteCookie(Cookie cookie)

Deletes @cookie from @jar, emitting the 'changed' signal.

getAcceptPolicy
SoupCookieJarAcceptPolicy getAcceptPolicy()

Gets @jar's #SoupCookieJarAcceptPolicy

getCookieJarStruct
SoupCookieJar* getCookieJarStruct(bool transferOwnership)

Get the main Gtk struct

getCookieList
ListSG getCookieList(URI uri, bool forHttp)

Retrieves the list of cookies that would be sent with a request to @uri as a #GSList of #SoupCookie objects.

getCookieListWithSameSiteInfo
ListSG getCookieListWithSameSiteInfo(URI uri, URI topLevel, URI siteForCookies, bool forHttp, bool isSafeMethod, bool isTopLevelNavigation)

This is an extended version of soup_cookie_jar_get_cookie_list() that provides more information required to use SameSite cookies. See the SameSite cookies spec

for more detailed information.

getCookies
string getCookies(URI uri, bool forHttp)

Retrieves (in Cookie-header form) the list of cookies that would be sent with a request to @uri.

getStruct
void* getStruct()

the main Gtk struct as a void*

isPersistent
bool isPersistent()

Gets whether @jar stores cookies persistenly.

save
void save()

This function exists for backward compatibility, but does not do anything any more; cookie jars are saved automatically when they are changed.

setAcceptPolicy
void setAcceptPolicy(SoupCookieJarAcceptPolicy policy)

Sets @policy as the cookie acceptance policy for @jar.

setCookie
void setCookie(URI uri, string cookie)

Adds @cookie to @jar, exactly as though it had appeared in a Set-Cookie header returned from a request to @uri.

setCookieWithFirstParty
void setCookieWithFirstParty(URI uri, URI firstParty, string cookie)

Adds @cookie to @jar, exactly as though it had appeared in a Set-Cookie header returned from a request to @uri. @first_party will be used to reject cookies coming from third party resources in case such a security policy is set in the @jar.

Mixins

__anonymous
mixin SessionFeatureT!(SoupCookieJar)
Undocumented in source.

Static functions

getType
GType getType()

Variables

soupCookieJar
SoupCookieJar* soupCookieJar;

the main Gtk struct

Inherited Members

From SessionFeatureIF

getSessionFeatureStruct
SoupSessionFeature* getSessionFeatureStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
addFeature
bool addFeature(GType type)

Adds a "sub-feature" of type @type to the base feature @feature. This is used for features that can be extended with multiple different types. Eg, the authentication manager can be extended with subtypes of #SoupAuth.

attach
void attach(Session session)
detach
void detach(Session session)
hasFeature
bool hasFeature(GType type)

Tests if @feature has a "sub-feature" of type @type. See soup_session_feature_add_feature().

removeFeature
bool removeFeature(GType type)

Removes the "sub-feature" of type @type from the base feature @feature. See soup_session_feature_add_feature().

Meta