- (** create an HTTP daemon listening on 'addr':'port' (defaults are
- addr:"0.0.0.0" and port:80), callback is the user supplied function which
- receive as a first parameter the path required by the the HTTP client as a
- string, and a list of pair <parameter, value> representing parameters passed
- via GET. The last argument of the callback is an output_channel connected to
- 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' *)
+ (** start an HTTP daemon
+ * @param spec specification of daemon behaviour
+ *)
+val main: Http_types.daemon_spec -> unit
+
+ (** default daemon specification:
+ * - listen on 0.0.0.0, port 80
+ * - "always ok" callback (return an empty response, response code 200)
+ * - fork a child for each request
+ * - do not change to a root directory (i.e. keep cwd)
+ * - 300 seconds timeout
+ * - ignores exceptions
+ * - no authentication required *)
+val default_spec: Http_types.daemon_spec
+
+ (** currified daemon_spec constructor. Each parameter of this function
+ * corresponds to one field of Http_types.daemon_spec and defaults to the
+ * corresponding field of Http_daemon.default_spec *)
+val daemon_spec:
+ ?address:string ->
+ ?auth:(string * Http_types.auth_info) option ->
+ ?callback:(Http_types.request -> out_channel -> unit) ->
+ ?mode:(Http_types.daemon_mode) ->
+ ?port:int ->
+ ?root_dir:string option ->
+ ?exn_handler:(exn -> out_channel -> unit) option ->
+ ?timeout:int option ->
+ unit ->
+ Http_types.daemon_spec
+
+ (** starts an HTTP daemon (deprecated function)
+ *
+ * @deprecated This function will be removed in future versions, please switch
+ * to Http_daemon.main below.
+ *
+ * see {!Http_types.daemon_spec} for a detailed description of parameters
+ *
+ * @param addr like the "address" field of Http_types.daemon_spec, defaults to
+ * the wildcard address "0.0.0.0"
+ * @param port like the "port" field of Http_types.daemon_spec, defaults to 80
+ * @param timeout like the "timeout" field of Http_types.daemon_spec, defaults
+ * to Some 300
+ * @param mode like the "mode" field of Http_types.daemon_spec, defaults to
+ * `Fork
+ * @param root like the "root_dir" field of Http_types.daemon_spec, defaults to
+ * None
+ * @param callback functional version of the "callback" field of
+ * Http_types.daemon_spec. 1st argument is the request path, 2nd argument
+ * the decoded query string, 3rd argument an output channel connect to the
+ * client
+ *)