Skip to main content

Module client

Module client 

Source
Expand description

The shared outbound client host: hot-reloadable reqwest stack with same-host-only redirects, idempotent-only retries, and TLS config. Shared HTTP client (ClientWithMiddleware): reqwest + retry middleware stack, used by from_openapi/from_mcp forwarding handlers.

See docs/architecture/http-adapters.md.

Structs§

ClientCertConfig
A mutual-TLS identity presented to upstreams: paths to the PEM-encoded client certificate and its private key. Both files are read at client-construction time (see HttpClientBuildError for the failure shapes) and combined into a single reqwest Identity.
HttpClientConfig
Policy knobs for the shared outbound client (SharedHttpClient). Defaults satisfy the review-001 request-policy findings (FWD-03/04/05): same-host-only redirects, idempotent-only retries with a wall-clock budget, 30 s request + 10 s connect timeouts, and a 300 s Retry-After ceiling. Streaming (SSE) forwards ride a derived client with the total request timeout removed (FWD-15) and enforce a total streamed-bytes cap (FWD-14).
RetryAfterMiddleware
Per-URL Retry-After memory (FWD-05): records the backlog deadline an upstream declared and holds back subsequent requests to that URL until it elapses. LRU-bounded by capacity; deadlines clamped to the configured ceiling.
RetryConfig
Retry backoff shape for the shared outbound client. The public surface is plain scalars (HY-06) — the concrete reqwest_retry::ExponentialBackoff policy is built internally from these at client-construction time, keeping the upstream concrete type out of this crate’s API.
SharedHttpClient
A hot-reloadable, middleware-stacked outbound HTTP client shared by consumer adapters. Clone-cheap (ArcSwap inner); callers reach the current stack through SharedHttpClient::client.

Enums§

HttpClientBuildError
Why a SharedHttpClient could not be built: PEM file reads fail with CaBundleRead/ClientCertRead, PEM parsing fails with CaBundleParse/ClientCertParse (both carry the offending path), and the underlying reqwest builder fails with Build.