Module Ocsigen_local_files

module Ocsigen_local_files: sig .. end

val section : Lwt_log_core.section

use Lwt_log.Section.set_level in order to debug

exception Failed_404

The requested file does not exists

exception Failed_403

The requested file cannot be served: does not exists, not enough permissions ...

exception NotReadableDirectory

The file is a directory which we should not display

type resolved = 
| RFile of string
| RDir of string

Local file corresponding to a request. The string argument represents the real file or directory to serve, eg. foo/index.html instead of foo

val resolve : ?no_check_for:string ->
request:Ocsigen_extensions.request ->
filename:string -> unit -> resolved

Finds filename in the filesystem, with a possible redirection if it is a directory. Takes into account the fact that filename does not exists, is a symlink or is a directory, and raises Failed_404 or Failed_403 accordingly.

no_check_for is supposed to be a prefix of filename ; directories above no_check_for are not checked for symlinks