(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 *)
+ (** 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 ->
(** send a "redirection" class response, optional body argument contains data
that will be displayed in the body of the response, default response status is
302 (moved permanently), only redirection status are accepted by this
- function, other values will @raise Failure *)
+ function, other values will raise Failure *)
val respond_redirect:
location:string -> ?body:string ->
?version: Http_types.version ->
(** send an "error" response (i.e. 400 <= status < 600), optional body
argument as per send_redirect, default response status is 400 (bad request),
only error status are accepted by this function, other values will
- @raise Failure *)
+ raise Failure *)
val respond_error:
?body:string ->
?version: Http_types.version ->
(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
val start : ?addr:string -> ?port:int -> unit -> unit
end
+class daemon: ?addr: string -> ?port: int -> unit -> Http_types.daemon
+