std1.0.0-beta-7 SafeC docs

std :: http::cookie

Struct std::SetCookie

#include <std/http/cookie.h> source

struct SetCookie {
    struct String name;
    struct String value;
    struct String path;
    struct String domain;
    long long max_age;
    long long expires;
    int secure;
    int http_only;
    int same_site;
    int partitioned;
}

Fields

§struct String namesource
§struct String valuesource
§struct String pathsource

empty: not sent

§struct String domainsource

empty: not sent (host-only cookie)

§long long max_agesource

seconds; -1 = not sent; 0 deletes the cookie

§long long expiressource

Unix seconds; 0 = not sent (session cookie)

§int securesource
§int http_onlysource
§int same_sitesource

COOKIE_SAMESITE_*

§int partitionedsource

CHIPS "Partitioned" attribute

Methods

§static struct SetCookie new(const &char name, const &char value)source · definition

name=value with no attributes (path "/" is a common next step).

§static struct SetCookie removal(const &char name, const &char path)source · definition

A cookie that tells the browser to delete 'name' (empty value, Max-Age=0, Expires in 1970) for the given path.

§static struct SetCookie parse(const &char header_value, ?&int ok)source · definition

Parses one Set-Cookie header value. *ok = 0 if there is no "name=value" first part. Unknown attributes are ignored, as browsers do.

§struct String to_string() constsource · definition

"name=value; Path=/; Max-Age=3600; Expires=...; Secure; HttpOnly; SameSite=Lax" — the header value.

§void drop()source · definition
§void free() consumesource · definition

= drop()