]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/ocaml-http/types.mli
Now use cm{,x}a
[helm.git] / helm / DEVEL / ocaml-http / types.mli
1
2 (*
3   OCaml HTTP - do it yourself (fully OCaml) HTTP daemon
4
5   Copyright (C) <2002> Stefano Zacchiroli <zack@cs.unibo.it>
6
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.
11
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.
16
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
20 *)
21
22 type version = [ `HTTP_1_0 | `HTTP_1_1 ]
23
24 and meth = [ `GET ]
25
26 and informational_substatus = [ `Continue | `Switching_protocols ]
27
28 and success_substatus =
29   [ `Accepted
30   | `Created
31   | `No_content
32   | `Non_authoritative_information
33   | `OK
34   | `Partial_content
35   | `Reset_content
36   ]
37
38 and redirection_substatus =
39   [ `Found
40   | `Moved_permanently
41   | `Multiple_choices
42   | `Not_modified
43   | `See_other
44   | `Temporary_redirect
45   | `Use_proxy
46   ]
47
48 and client_error_substatus =
49   [ `Bad_request
50   | `Conflict
51   | `Expectation_failed
52   | `Forbidden
53   | `Gone
54   | `Length_required
55   | `Method_not_allowed
56   | `Not_acceptable
57   | `Not_found
58   | `Payment_required
59   | `Precondition_failed
60   | `Proxy_authentication_required
61   | `Request_URI_too_large
62   | `Request_entity_too_large
63   | `Request_time_out
64   | `Requested_range_not_satisfiable
65   | `Unauthorized
66   | `Unsupported_media_type
67   ]
68
69 and server_error_substatus =
70   [ `Bad_gateway
71   | `Gateway_time_out
72   | `HTTP_version_not_supported
73   | `Internal_server_error
74   | `Not_implemented
75   | `Service_unavailable
76   ]
77
78 and informational_status = [ `Informational of informational_substatus ]
79 and success_status = [ `Success of success_substatus ]
80 and redirection_status = [ `Redirection of redirection_substatus ]
81 and client_error_status = [ `Client_error of client_error_substatus ]
82 and server_error_status = [ `Server_error of server_error_substatus ]
83
84 and error_status =
85   [ `Client_error of client_error_substatus
86   | `Server_error of server_error_substatus
87   ]
88
89 and status =
90   [ `Client_error of client_error_substatus
91   | `Informational of informational_substatus
92   | `Redirection of redirection_substatus
93   | `Server_error of server_error_substatus
94   | `Success of success_substatus
95   ]
96
97 class type response =
98   object
99     method addContents : string -> unit
100     method addContentsBuf : Buffer.t -> unit
101     method addHeader : name:string -> value:string -> unit
102     method code : int
103     method contentEncoding : string
104     method contentType : string
105     method contents : string
106     method contentsBuf : Buffer.t
107     method date : string
108     method expires : string
109     method hasHeader : name:string -> bool
110     method header : name:string -> string
111     method headers : (string * string) list
112     method isClientError : bool
113     method isError : bool
114     method isInformational : bool
115     method isRedirection : bool
116     method isServerError : bool
117     method isSuccess : bool
118     method reason : string
119     method removeHeader : name:string -> unit
120     method replaceHeader : name:string -> value:string -> unit
121     method serialize : out_channel -> unit
122     method server : string
123     method setCode : int -> unit
124     method setContentEncoding : string -> unit
125     method setContentType : string -> unit
126     method setContents : string -> unit
127     method setContentsBuf : Buffer.t -> unit
128     method setDate : string -> unit
129     method setExpires : string -> unit
130     method setReason : string -> unit
131     method setServer : string -> unit
132     method setStatus : status -> unit
133     method setStatusLine : string -> unit
134     method setVersion : version -> unit
135     method status : status
136     method statusLine : string
137     method version : version
138   end
139
140 class type request =
141   object
142     method uri: string
143     method path: string
144     method param: string -> string
145     method params: (string * string) list
146   end
147