Skip to content

Commit

Permalink
feat(server): backport the split server conn modules from 1.0 (#3102)
Browse files Browse the repository at this point in the history
Closes #3079
  • Loading branch information
oddgrd authored Mar 8, 2023
1 parent 0368a41 commit 84881c9
Show file tree
Hide file tree
Showing 4 changed files with 853 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/server/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ use crate::error::{Kind, Parse};
#[cfg(feature = "http1")]
use crate::upgrade::Upgraded;

#[cfg(all(feature = "backports", feature = "http1"))]
pub mod http1;
#[cfg(all(feature = "backports", feature = "http2"))]
pub mod http2;

cfg_feature! {
#![any(feature = "http1", feature = "http2")]

Expand Down Expand Up @@ -327,7 +332,7 @@ impl<E> Http<E> {
self
}

/// Set a timeout for reading client request headers. If a client does not
/// Set a timeout for reading client request headers. If a client does not
/// transmit the entire header within this time, the connection is closed.
///
/// Default is None.
Expand Down Expand Up @@ -809,7 +814,12 @@ where
let mut conn = Some(self);
futures_util::future::poll_fn(move |cx| {
ready!(conn.as_mut().unwrap().poll_without_shutdown(cx))?;
Poll::Ready(conn.take().unwrap().try_into_parts().ok_or_else(crate::Error::new_without_shutdown_not_h1))
Poll::Ready(
conn.take()
.unwrap()
.try_into_parts()
.ok_or_else(crate::Error::new_without_shutdown_not_h1),
)
})
}

Expand Down
Loading

0 comments on commit 84881c9

Please sign in to comment.