Implement crash-safe streaming worker runtime

This commit is contained in:
ms2k 2026-07-17 18:51:44 +09:00
commit cdeef3cc1a

View file

@ -98,6 +98,26 @@ impl<R: Resolver> HttpSource<R> {
}
}
pub fn new_with_root_certificates(
resolver: R,
policy: OutboundPolicy,
timing: RetryTiming,
roots: impl IntoIterator<Item = Vec<u8>>,
) -> Result<Self, HttpSourceError> {
let timing = timing.sanitized();
let mut client =
OutboundClient::builder(resolver, policy).connect_timeout(timing.connect_timeout);
for root in roots {
let root = reqwest::Certificate::from_der(&root)
.map_err(|_| HttpSourceError::InvalidRequest)?;
client = client.add_root_certificate(root);
}
Ok(Self {
client: client.build(),
timing,
})
}
pub async fn open(
&self,
request: HttpSourceRequest,