kithara-net
HTTP client with retry, timeout, and streaming. Wraps reqwest behind the Net trait, with a TimeoutNet decorator and a MockNet for tests.
Usage
use ;
use CancellationToken;
let client = new;
let bytes = client.get_bytes.await?; // None = no extra headers
let stream = client.stream.await?;
Decorators
TimeoutNet<N> wraps all methods with tokio::time::timeout and is exported in the public API. A retry decorator with exponential backoff (retries on 5xx, 429, 408, timeouts; does not retry on other 4xx) is also available, but only via the NetExt builder methods — the wrapper type itself is not part of the public surface.
Decorators compose via the NetExt extension trait:
use ;
use Duration;
use CancellationToken;
let client = new
.with_retry
.with_timeout;
Key Types
Timeout Behavior
Two independent limits in NetOptions, applied to all methods (get_bytes,
head, get_range, stream):
inactivity_timeout(default 30s) — max gap between reads (reqwestread_timeout); guards against stalled connections, not total duration.total_timeout(default 120s) — hard cap on request lifetime. Set toNoneto allow indefinite streaming as long as data keeps flowing.
The TimeoutNet decorator can wrap any Net with an additional
tokio::time::timeout over the whole call.
Integration
Used by kithara-file and kithara-hls for all HTTP operations. MockNet (behind the mock feature) enables deterministic testing without network access.