pub struct HttpClientStd { /* private fields */ }client only.Expand description
Std-blocking HTTP client wrapping a boxed Read + Write + Send stream.
Implementations§
Source§impl HttpClientStd
impl HttpClientStd
Sourcepub fn connect(url: &Url, tls: &Tls) -> Result<Self, HttpClientError>
Available on crate features native-tls or rustls-aws or rustls-ring only.
pub fn connect(url: &Url, tls: &Tls) -> Result<Self, HttpClientError>
native-tls or rustls-aws or rustls-ring only.Connects to url (TLS handshake on https), reading ALPN from
tls.rustls.alpn (see Self::default_alpn).
Source§impl HttpClientStd
impl HttpClientStd
Sourcepub fn new<S: Read + Write + Send + 'static>(stream: S) -> Self
pub fn new<S: Read + Write + Send + 'static>(stream: S) -> Self
Wraps a pre-connected stream; caller handles TCP and TLS.
Sourcepub fn default_alpn() -> Vec<String>
pub fn default_alpn() -> Vec<String>
Default ALPN identifier for HTTPS connections: http/1.1
(RFC 7301 + IANA registry).
Sourcepub fn set_stream<S: Read + Write + Send + 'static>(&mut self, stream: S)
pub fn set_stream<S: Read + Write + Send + 'static>(&mut self, stream: S)
Replaces the underlying stream (e.g. after Connection: close or
a cross-authority redirect).
Source§impl HttpClientStd
impl HttpClientStd
Sourcepub fn send_streaming(
self,
request: HttpRequest,
) -> Result<SseStream, HttpClientError>
pub fn send_streaming( self, request: HttpRequest, ) -> Result<SseStream, HttpClientError>
Opens an HTTP/1.1 SSE stream; requires Transfer-Encoding: chunked.
Consumes self because the connection is dedicated to the stream.
Trait Implementations§
Source§impl HttpClient for HttpClientStd
impl HttpClient for HttpClientStd
Source§fn run_send<C, E>(
&mut self,
coroutine: C,
) -> Result<HttpSendOutput, HttpClientError>where
C: HttpCoroutine<Yield = HttpSendYield, Return = Result<HttpSendOutput, E>>,
HttpClientError: From<E>,
fn run_send<C, E>(
&mut self,
coroutine: C,
) -> Result<HttpSendOutput, HttpClientError>where
C: HttpCoroutine<Yield = HttpSendYield, Return = Result<HttpSendOutput, E>>,
HttpClientError: From<E>,
Refuses a redirect with HttpClientError::UnexpectedRedirect,
this client following none: a request carrying credentials must
not replay them against whatever host a 3xx names, and the
caller is the only party that knows whether the new target is
one it meant to talk to.
Source§fn run<C, T, E>(&mut self, coroutine: C) -> Result<T, HttpClientError>
fn run<C, T, E>(&mut self, coroutine: C) -> Result<T, HttpClientError>
Source§fn send(
&mut self,
request: HttpRequest,
) -> Result<HttpSendOutput, HttpClientError>
fn send( &mut self, request: HttpRequest, ) -> Result<HttpSendOutput, HttpClientError>
Source§fn send_http10(
&mut self,
request: HttpRequest,
) -> Result<HttpSendOutput, HttpClientError>
fn send_http10( &mut self, request: HttpRequest, ) -> Result<HttpSendOutput, HttpClientError>
send.