X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Focaml-http%2Fhttp_daemon.mli;h=3cc176854560b8c38a5f9be638aae2dd2cf4be11;hb=5325734bc2e4927ed7ec146e35a6f0f2b49f50c1;hp=c9c8deb535f4f36c372756dca87e1ea6c303229f;hpb=8c529f71e51025d3e827475f9e224bd0e07190eb;p=helm.git diff --git a/helm/DEVEL/ocaml-http/http_daemon.mli b/helm/DEVEL/ocaml-http/http_daemon.mli index c9c8deb53..3cc176854 100644 --- a/helm/DEVEL/ocaml-http/http_daemon.mli +++ b/helm/DEVEL/ocaml-http/http_daemon.mli @@ -19,6 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) +(** Main OCaml HTTP module. + Here you can find two set of functions: + - functions which let you start an HTTP Daemon (start* functions) + - facility functions which let you sent responses back to clients *) + (** send a CRLF sequence on the given output channel, this is mandatory after the last header was sent and before start sending the response body *) val send_CRLF: out_channel -> unit @@ -44,14 +49,18 @@ val send_header: header: string -> value: string -> out_channel -> unit (** as send_header, but for a list of pairs *) val send_headers: headers:(string * string) list -> out_channel -> unit +(* (** send a file through an out_channel, file can be passed as an in_channel (if 'file' is given) or as a file name (if 'name' is given) *) val send_file: ?name:string -> ?file:in_channel -> out_channel -> unit +*) + (** send a file through an out_channel *) +val send_file: src:Http_types.file_source -> 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 *) + (** high level response function, respond on outchan sending: basic headers + (including Content-Length computed using 'body' argument), 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 -> @@ -125,12 +134,25 @@ val start': (Http_types.request -> out_channel -> unit) -> unit - (** Trivial static pages HTTP daemon *) + (** Object oriented interface to HTTP daemons. + @param addr address on which daemon will listen for connections + @param port port which daemon will bind + see {! Http_types.daemon} *) +class daemon: + ?addr: string -> ?port: int -> + unit -> + Http_types.daemon + + (** Trivial static pages HTTP daemon. + Daemons created using this module will serve directory indexes and files found + starting from the working directory *) module Trivial : sig + (** callback function, exposed if you like to use it as a basis to define + a more powerful daemon *) val callback : string -> 'a -> out_channel -> unit + + (** start the "trivial" HTTP daemon *) val start : ?addr:string -> ?port:int -> unit -> unit end -class daemon: ?addr: string -> ?port: int -> unit -> Http_types.daemon -