(** Httpz static file server with Eio. A static file server supporting Range requests, ETag, If-None-Match conditional requests, and keep-alive connections. {2 Quick Start} {[ Eio_main.run @@ fun env -> Eio.Switch.run @@ fun sw -> let config = Httpz.Server.{ port = 8080; root = Eio.Stdenv.cwd env; limits = Httpz.default_limits; } in Httpz.Server.run ~net:(Eio.Stdenv.net env) ~sw config ]} *) (** {1 Configuration} *) type config = { port : int; (** TCP port to listen on. *) root : Eio.Fs.dir_ty Eio.Path.t; (** Document root directory. *) limits : Buf_read.limits; (** HTTP parsing limits. *) } (** Server configuration. *) val default_config : fs:Eio.Fs.dir_ty Eio.Path.t -> config (** [default_config ~fs] creates a default configuration serving from [fs] on port 8080 with default limits. *) (** {1 MIME Types} *) val mime_type_of_path : string -> string (** [mime_type_of_path path] returns the MIME type for a file path. Uses magic-mime for detection with sensible defaults. *) (** {1 Running the Server} *) val run : net:_ Eio.Net.t -> sw:Eio.Switch.t -> config -> unit (** [run ~net ~sw config] starts the HTTP server. The server runs until the switch is cancelled. It handles multiple concurrent connections using Eio fibers. Supports: - GET and HEAD requests - Range requests (single ranges) - ETag and If-None-Match conditional requests - Keep-alive connections - Directory index (index.html) *)