Implement crash-safe streaming worker runtime
This commit is contained in:
parent
16cba3c317
commit
cdeef3cc1a
1 changed files with 7448 additions and 194 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue