Fix outstanding bugs
[pkg-ocaml-ocsigen.git] / http / http_headers.mli
blob44fee2ebffa16bcf2126743d8f6d3848d0e18a87
1 (* Ocsigen
2 * http://www.ocsigen.org
3 * Module http_headers.mli
4 * Copyright (C) 2007 Jérôme Vouillon
5 * Laboratoire PPS - CNRS Université Paris Diderot
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, with linking exception;
10 * either version 2.1 of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 (*XXX Can have multiple headers with the same name...*)
24 type name
26 val name : string -> name
27 val name_to_string : name -> string
29 module NameHtbl : Hashtbl.S with type key = name
31 (****)
33 val accept : name
34 val accept_charset : name
35 val accept_encoding : name
36 val accept_language : name
37 val accept_ranges : name
38 val cache_control : name
39 val connection : name
40 val content_encoding : name
41 val content_length : name
42 val content_type : name
43 val content_range : name
44 val cookie : name
45 val date : name
46 val etag : name
47 val expires : name
48 val host : name
49 val if_match : name
50 val if_modified_since : name
51 val if_none_match : name
52 val if_unmodified_since : name
53 val if_range : name
54 val last_modified : name
55 val location : name
56 val server : name
57 val set_cookie : name
58 val status : name
59 val transfer_encoding : name
60 val user_agent : name
61 val referer : name
62 val range : name
64 (****)
66 type t
68 val empty : t
69 (** returns an empty set of HTTP headers *)
71 val add : name -> string -> t -> t
72 (** [add name s h] adds the header [name: s] to [h]. *)
74 val replace : name -> string -> t -> t
75 (** replace a header by another one. If it does not exist, adds it. *)
77 val replace_opt : name -> string option -> t -> t
78 (** replace or remove a header. *)
80 val find : name -> t -> string
81 (** find one of the values bound to [name] in the HTTP header [t].
82 Raise [Not_found] if it is not bound.
85 val find_all : name -> t -> string list
86 (** find all the values bound to [name] in the HTTP header [t]. *)
88 val iter : (name -> string -> unit) -> t -> unit
89 val fold : (name -> string list -> 'a -> 'a) -> t -> 'a -> 'a
91 val with_defaults : t -> t -> t
92 (** [with_defaults h1 h2] adds headers from [h1] to [h2].
93 If some headers were present, the are replaced by those from [h1].
97 val dyn_headers : t
98 (** Headers for dynamic pages (non cachable) *)