pub trait CookieJarExt: IsA<CookieJar> + Sealed + 'static {
    // Provided methods
    fn all_cookies(&self) -> Vec<Cookie> { ... }
    fn accept_policy(&self) -> CookieJarAcceptPolicy { ... }
    fn cookie_list(&self, uri: &Uri, for_http: bool) -> Vec<Cookie> { ... }
    fn cookie_list_with_same_site_info(
        &self,
        uri: &Uri,
        top_level: Option<&Uri>,
        site_for_cookies: Option<&Uri>,
        for_http: bool,
        is_safe_method: bool,
        is_top_level_navigation: bool
    ) -> Vec<Cookie> { ... }
    fn cookies(&self, uri: &Uri, for_http: bool) -> Option<GString> { ... }
    fn is_persistent(&self) -> bool { ... }
    fn set_accept_policy(&self, policy: CookieJarAcceptPolicy) { ... }
    fn set_cookie(&self, uri: &Uri, cookie: &str) { ... }
    fn set_cookie_with_first_party(
        &self,
        uri: &Uri,
        first_party: &Uri,
        cookie: &str
    ) { ... }
    fn is_read_only(&self) -> bool { ... }
    fn connect_changed<F: Fn(&Self, &Cookie, &Cookie) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId { ... }
    fn connect_accept_policy_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all CookieJar methods.

§Implementors

CookieJarDB, CookieJarText, CookieJar

Provided Methods§

source

fn all_cookies(&self) -> Vec<Cookie>

Constructs a glib::List with every cookie inside the @self.

The cookies in the list are a copy of the original, so you have to free them when you are done with them.

§Returns

a #GSList with all the cookies in the @self.

source

fn accept_policy(&self) -> CookieJarAcceptPolicy

Gets @self’s CookieJarAcceptPolicy.

§Returns

the #SoupCookieJarAcceptPolicy set in the @self

source

fn cookie_list(&self, uri: &Uri, for_http: bool) -> Vec<Cookie>

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

If @for_http is true, the return value will include cookies marked “HttpOnly” (that is, cookies that the server wishes to keep hidden from client-side scripting operations such as the JavaScript document.cookies property). Since #SoupCookieJar sets the Cookie header itself when making the actual HTTP request, you should almost certainly be setting @for_http to false if you are calling this.

§uri

a #GUri

§for_http

whether or not the return value is being passed directly to an HTTP operation

§Returns

a #GSList with the cookies in the @self that would be sent with a request to @uri.

source

fn cookie_list_with_same_site_info( &self, uri: &Uri, top_level: Option<&Uri>, site_for_cookies: Option<&Uri>, for_http: bool, is_safe_method: bool, is_top_level_navigation: bool ) -> Vec<Cookie>

This is an extended version of cookie_list() that provides more information required to use SameSite cookies.

See the SameSite cookies spec for more detailed information.

§uri

a #GUri

§top_level

a #GUri for the top level document

§site_for_cookies

a #GUri indicating the origin to get cookies for

§for_http

whether or not the return value is being passed directly to an HTTP operation

§is_safe_method

if the HTTP method is safe, as defined by RFC 7231, ignored when @for_http is false

§is_top_level_navigation

whether or not the HTTP request is part of top level navigation

§Returns

a #GSList with the cookies in the @self that would be sent with a request to @uri.

source

fn cookies(&self, uri: &Uri, for_http: bool) -> Option<GString>

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

If @for_http is true, the return value will include cookies marked “HttpOnly” (that is, cookies that the server wishes to keep hidden from client-side scripting operations such as the JavaScript document.cookies property). Since #SoupCookieJar sets the Cookie header itself when making the actual HTTP request, you should almost certainly be setting @for_http to false if you are calling this.

§uri

a #GUri

§for_http

whether or not the return value is being passed directly to an HTTP operation

§Returns

the cookies, in string form, or None if there are no cookies for @uri.

source

fn is_persistent(&self) -> bool

Gets whether @self stores cookies persistenly.

§Returns

true if @self storage is persistent or false otherwise.

source

fn set_accept_policy(&self, policy: CookieJarAcceptPolicy)

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

§policy

a #SoupCookieJarAcceptPolicy

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

Keep in mind that if the CookieJarAcceptPolicy set is either CookieJarAcceptPolicy::NoThirdParty or CookieJarAcceptPolicy::GrandfatheredThirdParty you’ll need to use set_cookie_with_first_party(), otherwise the jar will have no way of knowing if the cookie is being set by a third party or not.

§uri

the URI setting the cookie

the stringified cookie to set

Adds @cookie to @self, 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 @self.

§uri

the URI setting the cookie

§first_party

the URI for the main document

the stringified cookie to set

source

fn is_read_only(&self) -> bool

Whether or not the cookie jar is read-only.

source

fn connect_changed<F: Fn(&Self, &Cookie, &Cookie) + 'static>( &self, f: F ) -> SignalHandlerId

Emitted when @jar changes.

If a cookie has been added, @new_cookie will contain the newly-added cookie and @old_cookie will be None. If a cookie has been deleted, @old_cookie will contain the to-be-deleted cookie and @new_cookie will be None. If a cookie has been changed, @old_cookie will contain its old value, and @new_cookie its new value.

the old #SoupCookie value

the new #SoupCookie value

source

fn connect_accept_policy_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId

Object Safety§

This trait is not object safe.

Implementors§