pub struct ReqwestHttpClient { /* private fields */ }Expand description
Default HttpClient — async reqwest, built with the SSRF policy resolver.
Redirects are followed by ReqwestHttpClient::follow_redirects rather than
reqwest, so every hop is checked against the request’s own policy and guard
and the pooled client holds no per-request authorization. The cookies
feature is intentionally never enabled, so the client carries no
cross-request state; the server builds one per session (see
submilli-server) for tenant isolation.
Implementations§
Source§impl ReqwestHttpClient
impl ReqwestHttpClient
pub fn new(policy: Arc<NetworkPolicy>) -> Self
Trait Implementations§
Source§impl Default for ReqwestHttpClient
impl Default for ReqwestHttpClient
Source§impl HttpClient for ReqwestHttpClient
impl HttpClient for ReqwestHttpClient
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn send_without_redirects_to<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 HttpRequest,
body: &'life2 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_without_redirects_to<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 HttpRequest,
body: &'life2 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result<HttpResponse, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sends
req to exactly its URL, never following a redirect, even on
the same host, and writes the body to body as it arrives; the
returned response’s body is empty. Git fetches through it, streaming
packs to disk, so an implementation holds one chunk in memory however
large max_response_size is. Read moreSource§fn download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 HttpRequest,
writer: &'life2 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result<DownloadMeta, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 HttpRequest,
writer: &'life2 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result<DownloadMeta, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
No default impl: the obvious “buffer via
send then write_all” fallback
would silently break the bounded-memory guarantee http.download advertises.
Implementations must enforce the request’s timeout across the entire
transfer and its byte limit on both wire and decoded output.Source§fn download_with_progress<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
req: &'life1 HttpRequest,
writer: &'life2 mut (dyn Write + Send),
progress: &'life3 DownloadProgress,
) -> Pin<Box<dyn Future<Output = Result<DownloadMeta, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn download_with_progress<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
req: &'life1 HttpRequest,
writer: &'life2 mut (dyn Write + Send),
progress: &'life3 DownloadProgress,
) -> Pin<Box<dyn Future<Output = Result<DownloadMeta, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Existing embedders report the bytes accepted by the destination.
Override to count actual wire bytes, including bytes rejected before a
write and compressed bytes. The default cannot observe those bytes.
Source§fn wants_recorded_request(&self) -> bool
fn wants_recorded_request(&self) -> bool
Whether this client reads
HttpRequest::recorded_as. The host functions
compute it only for a client that does.Auto Trait Implementations§
impl !Freeze for ReqwestHttpClient
impl !RefUnwindSafe for ReqwestHttpClient
impl !UnwindSafe for ReqwestHttpClient
impl Send for ReqwestHttpClient
impl Sync for ReqwestHttpClient
impl Unpin for ReqwestHttpClient
impl UnsafeUnpin for ReqwestHttpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more