Expand description
Provides a uniform access strategy to HTTP bodies in RAM, or buffered to a temporary file, and optionally memory mapped.
BodyImage
, BodySink
and supporting types provide a strategy for
safely handling potentially large HTTP request or response bodies without
risk of allocation failure, or the need to impose awkwardly low size limits
in the face of high concurrency. Tunables
size thresholds can be used
to decide when to accumulate the body in RAM vs. the filesystem, including
when the length is unknown in advance.
A Dialog
defines a complete HTTP request and response recording, using
BodyImage
for the request and response bodies and http crate types for
the headers and other components.
See the top-level (project workspace) README for additional rationale.
§Optional Features
The following features may be enabled or disabled at build time. All are enabled by default.
mmap: Adds BodyImage::mem_map
support for memory mapping from FsRead
state.
§Related Crates
barc: Body Archive container file reader and writer, for
serializing Dialog
records. See also barc-cli.
body-image-futio: Asynchronous HTTP integration with futures, http,
hyper, and tokio for BodyImage
/BodySink
, for both client and server
use.
Structs§
- Body
Image - A logical buffer of bytes, which may or may not be RAM resident.
- Body
Sink - A logical buffer of bytes, which may or may not be RAM resident, in the process of being written.
- Dialog
- An HTTP request and response recording.
- Epilog
- Extract of an HTTP response.
- Prolog
- Extract of an HTTP request.
- Tunables
- A collection of size limits and performance tuning constants. Setters are
available via
Tuner
. - Tuner
- A builder for
Tunables
. Invariants are asserted in the various setters andfinish
.
Enums§
- Body
Error - Error enumeration for
BodyImage
andBodySink
types. - Body
Reader - Provides a
Read
reference for aBodyImage
in any state. - Encoding
- A set of HTTP Transfer- or Content-Encoding values.
- Exploded
Image - Exploded representation of the possible
BodyImage
states, obtained viaBodyImage::explode()
.
Statics§
- VERSION
- The crate version string.
Traits§
- Recorded
- Access by reference for HTTP request (via
RequestRecorded
) and response recording types. - Request
Recorded - Access by reference for HTTP request recording types.