package ohttp

  1. Overview
  2. Docs
On This Page
  1. Limits
Oblivious HTTP (RFC 9458) for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1.2.tar.gz
md5=6a31dba01d9ee06d1b0115516439d8b0
sha512=c2739c32cf8d44b36ca565052f6b14feaf99a029115e8d94dcd469bd363f7dacd8e401a4ca07c0a3555f0fe5572a37516b489ddd945ee9acae4ceafc29e7dadb

doc/ohttp/Ohttp/Service/index.html

Module Ohttp.ServiceSource

The client, relay, and gateway of RFC 9458 Section 5, as steps from HTTP messages to HTTP messages.

Nothing here performs I/O. Each party is a function from what it received to what it sends, and the HTTP library in between does the sending: this is what the adapter packages ohttp-cohttp-lwt, ohttp-cohttp-eio, and ohttp-piaf wrap, and what an adapter for another library wraps too.

A message is its status, where it has one, its fields, and its content. The fields are pairs of a lowercase name and a value, and the content is read in full: an encapsulated message is only opened when it is complete.

Sourcetype request = {
  1. headers : (string * string) list;
  2. body : string;
}

A request to send: the method and the URI are the party's to choose, and are given with each step.

Sourcetype response = Http_binding.Gateway.error_response = {
  1. status : int;
  2. headers : (string * string) list;
  3. body : string;
}

Limits

A relay and a gateway read each message in full before they act on it, so what they hold at once grows with the length of each message and with the number of requests that they handle together. Both are bounded, by default with these values, and the adapters refuse what exceeds them without keeping it.

Sourceval default_max_request_size : int

The longest request that a relay or a gateway reads: 1 MiB.

Sourceval default_max_response_size : int

The longest response that a client, a relay, or a gateway reads from its peer: 8 MiB.

Sourceval default_max_in_flight : int

How many requests a relay or a gateway handles at once: 256.

Sourceval exceeds : max_size:int -> (string * string) list -> bool

exceeds ~max_size headers is whether the content-length field in headers declares more than max_size bytes, so that the content can be refused before it is read. A message without the field can still be too long: its content must be counted as it is read.

Sourceval content_too_large : response

The answer to a request that is longer than a relay or a gateway accepts: a 413.

Sourceval busy : response

The answer to a request that arrives while a relay or a gateway handles as many as it accepts: a 503, with retry-after: 1.

Sourcemodule Client : sig ... end

A client: sends an Encapsulated Request to a relay, and opens the Encapsulated Response that comes back.

Sourcemodule Relay : sig ... end

A relay: passes an Encapsulated Request on to one gateway, and its answer back, and nothing that identifies the client (RFC 9458 Sections 5 and 6.2). It cannot read what it carries.

Sourcemodule Gateway : sig ... end

A gateway: serves its key configurations, and answers each Encapsulated Request with an Encapsulated Response.