1
type extension = string
8
(** By convention, "no specified charset" is represented by the empty
11
val no_charset: charset
13
(** Association between extensions and charset, with a default value. *)
16
(** All files are mapped to [no_charset] *)
17
val empty_charset_assoc : ?default:charset -> unit -> charset_assoc
19
val find_charset : string -> charset_assoc -> charset
21
(** Functions related to the default charset in the association *)
22
val default_charset : charset_assoc -> charset
23
val set_default_charset : charset_assoc -> charset -> charset_assoc
26
(** Updates the mapping between extensions from a file to its charset.
27
The update can be specified using the extension of the file,
28
the name of the file, or the entire file (with its path)
30
val update_charset_ext : charset_assoc -> extension -> charset -> charset_assoc
31
val update_charset_file : charset_assoc -> filename -> charset -> charset_assoc
32
val update_charset_regexp :
33
charset_assoc -> Netstring_pcre.regexp -> charset -> charset_assoc
37
(** MIME types; the default value is ["application/octet-stream"] *)
38
type mime_type = string
40
val default_mime_type : mime_type
42
(** association between extensions and mime types, with default value *)
45
(** Default values, obtained by reading the file specified by
46
[Ocsigen_config.get_mimefile] *)
47
val default_mime_assoc : unit -> mime_assoc
50
(** Parsing of a file containing mime associations, such as /etc/mime-types *)
51
val parse_mime_types : filename:string -> mime_assoc
54
(* The other functions are as for charsets *)
56
val find_mime : file -> mime_assoc -> string
58
val default_mime : mime_assoc -> mime_type
59
val set_default_mime : mime_assoc -> mime_type -> mime_assoc
61
val update_mime_ext : mime_assoc -> extension -> mime_type -> mime_assoc
62
val update_mime_file : mime_assoc -> filename -> mime_type -> mime_assoc
63
val update_mime_regexp :
64
mime_assoc -> Netstring_pcre.regexp -> mime_type -> mime_assoc