X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Focaml-http%2Fhttp_types.mli;h=8d58326550bfac4d54564fde11a17d9789ae5837;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=476ca50185c04962631ddf9ed1b67ab5400c1c95;hpb=27f4dcab8e8f83fc580c6fec8682ac6fa515fc1f;p=helm.git diff --git a/helm/DEVEL/ocaml-http/http_types.mli b/helm/DEVEL/ocaml-http/http_types.mli index 476ca5018..8d5832655 100644 --- a/helm/DEVEL/ocaml-http/http_types.mli +++ b/helm/DEVEL/ocaml-http/http_types.mli @@ -2,21 +2,21 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002-2004> Stefano Zacchiroli + Copyright (C) <2002-2005> Stefano Zacchiroli This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + it under the terms of the GNU Library General Public License as + published by the Free Software Foundation, version 2. 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 General Public License for more details. + GNU Library General Public License for more details. - You should have received a copy of the GNU 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 + You should have received a copy of the GNU Library 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 *) (** Type definitions *) @@ -60,13 +60,13 @@ type auth_info = (* | `Digest of ... (* TODO digest authentication *) *) ] - (** informational HTTP status, see RFC2616 *) + (** @see "RFC2616" informational HTTP status *) type informational_substatus = [ `Continue | `Switching_protocols ] - (** success HTTP status, see RFC2616 *) + (** @see "RFC2616" success HTTP status *) type success_substatus = [ `OK | `Created @@ -77,7 +77,7 @@ type success_substatus = | `Partial_content ] - (** redirection HTTP status, see RFC2616 *) + (** @see "RFC2616" redirection HTTP status *) type redirection_substatus = [ `Multiple_choices | `Moved_permanently @@ -88,7 +88,7 @@ type redirection_substatus = | `Temporary_redirect ] - (** client error HTTP status, see RFC2616 *) + (** @see "RFC2616" client error HTTP status *) type client_error_substatus = [ `Bad_request | `Unauthorized @@ -110,7 +110,7 @@ type client_error_substatus = | `Expectation_failed ] - (** server error HTTP status, see RFC2616 *) + (** @see "RFC2616" server error HTTP status *) type server_error_substatus = [ `Internal_server_error | `Not_implemented @@ -259,14 +259,16 @@ class type request = object (** lookup a given parameter @param meth if given restrict the lookup area (e.g. if meth = POST than - only parameters received via POST are searched), if not given both GET and - POST parameter are searched in an unspecified order (actually the - implementation prefers POST parameters but this is not granted, you've - been warned) + only parameters received via POST are searched), if not given both GET + and POST parameter are searched in an unspecified order (actually the + implementation prefers POST parameters but this is not granted, you've + been warned) + @param default if provided, this value will be returned in case no + parameter of that name is available instead of raising Param_not_found @param name name of the parameter to lookup @return value associated to parameter name @raise Param_not_found if parameter name was not found *) - method param: ?meth:meth -> string -> string + method param: ?meth:meth -> ?default:string -> string -> string (** like param above but return a list of values associated to given parameter (a parameter could be defined indeed more than once: passed more @@ -299,7 +301,7 @@ class type response = object (** set response code *) method setCode: int -> unit - (** @return response status, see {! Http_types.status} *) + (** @return response status *) method status: status (** set response status *) @@ -336,7 +338,7 @@ class type response = object (** response is either a client error or a server error response *) method isError: bool - (** add basic headers to response, see {! Http_daemon.send_basic_headers} + (** add basic headers to response, see {!Http_daemon.send_basic_headers} *) method addBasicHeaders: unit @@ -376,52 +378,49 @@ class type response = object (** {2 Daemon specification} *) - (** daemon specification, describe the behaviour of an HTTP daemon - * @param address adress on which daemon will be listening, can be both a - * numeric address (e.g. "127.0.0.1") and an hostname (e.g. "localhost") - * @param auth authentication requirements (currently only basic authentication - * is supported). If set to None no authentication is - * required. If set to Some ("realm", `Basic ("foo", "bar")), only clients - * authenticated with baisc authentication, for realm "realm", providing - * username "foo" and password "bar" are accepted; others are rejected with a - * 401 response code - * @param callback function which will be called each time a correct HTTP - * request will be received. 1st callback argument is an Http_types.request - * object corresponding to the request received; 2nd argument is an output - * channel corresponding to the socket connected to the client - * @param mode requests handling mode, it can have three different values: - * `Single -> all requests will be handled by the same process, - * `Fork -> each request will be handled by a child process, - * `Thread -> each request will be handled by a (new) thread - * @param port TCP port on which the daemon will be listening - * @param root_dir directory to which ocaml http will chdir before starting - * handling requests; if None, no chdir will be performed (i.e. stay in the - * current working directory) - * @param exn_handler what to do when executing callback raises an exception. - * If None, the exception will be re-raised: in `Fork/`Thread mode the - * current process/thread will be terminated. in `Single mode the exception - * is ignored and the client socket closed. If Some callback, the callback - * will be executed before acting as per None; the callback is meant to - * perform some clean up actions, like releasing global mutexes in `Thread - * mode - * @param timeout timeout in seconds after which an incoming HTTP request will - * be terminated closing the corresponding TCP connection; None disable the - * timeout + (** daemon specification, describe the behaviour of an HTTP daemon. * - * The default daemon specification is Http_daemon.default_spec + * The default daemon specification is {!Http_daemon.default_spec} *) type daemon_spec = { address: string; + (** @param address adress on which daemon will be listening, can be both a + * numeric address (e.g. "127.0.0.1") and an hostname (e.g. "localhost") *) auth: (string * auth_info) option; + (** authentication requirements (currently only basic authentication is + * supported). If set to None no authentication is required. If set to Some + * ("realm", `Basic ("foo", "bar")), only clients authenticated with baisc + * authentication, for realm "realm", providing username "foo" and password + * "bar" are accepted; others are rejected with a 401 response code *) callback: request -> out_channel -> unit; + (** function which will be called each time a correct HTTP request will be + * received. 1st callback argument is an Http_types.request object + * corresponding to the request received; 2nd argument is an output channel + * corresponding to the socket connected to the client *) mode: daemon_mode; - port: int; + (** requests handling mode, it can have three different values: + * - `Single -> all requests will be handled by the same process, + * - `Fork -> each request will be handled by a child process, + * - `Thread -> each request will be handled by a (new) thread *) + port: int; (** TCP port on which the daemon will be listening *) root_dir: string option; + (** directory to which ocaml http will chdir before starting handling + * requests; if None, no chdir will be performed (i.e. stay in the current + * working directory) *) exn_handler: (exn -> out_channel -> unit) option; + (** what to do when executing callback raises an exception. If None, the + * exception will be re-raised: in `Fork/`Thread mode the current + * process/thread will be terminated. in `Single mode the exception is + * ignored and the client socket closed. If Some callback, the callback will + * be executed before acting as per None; the callback is meant to perform + * some clean up actions, like releasing global mutexes in `Thread mode *) timeout: int option; + (** timeout in seconds after which an incoming HTTP request will be + * terminated closing the corresponding TCP connection; None disable the + * timeout *) } - (** {2 OO representation of other HTTP "entities"} *) + (** {2 OO representation of other HTTP entities} *) (** an HTTP connection from a client to a server *) class type connection =