pub struct ReqwestTransport { /* private fields */ }Expand description
The real transport. Built once per client, not per request:
reqwest::Client owns the connection pool.
Implementations§
Source§impl ReqwestTransport
impl ReqwestTransport
pub fn new() -> Result<Self>
Sourcepub fn with_timeout(timeout: Duration) -> Result<Self>
pub fn with_timeout(timeout: Duration) -> Result<Self>
Like ReqwestTransport::new with a caller-chosen request
timeout - a language-model answer routinely outlasts the 30 s
that is right for a hosting API.
Sourcepub fn with_download_hosts(self, hosts: Vec<String>) -> Self
pub fn with_download_hosts(self, hosts: Vec<String>) -> Self
Lets HttpTransport::download fetch from hosts as well as the
GitHub release hosts (URLs or bare hosts; see
crate::updates::download_host_allowed_with).
Trait Implementations§
Source§impl HttpTransport for ReqwestTransport
impl HttpTransport for ReqwestTransport
Source§fn fetch_bytes<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpBytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch_bytes<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpBytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
One GET with its raw answer. A client of its own: pictures redirect
across origins (an avatar to its CDN), which the API client above
refuses; a redirect never carries Authorization to another host
(the library drops it).
Source§fn download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: HttpRequest,
progress: &'life1 Progress<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + 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,
request: HttpRequest,
progress: &'life1 Progress<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Streams the body chunk by chunk. Redirects are followed only to the
hosts crate::updates::download_host_allowed names (a release asset
redirects to GitHub’s CDN), and the first URL must be one of them too.