diff --git a/linkerd/proxy/http/src/orig_proto.rs b/linkerd/proxy/http/src/orig_proto.rs index 571f0d88de..c3e719a9c1 100644 --- a/linkerd/proxy/http/src/orig_proto.rs +++ b/linkerd/proxy/http/src/orig_proto.rs @@ -26,8 +26,9 @@ pub struct DowngradedH2Error(h2::Reason); #[pin_project::pin_project] #[derive(Debug, Default)] -pub struct UpgradeResponseBody { - inner: hyper::Body, +pub struct UpgradeResponseBody { + #[pin] + inner: B, } /// Downgrades HTTP2 requests that were previousl upgraded to their original @@ -197,8 +198,12 @@ fn test_downgrade_h2_error() { // === impl UpgradeResponseBody === -impl Body for UpgradeResponseBody { - type Data = bytes::Bytes; +impl Body for UpgradeResponseBody +where + B: Body + Unpin, + B::Error: std::error::Error + Send + Sync + 'static, +{ + type Data = B::Data; type Error = Error; #[inline] @@ -210,7 +215,8 @@ impl Body for UpgradeResponseBody { self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll>> { - Pin::new(self.project().inner) + self.project() + .inner .poll_data(cx) .map_err(downgrade_h2_error) } @@ -219,7 +225,8 @@ impl Body for UpgradeResponseBody { self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll, Self::Error>> { - Pin::new(self.project().inner) + self.project() + .inner .poll_trailers(cx) .map_err(downgrade_h2_error) }