package cohttp

  1. Overview
  2. Docs

Module Cohttp.AcceptSource

Accept-Encoding HTTP header parsing and generation

Sourcetype q = int

Qualities are integers between 0 and 1000. A header with "q=0.7" corresponds to a quality of 700.

Sourceval sexp_of_q : q -> Sexplib0.Sexp.t
Sourceval q_of_sexp : Sexplib0.Sexp.t -> q
Sourcetype 'a qlist = (q * 'a) list

Lists, annotated with qualities.

Sourceval sexp_of_qlist : ('a -> Sexplib0.Sexp.t) -> 'a qlist -> Sexplib0.Sexp.t
Sourceval qlist_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a qlist
Sourceval qsort : 'a qlist -> 'a qlist

Sort by quality, biggest first. Respect the initial ordering.

Sourcetype p = string * string
Sourceval sexp_of_p : p -> Sexplib0.Sexp.t
Sourceval p_of_sexp : Sexplib0.Sexp.t -> p
Sourcetype media_range =
  1. | MediaType of string * string
  2. | AnyMediaSubtype of string
  3. | AnyMedia
Sourceval sexp_of_media_range : media_range -> Sexplib0.Sexp.t
Sourceval media_range_of_sexp : Sexplib0.Sexp.t -> media_range
Sourcetype charset =
  1. | Charset of string
  2. | AnyCharset
Sourceval sexp_of_charset : charset -> Sexplib0.Sexp.t
Sourceval charset_of_sexp : Sexplib0.Sexp.t -> charset
Sourcetype encoding =
  1. | Encoding of string
  2. | Gzip
  3. | Compress
  4. | Deflate
  5. | Identity
  6. | AnyEncoding
Sourceval sexp_of_encoding : encoding -> Sexplib0.Sexp.t
Sourceval encoding_of_sexp : Sexplib0.Sexp.t -> encoding
Sourcetype language =
  1. | Language of string list
  2. | AnyLanguage

Basic language range tag. "en-gb" is represented as Language ["en"; "gb"].

Sourceval sexp_of_language : language -> Sexplib0.Sexp.t
Sourceval language_of_sexp : Sexplib0.Sexp.t -> language
Sourceval media_ranges : string option -> (media_range * p list) qlist
Sourceval charsets : string option -> charset qlist
Sourceval encodings : string option -> encoding qlist
Sourceval languages : string option -> language qlist
Sourceval string_of_media_range : (media_range * p list) -> q -> string
Sourceval string_of_charset : charset -> q -> string
Sourceval string_of_encoding : encoding -> q -> string
Sourceval string_of_language : language -> q -> string
Sourceval string_of_media_ranges : (media_range * p list) qlist -> string
Sourceval string_of_charsets : charset qlist -> string
Sourceval string_of_encodings : encoding qlist -> string
Sourceval string_of_languages : language qlist -> string
OCaml

Innovation. Community. Security.