File: ocsigen_LocalFiles.mli

package info (click to toggle)
ocsigen 1.3.3-1squeeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,488 kB
  • ctags: 4,784
  • sloc: ml: 35,847; makefile: 1,450; sh: 772; ansic: 29
file content (45 lines) | stat: -rw-r--r-- 1,435 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(** The requested file does not exists *)
exception Failed_404
(** The requested file cannot be served: does not exists, not
    enough permissions ... *)
exception Failed_403
(** The file is a directory which we should not display *)
exception NotReadableDirectory



(*
(** Default options:
    - never follow symlinks
    - use "index.html" as default index
    - do not list the content of directories
*)
val default_options : options
*)


(** Local file corresponding to a request. The string argument
   represents the real file or directory to serve, eg. foo/index.html
   instead of foo *)
type resolved =
  | RFile of string
  | RDir of string


(** 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 *)
val resolve :
  ?no_check_for:string ->
  request:Ocsigen_extensions.request ->
  filename:string -> resolved


(** Given the local file [file], with a request originating at url
    [url], returns a viewable content of [file]. Currently, the [url]
    parameter is used only if [url] is a directory *)
val content:
  request:Ocsigen_extensions.request -> file:resolved -> Ocsigen_http_frame.result Lwt.t