module Whitespace : sig ... end
Whitespace.t
specifies how to handle header values. It is used in two contexts:
module Name : sig ... end
module Value : sig ... end
include sig ... end
val hash_fold_t : Base.Hash.state ‑> t ‑> Base.Hash.state
val hash : t ‑> Base.Hash.hash_value
val sexp_of_t : t ‑> Sexplib.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 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 add : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val add_at_bottom : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val add_if_missing : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val add_at_bottom_if_missing : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> 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 add_all : ?whitespace:Whitespace.t ‑> t ‑> (Name.t * Value.t) list ‑> t
val add_all_at_bottom : ?whitespace:Whitespace.t ‑> t ‑> (Name.t * Value.t) list ‑> t
val smash_and_add : ?whitespace:Whitespace.t ‑> 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 : ?whitespace:Whitespace.t ‑> t ‑> f:(name:Name.t ‑> value:Value.t ‑> bool) ‑> 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:`Normalize ~f:(fun ~name:_ ~value -> Value.of_string ~whitespace:`Normalize value)
.
By contrast the following will 'normalize' the whitespace on all headers.
map ~whitespace:`Raw ~f:(fun ~name:_ ~value -> Value.of_string ~whitespace:`Normalize value)
.
module Stable : sig ... end