From 59c06158ad86d664f4e2900b777dc6cfa8fad2f0 Mon Sep 17 00:00:00 2001 From: Eloi DEMOLIS Date: Mon, 19 Feb 2024 13:02:34 +0100 Subject: [PATCH] Fix close propagation on close-delimited responses with front keep-alive Signed-off-by: Eloi DEMOLIS --- lib/src/protocol/kawa_h1/mod.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/src/protocol/kawa_h1/mod.rs b/lib/src/protocol/kawa_h1/mod.rs index 50eac5b2c..1d1b5a34f 100644 --- a/lib/src/protocol/kawa_h1/mod.rs +++ b/lib/src/protocol/kawa_h1/mod.rs @@ -9,7 +9,6 @@ use std::{ rc::{Rc, Weak}, }; -use kawa; use mio::{net::TcpStream, Interest, Token}; use rusty_ulid::Ulid; use sozu_command::{ @@ -476,8 +475,6 @@ impl Http Http (), } + let response_length_known = self.response_stream.body_size != kawa::BodySize::Empty; + let request_length_known = self.request_stream.body_size != kawa::BodySize::Empty; if !(self.request_stream.is_terminated() && self.request_stream.is_completed()) - && self.request_stream.body_size != kawa::BodySize::Empty + && request_length_known { error!("Response terminated before request, this case is not handled properly yet"); incr!("http.early_response_close"); @@ -519,20 +518,22 @@ impl Http { + (true, true, true) => { debug!("{} keep alive front/back", self.log_context()); self.reset(); StateResult::Continue } - (true, false) => { + (true, false, true) => { debug!("{} keep alive front", self.log_context()); self.reset(); StateResult::CloseBackend @@ -848,6 +849,7 @@ impl Http Http