3 OCaml HTTP - do it yourself (fully OCaml) HTTP daemon
5 Copyright (C) <2002> Stefano Zacchiroli <zack@cs.unibo.it>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (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 General Public License for more details.
17 You should have received a copy of the GNU 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
29 type informational_substatus =
31 | `Switching_protocols
34 type success_substatus =
38 | `Non_authoritative_information
44 type redirection_substatus =
54 type client_error_substatus =
62 | `Proxy_authentication_required
67 | `Precondition_failed
68 | `Request_entity_too_large
69 | `Request_URI_too_large
70 | `Unsupported_media_type
71 | `Requested_range_not_satisfiable
75 type server_error_substatus =
76 [ `Internal_server_error
79 | `Service_unavailable
81 | `HTTP_version_not_supported
84 type informational_status = [ `Informational of informational_substatus ]
85 type success_status = [ `Success of success_substatus ]
86 type redirection_status = [ `Redirection of redirection_substatus ]
87 type client_error_status = [ `Client_error of client_error_substatus ]
88 type server_error_status = [ `Server_error of server_error_substatus ]
96 [ informational_status
100 | server_error_status
103 class type response =
105 method version: version
106 method setVersion: version -> unit
108 method setCode: int -> unit
109 method status: status
110 method setStatus: status -> unit
111 method reason: string
112 method setReason: string -> unit
113 method statusLine: string
114 method setStatusLine: string -> unit
115 method isInformational: bool
116 method isSuccess: bool
117 method isRedirection: bool
118 method isClientError: bool
119 method isServerError: bool
121 method contents: string
122 method setContents: string -> unit
123 method contentsBuf: Buffer.t
124 method setContentsBuf: Buffer.t -> unit
125 method addContents: string -> unit
126 method addContentsBuf: Buffer.t -> unit
127 method addHeader: name:string -> value:string -> unit
128 method addBasicHeaders: unit
129 method replaceHeader: name:string -> value:string -> unit
130 method removeHeader: name:string -> unit
131 method hasHeader: name:string -> bool
132 method header: name:string -> string
133 method headers: (string * string) list
134 method contentType: string
135 method setContentType: string -> unit
136 method contentEncoding: string
137 method setContentEncoding: string -> unit
139 method setDate: string -> unit
140 method expires: string
141 method setExpires: string -> unit
142 method server: string
143 method setServer: string -> unit
144 method serialize: out_channel -> unit
150 method param: string -> string
151 method params: (string * string) list