Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Ocsigen_charset_mime

module Ocsigen_charset_mime : sig..end

Charset


type extension = string
type file = string
type filename = string

Charset

type charset = string

By convention, "no specified charset" is represented by the empty string

val no_charset : charset
type charset_assoc

Association between extensions and charset, with a default value.

val empty_charset_assoc : 
  ?default:charset ->
  unit -> charset_assoc

All files are mapped to no_charset

val find_charset : 
  string ->
  charset_assoc -> charset
val default_charset : charset_assoc -> charset

Functions related to the default charset in the association

val set_default_charset : 
  charset_assoc ->
  charset -> charset_assoc
val update_charset_ext : 
  charset_assoc ->
  extension ->
  charset -> charset_assoc

Updates the mapping between extensions from a file to its charset. The update can be specified using the extension of the file, the name of the file, or the entire file (with its path)

val update_charset_file : 
  charset_assoc ->
  filename ->
  charset -> charset_assoc
val update_charset_regexp : 
  charset_assoc ->
  Netstring_pcre.regexp ->
  charset -> charset_assoc
type mime_type = string

MIME types; the default value is "application/octet-stream"

val default_mime_type : mime_type
type mime_assoc

association between extensions and mime types, with default value

val default_mime_assoc : unit -> mime_assoc

Default values, obtained by reading the file specified by Ocsigen_config.get_mimefile

val parse_mime_types : filename:string -> mime_assoc

Parsing of a file containing mime associations, such as /etc/mime-types

val find_mime : file -> mime_assoc -> string
val default_mime : mime_assoc -> mime_type
val set_default_mime : 
  mime_assoc ->
  mime_type -> mime_assoc
val update_mime_ext : 
  mime_assoc ->
  extension ->
  mime_type -> mime_assoc
val update_mime_file : 
  mime_assoc ->
  filename ->
  mime_type -> mime_assoc
val update_mime_regexp : 
  mime_assoc ->
  Netstring_pcre.regexp ->
  mime_type -> mime_assoc