diff --git a/src/error.rs b/src/error.rs index 48917db970..2bbb166811 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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"), @@ -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) @@ -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") diff --git a/src/proto/h2/client.rs b/src/proto/h2/client.rs index 5e9641e408..faf36dde7f 100644 --- a/src/proto/h2/client.rs +++ b/src/proto/h2/client.rs @@ -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;