Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Ocsigen_cookies

module Ocsigen_cookies : sig..end

This table is to store cookie values for each path. The key has type Url.path option: it is for the path (default: root of the site),


module CookiesTable : Map.Swith type key = string
module Cookies : Map.Swith type key = Url.path

This table is to store cookie values for each path.

type cookie =  | OSet of float option * string * bool | OUnset

Type used for cookies to set. The float option is the timestamp for the expiration date. The string is the value. If the bool is true and the protocol is https, the cookie will be secure (will ask the browser to send it only through secure connections).

type cookieset = 
  cookie CookiesTable.t
  Cookies.t
val empty_cookieset : 'a CookiesTable.t Cookies.t

add_cookie path c v cookie_table adds the cookie c to the table cookie_table. If the cookie is already bound, the previous binding disappear.

remove_cookie c cookie_table removes the cookie c from the table cookie_table. Warning: it is not equivalent to add_cookie ... OUnset ...).

val add_cookies : 
  cookie CookiesTable.t
  Cookies.t ->
  cookie CookiesTable.t
  Cookies.t ->
  cookie CookiesTable.t
  Cookies.t

add_cookies newcookies oldcookies adds the cookies from newcookies to oldcookies. If cookies are already bound in oldcookies, the previous binding disappear.