pub struct HttpClient { /* private fields */ }Expand description
Production HTTP client used across the workspace. Wraps a raw
reqwest::Client with the workspace’s [RetryNet] decorator so
every Net method (head/get_bytes/get_range/stream) honours
options.retry_policy — retryable errors (TLS-close, timeout,
5xx, IO) are re-issued with exponential backoff; non-retryable
errors (HTTP 4xx, cancellation) propagate immediately.
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(options: NetOptions, cancel: CancellationToken) -> Self
pub fn new(options: NetOptions, cancel: CancellationToken) -> Self
Build a retry-decorated HTTP client rooted on cancel. The
RetryNet layer aborts pending retries when that token is
cancelled. Callers MUST pass a token that lives in the
consumer-crate’s cancel tree — typically
master_cancel.child_token() derived at the consumer-crate top
(App, Queue, FFI player). The workspace cancel hierarchy
forbids orphan tokens in production code.
§Panics
Panics if the reqwest::Client builder fails to build.
Sourcepub async fn get_range(
&self,
url: Url,
range: RangeSpec,
headers: Option<Headers>,
) -> NetResult<ByteStream>
pub async fn get_range( &self, url: Url, range: RangeSpec, headers: Option<Headers>, ) -> NetResult<ByteStream>
pub fn options(&self) -> &NetOptions
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more