pub struct ReqwestClient { /* private fields */ }Expand description
A shared reqwest client. Built once per process (the connection pool
is the Client); cheap to Arc, clone-free on the hot path.
Implementations§
Source§impl ReqwestClient
impl ReqwestClient
Sourcepub fn new() -> Self
pub fn new() -> Self
The hardened client: loopback, private and metadata destinations refused, default concurrency budget.
§Panics
Only if the rustls backend cannot initialize, which a static
webpki-roots configuration cannot do at runtime — a startup-time
invariant, the same class as core’s HmacSigner::new panic.
Sourcepub fn with_options(options: OutboundOptions) -> Self
pub fn with_options(options: OutboundOptions) -> Self
The client with explicit hardening knobs — see OutboundOptions.
Zero permits are clamped to one: a never-serving client is a
misconfiguration, not a mode.
§Panics
Trait Implementations§
Source§impl Default for ReqwestClient
impl Default for ReqwestClient
Source§impl HttpClient for ReqwestClient
impl HttpClient for ReqwestClient
Source§fn send_streaming<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<ByteStream>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_streaming<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<ByteStream>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The streamed send has no bounds of its own — no head deadline, no
idle gap or whole-body ceiling on the body, no byte cap, no
declared-length refusal. All of those are
cratefield_core::BoundedHttpClient’s, which every runtime wires
around this transport; a bare ReqwestClient used directly streams
unbounded.
Source§fn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
request and returns the fully-buffered response under the
bounds this port carries: the body is at most
MAX_RESPONSE_BYTES unless an HttpPolicy tightens it, the
exchange is bounded by that policy’s deadline
(enforced through BoundedHttpClient on runtimes that wrap),
the destination is vetted where real sockets are opened, and a
runtime that keeps a concurrency budget holds one for the send. Read more