Module Email_message.Headers

module Whitespace : sig ... end

Whitespace.t specifies how to handle header values. It is used in two contexts:

module Name : sig ... end
module Common : sig ... end

This is just a list of commonly used header field names for simple reuse

module Value : sig ... end
type t
include sig ... end
val compare : t ‑> t ‑> int
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int ‑> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_shape_t : Bin_prot.Shape.t
val t_of_sexp : Sexplib.Sexp.t ‑> t
val sexp_of_t : t ‑> Sexplib.Sexp.t
include String_monoidable.S with type t := t
type t
val to_string_monoid : t ‑> String_monoid.t
val to_string : t ‑> string
val hash : t ‑> int
val empty : t
val append : t ‑> t ‑> t
val of_list : whitespace:Whitespace.t ‑> (Name.t * Value.t) list ‑> t
val to_list : ?whitespace:Whitespace.t ‑> t ‑> (Name.t * Value.t) list
val last : ?whitespace:Whitespace.t ‑> t ‑> Name.t ‑> Value.t option
val find_all : ?whitespace:Whitespace.t ‑> t ‑> Name.t ‑> Value.t list
val names : t ‑> Name.t list
val add : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val add_all : ?whitespace:Whitespace.t ‑> t ‑> (Name.t * Value.t) list ‑> t
val add_at_bottom : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val add_all_at_bottom : ?whitespace:Whitespace.t ‑> t ‑> (Name.t * Value.t) list ‑> t
val set : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val set_at_bottom : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val filter : ?whitespace:Whitespace.t ‑> t ‑> f:(name:Name.t ‑> value:Value.t ‑> bool) ‑> t
val map : ?whitespace:Whitespace.t ‑> t ‑> f:(name:Name.t ‑> value:Value.t ‑> Value.t) ‑> t

rewrite header values, preserving original whitespace where possible.

whitespace is used to Value.of_string ?whitespace the ~value before passing to f, and again to Value.to_string ?whitespace the result. If the ~value and f ~name ~value are the same no change will be made (white space is preserved).

Particularly the following is an identity transform: map ~whitespace:`Strip ~f:(fun ~name:_ ~value -> Value.of_string ~whitespace:`Strip value) . By contrast the following will 'normalize' the whitespace on all headers. map ~whitespace:`Keep ~f:(fun ~name:_ ~value -> Value.of_string ~whitespace:`Strip value) .