X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Focaml-http%2Fhttp_daemon.mli;h=96d10d638da732d0ba7393023cdfcd307d519d67;hb=9a072f192471daeca8cb409e991f0073b1d4271f;hp=975efb894d7cf4cd3bc3f0687187a26a99048aa7;hpb=697d0d8857366485238a67386d0ce8f18404ac42;p=helm.git diff --git a/helm/DEVEL/ocaml-http/http_daemon.mli b/helm/DEVEL/ocaml-http/http_daemon.mli index 975efb894..96d10d638 100644 --- a/helm/DEVEL/ocaml-http/http_daemon.mli +++ b/helm/DEVEL/ocaml-http/http_daemon.mli @@ -48,6 +48,16 @@ val send_headers: headers:(string * string) list -> out_channel -> unit (if 'file' is given) or as a file name (if 'name' is given) *) val send_file: ?name:string -> ?file:in_channel -> out_channel -> unit + (** high level response function, respond on outchan sending: basic headers, + headers probided via 'headers' argument, body given via 'body' argument. + Default response status is 200, default response HTTP version is + Http_common.http_version *) +val respond: + ?body:string -> ?headers:(string * string) list -> + ?version:Http_types.version -> ?code:int -> ?status:Http_types.status -> + out_channel -> + unit + (** send a 404 (not found) HTTP response *) val respond_not_found: url:string -> ?version: Http_types.version -> out_channel -> unit @@ -94,12 +104,15 @@ val respond_with: Http_types.response -> out_channel -> unit the HTTP client to which the user can write directly. 'timeout' parameter sets a timeout for each request processed by the daemon, if it's set to None, daemon waits forever for completed requests (use with care!), default is 5 - minute. 'fork' parameter (default 'true') sets whether the daemon forks a - child for each request or not, if children aren't forked request are server - one at a time (backlog is 10) and callbacks live in the same address space of - the process invoking 'start' *) + minute. 'mode' parameter has 3 possible values: `Single means that all request + are handled by the same process, `Fork means that each request is handled by a + separate process, `Thread means that each request is handled by a separate + thread, default is `Fork; 'root' (mnemonic "document root") is the directory + where the daemon chdir before starting up, default is current working + directory *) val start: - ?addr: string -> ?port: int -> ?timeout: int option -> ?fork: bool -> + ?addr: string -> ?port: int -> + ?timeout: int option -> ?mode: Http_types.daemon_mode -> ?root: string -> (string -> (string * string) list -> out_channel -> unit) -> unit @@ -107,10 +120,20 @@ val start: one is an out_channel as per 'start', but the secondo one is a Request.request object *) val start': - ?addr: string -> ?port: int -> ?timeout: int option -> ?fork: bool -> + ?addr: string -> ?port: int -> + ?timeout: int option -> ?mode: Http_types.daemon_mode -> ?root: string -> (Http_types.request -> out_channel -> unit) -> unit +(* + (** OO interface to HTTP daemons *) +class daemon: + ?addr: string -> ?port: int -> + ?timeout: int option -> ?mode: Http_types.daemon_mode ->?root:; string -> + (Http_types.request -> out_channel -> unit) -> + Http_types.daemon +*) + (** Trivial static pages HTTP daemon *) module Trivial : sig