Module Email_message__.Headers

module Normalize : sig ... end

Normalize 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
val compare : t -> t -> int
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.state
val hash : t -> Base.Hash.hash_value
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val to_string_monoid : ?⁠eol:Email_message__.Lf_or_crlf.t -> t -> Email_message.String_monoid.t

eol defaults to `LF

val to_string : ?⁠eol:Email_message__.Lf_or_crlf.t -> t -> string
val empty : t
val append : t -> t -> t
val of_list : normalize:Normalize.encode -> (Name.t * Value.t) list -> t
val to_list : ?⁠normalize:Normalize.decode -> t -> (Name.t * Value.t) list
val last : ?⁠normalize:Normalize.decode -> t -> Name.t -> Value.t option
val find_all : ?⁠normalize:Normalize.decode -> t -> Name.t -> Value.t list
val names : t -> Name.t list
val add : ?⁠normalize:Normalize.encode -> t -> name:Name.t -> value:Value.t -> t
val add_at_bottom : ?⁠normalize:Normalize.encode -> t -> name:Name.t -> value:Value.t -> t
val add_if_missing : ?⁠normalize:Normalize.encode -> t -> name:Name.t -> value:Value.t -> t
val add_at_bottom_if_missing : ?⁠normalize:Normalize.encode -> t -> name:Name.t -> value:Value.t -> t
val set : ?⁠normalize:Normalize.encode -> t -> name:Name.t -> value:Value.t -> t
val set_at_bottom : ?⁠normalize:Normalize.encode -> t -> name:Name.t -> value:Value.t -> t
val add_all : ?⁠normalize:Normalize.encode -> t -> (Name.t * Value.t) list -> t
val add_all_at_bottom : ?⁠normalize:Normalize.encode -> t -> (Name.t * Value.t) list -> t
val smash_and_add : ?⁠normalize:Normalize.encode -> t -> name:Name.t -> value:Value.t -> t

If headers with this name already exist, concatenates the values for all separated by a comma, and appends the new value. Otherwise, creates a new header.

val filter : ?⁠normalize:Normalize.decode -> t -> f:(name:Name.t -> value:Value.t -> bool) -> t
val map : ?⁠normalize:Normalize.decode -> t -> f:(name:Name.t -> value:Value.t -> Value.t) -> t

rewrite header values, preserving original whitespace where possible.

normalize is used to Value.of_string ?normalize the ~value before passing to f, and again to Value.to_string ?normalize 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 ~normalize:`Whitespace ~f:(fun ~name:_ ~value -> Value.of_string ~normalize:`Whitespace value) . By contrast the following will 'normalize' the whitespace on all headers. map ~normalize:`None ~f:(fun ~name:_ ~value -> Value.of_string ~normalize:`Whitespace value) .

val map' : ?⁠normalize:Normalize.decode -> t -> f:(name:Name.t -> value:Value.t -> Name.t * Value.t) -> t
module Stable : sig ... end