cohttp

An OCaml library for HTTP clients and servers
Library cohttp
Module Cohttp . Accept
type q = int

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

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

Lists, annotated with qualities.

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

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

type p = string * string
val sexp_of_p : p -> Sexplib0.Sexp.t
val p_of_sexp : Sexplib0.Sexp.t -> p
type media_range =
| MediaType of string * string
| AnyMediaSubtype of string
| AnyMedia
val sexp_of_media_range : media_range -> Sexplib0.Sexp.t
val media_range_of_sexp : Sexplib0.Sexp.t -> media_range
type charset =
| Charset of string
| AnyCharset
val sexp_of_charset : charset -> Sexplib0.Sexp.t
val charset_of_sexp : Sexplib0.Sexp.t -> charset
type encoding =
| Encoding of string
| Gzip
| Compress
| Deflate
| Identity
| AnyEncoding
val sexp_of_encoding : encoding -> Sexplib0.Sexp.t
val encoding_of_sexp : Sexplib0.Sexp.t -> encoding
type language =
| Language of string list
| AnyLanguage

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

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