From 4fdbd1631a465ca0255cc6a8faca6ba451d5a529 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Thu, 24 May 2018 07:23:14 -0700 Subject: [PATCH] proxy: Fix h1 body implementation (#995) In the h1-h2 glue code, we incorrectly called `is_empty()` to determine if an H1 stream had ended. `is_empty` only returns true if there was no body at all (rather than if the body has been fully consumed). By changing this to call `hyper::body::Payload::is_end_stream`, h1 bodies now behave the same as h2 bodies. Relates to #994 --- proxy/src/transparency/glue.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/transparency/glue.rs b/proxy/src/transparency/glue.rs index ec9324a31..5e3fea048 100644 --- a/proxy/src/transparency/glue.rs +++ b/proxy/src/transparency/glue.rs @@ -8,7 +8,7 @@ use futures::{future, Async, Future, Poll, Stream}; use futures::future::Either; use h2; use http; -use hyper; +use hyper::{self, body::Payload}; use hyper::client::connect as hyper_connect; use tokio_connect::Connect; use tower_service::{Service, NewService}; @@ -79,7 +79,7 @@ impl tower_h2::Body for HttpBody { fn is_end_stream(&self) -> bool { match *self { - HttpBody::Http1(ref b) => b.is_empty(), + HttpBody::Http1(ref b) => b.is_end_stream(), HttpBody::Http2(ref b) => b.is_end_stream(), } }