Module Private.Head

A message's head, read off a connection: its start line and its fields, and nothing a parser could read two ways.

A head RFC 9112 forbids is refused rather than repaired, because two readers that repair it differently -- this one and a proxy in front of it -- disagree about where one message ends and the next begins. The one repair made is the one the RFC requires of a user agent, in Response.

type version = Version.t =
  1. | Http_1_0
  2. | Http_1_1
type error =
  1. | Closed
    (*

    the peer went, or its connection failed, before a whole head

    *)
  2. | Refused of Status.t * string
    (*

    a head that cannot be read: the status it owes, and what was wrong, for a log

    *)

Why a request's head was not read.

val error_to_string : error -> string
module Request : sig ... end

A request's head, as a server reads it.

module Response : sig ... end

A response's head, as a client reads it.