Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · cookiejar

Docs

std/cookiejar

On this page

Index

Types

Entry

struct Entry {
  name: Str
  value: Str
  quoted: Bool
  domain: Str
  path: Str
  secure: Bool
  persistent: Bool
  host_only: Bool
  expires: Time
  creation: Time
  last_access: Time
  seq: Int
}

One stored cookie (net/http/cookiejar’s entry). Internal: use the jar.

Source: std/cookiejar.xo:10

JarState

struct JarState {
  entries: Map[Str, Map[Str, Entry]]
  next_seq: Int
}

A jar’s state. Internal: use the methods.

Source: std/cookiejar.xo:27

Jar

struct Jar {
  st: Mutex[JarState]
}

A cookie jar. A handle: copies share the cookies, and tasks may use it at once.

Source: std/cookiejar.xo:35

Jar.set_cookies

fn (j: Jar) set_cookies(url: http.Url, cookies: List[http.Cookie], now: Time)

Stores the cookies a server set for url (Jar.SetCookies): none for a scheme other than http and https, one that has a bad Domain attribute (not the host or a parent of it, or an IP host with a Domain) is ignored, a Max-Age below 0 or an Expires not after now deletes. A host that is not ASCII is ignored (no IDNA yet).

Source: std/cookiejar.xo:47

Jar.cookies

fn (j: Jar) cookies(url: http.Url, now: Time) -> List[http.Cookie]

The cookies to send with a request for url (Jar.Cookies): name, value and quoted only, the longest path first, then the earliest created. Expired cookies are dropped.

Source: std/cookiejar.xo:51

Jar.clear

fn (j: Jar) clear()

Forgets every cookie.

Source: std/cookiejar.xo:53

Functions

new

fn new() -> Jar

An empty jar (cookiejar.New(nil)).

Source: std/cookiejar.xo:40

↑ index