From cfa470db50f9a41173261262ca91b388bda31562 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 6 Jul 2018 09:21:24 +0600 Subject: [PATCH] close conneciton for head requests --- src/client/pipeline.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/pipeline.rs b/src/client/pipeline.rs index 9828478cd..2192d474c 100644 --- a/src/client/pipeline.rs +++ b/src/client/pipeline.rs @@ -202,6 +202,7 @@ impl Future for SendRequest { should_decompress: self.req.response_decompress(), write_state: RunningState::Running, timeout: Some(timeout), + close: self.req.method() == &Method::HEAD, }); self.state = State::Send(pl); } @@ -247,6 +248,7 @@ pub struct Pipeline { should_decompress: bool, write_state: RunningState, timeout: Option, + close: bool, } enum IoBody { @@ -280,7 +282,11 @@ impl RunningState { impl Pipeline { fn release_conn(&mut self) { if let Some(conn) = self.conn.take() { - conn.release() + if self.close { + conn.close() + } else { + conn.release() + } } }