WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ impl Error {
matches!(self.inner.kind, Kind::Parse(Parse::Status))
}

/// Returns true if this was an HTTP parse error caused by HTTP2 preface sent over an HTTP1
/// connection.
#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
pub fn is_parse_version_h2(&self) -> bool {
matches!(self.inner.kind, Kind::Parse(Parse::VersionH2))
}

/// Returns true if this error was caused by user code.
pub fn is_user(&self) -> bool {
matches!(self.inner.kind, Kind::User(_))
Expand Down
6 changes: 6 additions & 0 deletions src/server/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,12 @@ where
Pin::new(conn).graceful_shutdown()
}
}

/// Return the inner IO object, and additional information provided the connection
/// has not yet been upgraded.
pub fn into_parts(self) -> Option<Parts<I, S>> {
self.inner.map(|conn| conn.into_parts())
}
}

impl<I, B, S> Future for UpgradeableConnection<I, S>
Expand Down