diff --git a/src/client/conn/http1.rs b/src/client/conn/http1.rs index e91ae507ae..37eda04067 100644 --- a/src/client/conn/http1.rs +++ b/src/client/conn/http1.rs @@ -93,6 +93,16 @@ where .expect("algready upgraded") .poll_without_shutdown(cx) } + + /// Prevent shutdown of the underlying IO object at the end of service the request, + /// instead run `into_parts`. This is a convenience wrapper over `poll_without_shutdown`. + pub fn without_shutdown(self) -> impl Future>> { + let mut conn = Some(self); + futures_util::future::poll_fn(move |cx| -> Poll>> { + ready!(conn.as_mut().unwrap().poll_without_shutdown(cx))?; + Poll::Ready(Ok(conn.take().unwrap().into_parts())) + }) + } } /// A builder to configure an HTTP connection.