File: http_headers.mli

package info (click to toggle)
ocsigen 1.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,560 kB
  • sloc: ml: 35,873; makefile: 1,450; sh: 772; ansic: 29
file content (98 lines) | stat: -rw-r--r-- 2,747 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
(* Ocsigen
 * http://www.ocsigen.org
 * Module http_headers.mli
 * Copyright (C) 2007 Jrme Vouillon
 * Laboratoire PPS - CNRS Universit Paris Diderot
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, with linking exception;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *)


(*XXX Can have multiple headers with the same name...*)
type name

val name : string -> name
val name_to_string : name -> string

module NameHtbl : Hashtbl.S with type key = name

(****)

val accept : name
val accept_charset : name
val accept_encoding : name
val accept_language : name
val accept_ranges : name
val cache_control : name
val connection : name
val content_encoding : name
val content_length : name
val content_type : name
val content_range : name
val cookie : name
val date : name
val etag : name
val expires : name
val host : name
val if_match : name
val if_modified_since : name
val if_none_match : name
val if_unmodified_since : name
val if_range : name
val last_modified : name
val location : name
val server : name
val set_cookie : name
val status : name
val transfer_encoding : name
val user_agent : name
val referer : name
val range : name

(****)

type t

val empty : t
(** returns an empty set of HTTP headers *)

val add : name -> string -> t -> t
(** [add name s h] adds the header [name: s] to [h]. *)

val replace : name -> string -> t -> t
(** replace a header by another one. If it does not exist, adds it. *)

val replace_opt : name -> string option -> t -> t
(** replace or remove a header. *)

val find : name -> t -> string
(** find one of the values bound to [name] in the HTTP header [t].
   Raise [Not_found] if it is not bound.
 *)

val find_all : name -> t -> string list
(** find all the values bound to [name] in the HTTP header [t]. *)

val iter : (name -> string -> unit) -> t -> unit
val fold : (name -> string list -> 'a -> 'a) -> t -> 'a -> 'a

val with_defaults : t -> t -> t
(** [with_defaults h1 h2] adds headers from [h1] to [h2].
   If some headers were present, the are replaced by those from [h1].
 *)


val dyn_headers : t
(** Headers for dynamic pages (non cachable) *)