package mehari-eio-unix

  1. Overview
  2. Docs
On This Page
  1. Net
Legend:
Library
Module
Module type
Parameter
Class
Class type

Net

include Mehari.UNIX with module IO := Mehari_eio.Direct and type addr = Mehari_eio.Addr.t and type dir_path := Eio.Fs.dir Eio.Path.t
type addr = Mehari_eio.Addr.t

Static files

val response_document : ?mime:Mehari.mime -> Eio.Fs.dir Eio.Path.t -> Mehari.response Mehari_eio.Direct.t

Same as Mehari.response but respond with content of given filename and use given Mehari.mime as mime type. If filename is not present on filesystem, responds with Mehari.not_found. If mime parameter is not supplied, use Mehari.no_mime as mime type.

val static : ?handler:(Eio.Fs.dir Eio.Path.t -> handler) -> ?dir_listing: (([ `Regular_file | `Directory | `Other ] * string) list -> handler) -> ?index:string -> ?show_hidden:bool -> Eio.Fs.dir Eio.Path.t -> handler

static dir validates the path parameter (retrieved by calling Mehari.param req 1) by checking that it is relative and does not contain parent directory references. If these checks fail, responds with Mehari.not_found.

If the checks succeed, static calls handler path request, where path is the path generated by the concatenation of directory that was passed to static and path of request. handler defaults to response_document.

If a directory is requested, static will look for a file named index in that directory to return. Otherwise, a directory file listing will be generated by calling dir_listing [ filename; ... ] request. index is default on index.gmi.

show_hidden decides whether hidden files should be listed. It defaults to false for security reasons.

OCaml

Innovation. Community. Security.