package cohttp

  1. Overview
  2. Docs

Functions for the HTTP Cookie and Set-Cookie header fields. Using the Set-Cookie header field, an HTTP server can pass name/value pairs and associated metadata (called cookies) to a user agent. When the user agent makes subsequent requests to the server, the user agent uses the metadata and other information to determine whether to return the name/value pairs in the Cookie header.

type expiration = [
  1. | `Session
    (*

    Instructs the user agent to discard the cookie unconditionally when the user agent terminates.

    *)
  2. | `Max_age of int64
    (*

    The value of the Max-Age attribute is delta-seconds, the lifetime of the cookie in seconds, a decimal non-negative integer.

    *)
]

Lifetime of the cookie after which the user agent discards it

val sexp_of_expiration : expiration -> Sexplib0.Sexp.t
val expiration_of_sexp : Sexplib0.Sexp.t -> expiration
val __expiration_of_sexp__ : Sexplib0.Sexp.t -> expiration

A cookie is simply a key/value pair send from the client to the server