Imported Upstream version 2.0.1
[pkg-ocaml-eliom.git] / src / server / eliom_cookies.mli
blob2cd397aa15e54b421055ae98abf7aad99aaa3d23
1 (* Ocsigen
2 * Copyright (C) 2010 Vincent Balat
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, with linking exception;
7 * either version 2.1 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 open Eliom_pervasives
21 (** This table is to store cookie values for each path.
22 The key has type Url.path option:
23 it is for the path (default: root of the site),
25 module Cookies : Map.S with type key = Url.path
27 (** Type used for cookies to set.
28 The float option is the timestamp for the expiration date.
29 The string is the value.
30 If the bool is true and the protocol is https, the cookie will be secure
31 (will ask the browser to send it only through secure connections).
33 type cookie = Ocsigen_cookies.cookie =
34 | OSet of float option * string * bool
35 | OUnset
37 type cookieset = cookie String.Table.t Cookies.t
39 val empty_cookieset : 'a String.Table.t Cookies.t
42 (** [add_cookie path c v cookie_table]
43 adds the cookie [c] to the table [cookie_table].
44 If the cookie is already bound, the previous binding disappear. *)
45 val add_cookie : Url.path -> string -> 'a ->
46 'a String.Table.t Cookies.t ->
47 'a String.Table.t Cookies.t
49 (** [remove_cookie c cookie_table] removes the cookie [c]
50 from the table [cookie_table].
51 Warning: it is not equivalent to [add_cookie ... OUnset ...]).
53 val remove_cookie : Url.path -> string ->
54 'a String.Table.t Cookies.t ->
55 'a String.Table.t Cookies.t
57 (** [add_cookies newcookies oldcookies] adds the cookies from [newcookies]
58 to [oldcookies]. If cookies are already bound in oldcookies,
59 the previous binding disappear. *)
60 val add_cookies :
61 cookie String.Table.t Cookies.t ->
62 cookie String.Table.t Cookies.t ->
63 cookie String.Table.t Cookies.t