pub struct HttpClient { /* private fields */ }http only.Expand description
Shared, cheaply cloneable (Arc-backed) HTTP client wrapper adding mirror routing,
rate-limit inspection, optional retries, and official-origin fallback on top of reqwest::Client.
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new HttpClient with default configuration.
Sourcepub fn builder() -> HttpClientBuilder
pub fn builder() -> HttpClientBuilder
Returns an HttpClientBuilder for customizing headers, mirror routing, and retries.
Sourcepub fn reqwest_client(&self) -> &Client
pub fn reqwest_client(&self) -> &Client
Returns the underlying reqwest::Client.
Sourcepub fn resilience(&self) -> &ResiliencePolicy
pub fn resilience(&self) -> &ResiliencePolicy
Returns the active ResiliencePolicy.
Sourcepub fn user_agent(&self) -> &str
pub fn user_agent(&self) -> &str
Returns the configured User-Agent string.
Sourcepub fn resolve_url(&self, official_url: &str) -> String
pub fn resolve_url(&self, official_url: &str) -> String
Resolves official_url through the active Mirror.
Sourcepub fn candidate_urls(&self, official_url: &str) -> Vec<String>
pub fn candidate_urls(&self, official_url: &str) -> Vec<String>
Returns the ordered candidate URLs that this client will try for official_url,
applying Mirror rules and respecting ResiliencePolicy::fallback_to_official.
Unlike Mirror::candidate_urls, which always appends official_url, this omits
the trailing official_url when a mirror rewrites official_url and
fallback_to_official is false.
Sourcepub async fn stream(&self, official_url: &str) -> Result<Response>
pub async fn stream(&self, official_url: &str) -> Result<Response>
Issues a mirror-aware GET request and returns the raw reqwest::Response stream.
Intended for lightweight direct streaming. Callers needing custom request headers,
conditional caching (If-None-Match / 304 Not Modified), custom per-download timeouts,
or post-download integrity verification failover should combine
HttpClient::candidate_urls with HttpClient::reqwest_client.