package h1

  1. Overview
  2. Docs

Module H1.HeadersSource

Header Fields

Each header field consists of a case-insensitive field name and a field value. The order in which header fields with differing field names are received is not significant. However, it is good practice to send header fields that contain control data first so that implementations can decide when not to handle a message as early as possible.

A sender MUST NOT generate multiple header fields with the same field name in a message unless either the entire field value for that header field is defined as a comma-separated list or the header field is a well-known exception, e.g., Set-Cookie.

A recipient MAY combine multiple header fields with the same field name into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma. The order in which header fields with the same field name are received is therefore significant to the interpretation of the combined field value; a proxy MUST NOT change the order of these field values when forwarding a message.

Note. Unless otherwise specified, all operations preserve header field order and all reference to equality on names is assumed to be case-insensitive.

See RFC7230§3.2 for more details.

Sourcetype t
Sourcetype name = string
Sourcetype value = string
Sourceval ci_equal : string -> string -> bool

Case-insensitive equality for testing header names or values

Sourceval empty : t
Sourceval of_list : (name * value) list -> t
Sourceval of_rev_list : (name * value) list -> t
Sourceval to_list : t -> (name * value) list
Sourceval to_rev_list : t -> (name * value) list
Sourceval add : t -> name -> value -> t
Sourceval add_unless_exists : t -> name -> value -> t
Sourceval add_list : t -> (name * value) list -> t
Sourceval add_multi : t -> (name * value list) list -> t
Sourceval remove : t -> name -> t
Sourceval replace : t -> name -> value -> t
Sourceval mem : t -> name -> bool
Sourceval get : t -> name -> value option
Sourceval get_exn : t -> name -> value
Sourceval get_multi : t -> name -> value list
Sourceval iter : f:(name -> value -> unit) -> t -> unit
Sourceval fold : f:(name -> value -> 'a -> 'a) -> init:'a -> t -> 'a
Sourceval to_string : t -> string
Sourceval pp_hum : Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.