Net.HTTP.Cookie

lib/Net/HTTP/Cookie.gob

A cookie as a Set-Cookie header sets it (RFC 6265 ยง4.1): a name, a value, and attributes such as Path=/, Secure and HttpOnly.

let session = Cookie.new("session", id)?
let session = Cookie.withAttribute(session, "HttpOnly")?

Each Set-Cookie header sets one cookie, and the headers are never joined into one: an Expires date holds a comma, so a joined list could not be split again.

The syntax is the strict one RFC 6265 gives servers. The name is a token; the value is the bytes the RFC allows, perhaps in double quotes, which are kept; an attribute is any text without a control byte or ;.

type NewCookie
fun new : fun(String, String) -> Option NewCookie
fun withAttribute : fun(NewCookie, String) -> Option NewCookie

Returns c with the attribute text after those it has.

fun parse : fun(String) -> Option NewCookie

set-cookie-string = cookie-pair *( ";" SP cookie-av )

fun toString : fun(NewCookie) -> String
fun name : fun(NewCookie) -> String
fun value : fun(NewCookie) -> String
fun attributes : fun(NewCookie) -> Array String
instance Eq NewCookie
instance Show NewCookie