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 daemon_mode = [ `Single | `Fork | `Thread ]
32 sockaddr:Unix.sockaddr -> timeout:int option ->
33 (in_channel -> out_channel -> unit) ->
36 type informational_substatus =
38 | `Switching_protocols
41 type success_substatus =
45 | `Non_authoritative_information
51 type redirection_substatus =
61 type client_error_substatus =
69 | `Proxy_authentication_required
74 | `Precondition_failed
75 | `Request_entity_too_large
76 | `Request_URI_too_large
77 | `Unsupported_media_type
78 | `Requested_range_not_satisfiable
82 type server_error_substatus =
83 [ `Internal_server_error
86 | `Service_unavailable
88 | `HTTP_version_not_supported
91 type informational_status = [ `Informational of informational_substatus ]
92 type success_status = [ `Success of success_substatus ]
93 type redirection_status = [ `Redirection of redirection_substatus ]
94 type client_error_status = [ `Client_error of client_error_substatus ]
95 type server_error_status = [ `Server_error of server_error_substatus ]
103 [ informational_status
106 | client_error_status
107 | server_error_status
110 class type response =
112 method version: version
113 method setVersion: version -> unit
115 method setCode: int -> unit
116 method status: status
117 method setStatus: status -> unit
118 method reason: string
119 method setReason: string -> unit
120 method statusLine: string
121 method setStatusLine: string -> unit
122 method isInformational: bool
123 method isSuccess: bool
124 method isRedirection: bool
125 method isClientError: bool
126 method isServerError: bool
128 method contents: string
129 method setContents: string -> unit
130 method contentsBuf: Buffer.t
131 method setContentsBuf: Buffer.t -> unit
132 method addContents: string -> unit
133 method addContentsBuf: Buffer.t -> unit
134 method addHeader: name:string -> value:string -> unit
135 method addBasicHeaders: unit
136 method replaceHeader: name:string -> value:string -> unit
137 method removeHeader: name:string -> unit
138 method hasHeader: name:string -> bool
139 method header: name:string -> string
140 method headers: (string * string) list
141 method contentType: string
142 method setContentType: string -> unit
143 method contentEncoding: string
144 method setContentEncoding: string -> unit
146 method setDate: string -> unit
147 method expires: string
148 method setExpires: string -> unit
149 method server: string
150 method setServer: string -> unit
151 method toString: string
152 method serialize: out_channel -> unit
158 method param: string -> string
159 method params: (string * string) list