Sign in

    mizchi/crater-browser-http/cookie_jar does not have a README file

    CookieJar

    pub struct CookieJar {
    cookies : Array[ParsedCookie]
    enabled : Bool
    }

    Cookie Jar — stores cookies per-domain with security enforcement

    CookieJar::clear

    fn CookieJar::clear(self : CookieJar) -> Unit

    Clear all cookies
    fn CookieJar::get_cookie_header(self : CookieJar, request_url : String, is_secure : Bool, is_http_api : Bool, site_origin? : String, is_top_level_navigation? : Bool) -> String?

    Get cookies for a request URL as "Cookie: name=value; name2=value2" pairs. Enforces: domain matching, path matching, secure flag, httpOnly, SameSite.

    site_origin: the origin of the page making the request (for SameSite checks). Empty string means "same-site" (no cross-site enforcement). is_top_level_navigation: true for top-level navigations (SameSite=Lax allows these).

    CookieJar::new

    fn CookieJar::new(enabled? : Bool) -> CookieJar

    CookieJar::size

    fn CookieJar::size(self : CookieJar) -> Int

    Get number of stored cookies

    CookieJar::store_from_header

    fn CookieJar::store_from_header(self : CookieJar, set_cookie_header : String, request_url : String, is_secure_origin : Bool) -> Unit

    Store a cookie from a Set-Cookie header. Enforces: domain validation, secure flag, httpOnly flag.

    ParsedCookie

    pub(all) struct ParsedCookie {
    name : String
    value : String
    domain : String
    path : String
    secure : Bool
    http_only : Bool
    same_site : String
    max_age : Int?
    expires : String?
    } derive(
    Debug
    )

    Parsed Set-Cookie attributes
    fn parse_set_cookie(header : String, request_domain : String, request_path : String) -> ParsedCookie?

    Parse a Set-Cookie header value into a ParsedCookie. Returns None if the cookie is malformed.

    Source Files