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
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 : 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_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
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 toValue.of_string ?whitespace
the~value
before passing tof
, and again toValue.to_string ?whitespace
the result. If the~value
andf ~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)
.
val map' : ?whitespace:Whitespace.t -> t -> f:(name:Name.t -> value:Value.t -> Name.t * Value.t) -> t
module Stable : sig ... end