From e698ceae2e9b0eea0ce48cd5d1c96b7ade4c141d Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Thu, 22 Apr 2021 15:33:13 -0400 Subject: [PATCH] Send Poll::Ready(None) on empty body (#325) When used over H/2, sending an empty data frame for a GET can trigger some problematic behavior in Hyper. Hyper should probably handle this, but this ensures that we will not hit this behavior. When sending data to API Gateway services, we are getting GOAWAY because this causes to send duplicate empty data frames. --- rust-runtime/smithy-http/src/body.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-runtime/smithy-http/src/body.rs b/rust-runtime/smithy-http/src/body.rs index da6690e06..78dcac5d4 100644 --- a/rust-runtime/smithy-http/src/body.rs +++ b/rust-runtime/smithy-http/src/body.rs @@ -32,6 +32,7 @@ impl SdkBody { SdkBody::Once(ref mut opt) => { let data = opt.take(); match data { + Some(bytes) if bytes.is_empty() => Poll::Ready(None), Some(bytes) => Poll::Ready(Some(Ok(bytes))), None => Poll::Ready(None), } -- GitLab