Audit public API and SemVer surface (#103)
API and SemVer surface / api-surface (push) Failing after 13m8s
Native code generation / deterministic (push) Failing after 2m8s
Concurrency and resource soak audit / soak (push) Failing after 6m39s
Imaging and meshing gate / native (push) Has been cancelled
Release platform and feature matrix / audit (push) Has been cancelled
Release platform and feature matrix / matrix (false, linux-stable-minimal, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (false, macos-stable-portable, x86_64-apple-darwin, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (false, windows-stable-portable, x86_64-pc-windows-gnu, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (true, linux-msrv-portable, x86_64-unknown-linux-gnu, 1.96.0) (push) Has been cancelled
Release platform and feature matrix / matrix (true, linux-stable-default, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (true, linux-stable-features, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Release platform and feature matrix / matrix (true, linux-stable-release-surface, x86_64-unknown-linux-gnu, stable) (push) Has been cancelled
Documentation / documentation (push) Has been cancelled
Native Rust workspace compile / compile (push) Has been cancelled
Dependency and supply-chain audit / audit (push) Has been cancelled
JPEG 2000 feature / linux (push) Successful in 2m46s
Skia feature / linux (push) Successful in 31m0s

This commit is contained in:
hugo committed 2026-08-12 01:35:26 +00:00
1 parent 5eb3f01122
commit d08b59c9a9
35 files changed
+5112 -67

No files matched your search

+36 -34
View File
@@ -557,7 +557,7 @@ struct HttpCapsClientInner {
disposed: AtomicBool,
}
/// Native capability HTTP client with injectable fake and reqwest backends.
/// Native capability HTTP client with injectable fake and production backends.
#[derive(Clone)]
pub struct HttpCapsClient(Arc<HttpCapsClientInner>);
@@ -614,24 +614,47 @@ impl HttpCapsClient {
})))
}
pub fn with_reqwest_client(
client: reqwest::Client,
/// Creates the production HTTP backend without exposing the selected HTTP
/// implementation in the public API.
pub fn with_native_transport(
user_agent: &str,
timeout: Duration,
max_connections: usize,
rate_limiter: Option<CapsRateLimiter>,
limits: CapsHttpLimits,
) -> Result<Self, Error> {
Self::with_reqwest_client_and_concurrency(client, rate_limiter, limits, 32)
if timeout.is_zero() || max_connections == 0 {
return Err(Error::Argument);
}
limits.validate()?;
let max_redirects = limits.max_redirects;
let redirect = reqwest::redirect::Policy::custom(move |attempt| {
if attempt.previous().len() >= max_redirects {
return attempt.stop();
}
match attempt.url().scheme() {
"http" | "https" => attempt.follow(),
_ => attempt.stop(),
}
});
let client = reqwest::Client::builder()
.redirect(redirect)
.timeout(timeout)
.connect_timeout(timeout)
.pool_max_idle_per_host(max_connections)
.user_agent(user_agent)
.build()
.map_err(|_| Error::HttpRequest)?;
Self::with_reqwest_client(client, rate_limiter, limits, max_connections)
}
fn with_reqwest_client_and_concurrency(
fn with_reqwest_client(
client: reqwest::Client,
rate_limiter: Option<CapsRateLimiter>,
limits: CapsHttpLimits,
max_connections: usize,
) -> Result<Self, Error> {
limits.validate()?;
if max_connections == 0 {
return Err(Error::Argument);
}
Ok(Self(Arc::new(HttpCapsClientInner {
backend: HttpBackend::Reqwest(client),
limits,
@@ -648,33 +671,12 @@ impl HttpCapsClient {
max_connections: usize,
rate_limiter: CapsRateLimiter,
) -> Result<Self, Error> {
if max_connections == 0 {
return Err(Error::Argument);
}
let limits = CapsHttpLimits::default();
let max_redirects = limits.max_redirects;
let redirect = reqwest::redirect::Policy::custom(move |attempt| {
if attempt.previous().len() > max_redirects {
return attempt.stop();
}
match attempt.url().scheme() {
"http" | "https" => attempt.follow(),
_ => attempt.stop(),
}
});
let client = reqwest::Client::builder()
.redirect(redirect)
.timeout(timeout)
.connect_timeout(timeout)
.pool_max_idle_per_host(max_connections)
.user_agent(user_agent)
.build()
.map_err(|_| Error::HttpRequest)?;
Self::with_reqwest_client_and_concurrency(
client,
Some(rate_limiter),
limits,
Self::with_native_transport(
user_agent,
timeout,
max_connections,
Some(rate_limiter),
CapsHttpLimits::default(),
)
}