package ohttp
Install
dune-project
Dependency
Authors
Maintainers
Sources
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.
A request to send: the method and the URI are the party's to choose, and are given with each step.
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.
The longest request that a relay or a gateway reads: 1 MiB.
The longest response that a client, a relay, or a gateway reads from its peer: 8 MiB.
How many requests a relay or a gateway handles at once: 256.
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.
The answer to a request that is longer than a relay or a gateway accepts: a 413.
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.
A client: sends an Encapsulated Request to a relay, and opens the Encapsulated Response that comes back.
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.