Module Signature.Component

Message components that can be included in signatures per RFC 9421 Section 2.

Derived Components

Derived components are computed from message context, not raw headers. Per Section 2.2.

type derived = [
  1. | `Method
    (*

    @method - HTTP request method

    *)
  2. | `Authority
    (*

    @authority - Target host (host:port)

    *)
  3. | `Path
    (*

    @path - Request target path

    *)
  4. | `Query
    (*

    @query - Query string with leading ?

    *)
  5. | `Query_param of string
    (*

    @query-param;name="..." - Individual query parameter

    *)
  6. | `Target_uri
    (*

    @target-uri - Full target URI

    *)
  7. | `Status
    (*

    @status - Response status code (responses only)

    *)
  8. | `Request_target
    (*

    @request-target - Deprecated form

    *)
]

Component Parameters

Parameters that modify component behavior per Section 2.1.

type param = [
  1. | `Sf
    (*

    Strict structured field serialization

    *)
  2. | `Key of string
    (*

    Dictionary member selection

    *)
  3. | `Bs
    (*

    Byte sequence wrapping

    *)
  4. | `Tr
    (*

    Trailer field designation

    *)
  5. | `Req
    (*

    Request-bound component (for response signatures)

    *)
]
type t = [
  1. | `Derived of derived * param list
  2. | `Field of string * param list
]

A component identifier, either derived or a header field.

Constructors

val method_ : t

The @method derived component.

val authority : t

The @authority derived component.

val path : t

The @path derived component.

val query : t

The @query derived component.

val query_param : string -> t

query_param name creates a @query-param;name="..." component.

val target_uri : t

The @target-uri derived component.

val status : t

The @status derived component (for responses).

val request_target : t

The @request-target derived component (deprecated).

val field : string -> t

field name creates a header field component (lowercased).

val field_sf : string -> t

field_sf name creates a header field with strict structured field serialization.

val field_bs : string -> t

field_bs name creates a header field with byte sequence wrapping.

val field_key : string -> key:string -> t

field_key name ~key creates a header field selecting a dictionary member.

val field_req : string -> t

field_req name creates a request-bound header field (for responses).

Common Fields

val content_type : t

The content-type header field.

val content_length : t

The content-length header field.

val content_digest : t

The content-digest header field (RFC 9530).

val date : t

The date header field.

val host : t

The host header field.

Serialization

val to_identifier : t -> string

to_identifier c returns the component identifier string.

val of_identifier : string -> (t, string) result

of_identifier s parses a component identifier.