pub struct ResponseReader<R> { /* private fields */ }Expand description
Sequential client input sharing the native request body’s chunk decoder. The matching request head supplies HEAD/CONNECT semantics. This reader does not queue outstanding requests; the owner pairs each response in wire order. Switch responses expose raw input only; coordinating the outgoing switch and managed bidirectional client bodies is not implemented here.
Implementations§
Source§impl<R: ReadableStream> ResponseReader<R>
impl<R: ReadableStream> ResponseReader<R>
pub fn new(reader: R, options: Options) -> Result<Self, Error>
pub fn is_reusable(&self) -> bool
Sourcepub fn probe_viable(&mut self) -> bool
pub fn probe_viable(&mut self) -> bool
Check an idle connection before reusing it, by attempting one
immediate read with ReadableStream::try_read_into. Unread input, EOF
or a read error (including a TLS close notification) ends reuse
permanently. A reader that has not yet
read a response is not probed and reports true. A TLS stream
consumes records with no plaintext, such as key updates or session
tickets, during the read. This narrows the window for reusing a
connection the server closed, but cannot remove it: a close the
transport has not yet observed, or one arriving later, still fails
the next exchange.
Sourcepub async fn read_response<I: InterimHandler>(
&mut self,
request: &RequestMetadata,
interim: &mut InterimResponses<I>,
cancellation: &Cancellation,
) -> Result<Response<IncomingBody<'_, R>>, Error>
pub async fn read_response<I: InterimHandler>( &mut self, request: &RequestMetadata, interim: &mut InterimResponses<I>, cancellation: &Cancellation, ) -> Result<Response<IncomingBody<'_, R>>, Error>
Deliver interim heads in order, then return the final response. 101
and successful CONNECT yield raw input and permanently end HTTP reuse.
The connection owner supervises the independent request-writing lane.