Skip to content
Merged
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
12 changes: 12 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ pub(super) enum User {
feature = "ffi"
))]
BodyWriteAborted,
/// User tried to send a connect request with a nonzero body
#[cfg(all(feature = "client", feature = "http2"))]
InvalidConnectWithBody,
/// Error from future of user's Service.
#[cfg(any(
all(any(feature = "client", feature = "server"), feature = "http1"),
Expand Down Expand Up @@ -395,6 +398,11 @@ impl Error {
Error::new_user(User::Body).with(cause)
}

#[cfg(all(feature = "client", feature = "http2"))]
pub(super) fn new_user_invalid_connect() -> Error {
Error::new_user(User::InvalidConnectWithBody)
}

#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
pub(super) fn new_shutdown(cause: std::io::Error) -> Error {
Error::new(Kind::Shutdown).with(cause)
Expand Down Expand Up @@ -492,6 +500,10 @@ impl Error {
feature = "ffi"
))]
Kind::User(User::BodyWriteAborted) => "user body write aborted",
#[cfg(all(feature = "client", feature = "http2"))]
Kind::User(User::InvalidConnectWithBody) => {
"user sent CONNECT request with non-zero body"
}
#[cfg(any(
all(any(feature = "client", feature = "server"), feature = "http1"),
all(feature = "server", feature = "http2")
Expand Down
4 changes: 2 additions & 2 deletions src/proto/h2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,9 @@ where
&& headers::content_length_parse_all(req.headers())
.map_or(false, |len| len != 0)
{
warn!("h2 connect request with non-zero body not supported");
debug!("h2 connect request with non-zero body not supported");
cb.send(Err(TrySendError {
error: crate::Error::new_h2(h2::Reason::INTERNAL_ERROR.into()),
error: crate::Error::new_user_invalid_connect(),
message: None,
}));
continue;
Expand Down
Loading