From 7f12b754e9aabc0cbfd02eaee9512bc19ed20bb4 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 25 May 2019 03:07:40 -0700 Subject: [PATCH] Handle socket read disconnect --- actix-http/CHANGES.md | 7 +++++++ actix-http/Cargo.toml | 4 ++-- actix-http/src/h1/dispatcher.rs | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 61c211b26..b3d8604c0 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [0.2.1] - 2019-05-2 + +### Fixed + +* Handle socket read disconnect + + ## [0.2.0] - 2019-05-12 ### Changed diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index fabf7fe92..b4bfabec5 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-http" -version = "0.2.0" +version = "0.2.1" authors = ["Nikolay Kim "] description = "Actix http primitives" readme = "README.md" @@ -47,7 +47,7 @@ secure-cookies = ["ring"] actix-service = "0.4.0" actix-codec = "0.1.2" actix-connect = "0.2.0" -actix-utils = "0.4.0" +actix-utils = "0.4.1" actix-server-config = "0.1.1" actix-threadpool = "0.1.0" diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs index ec717ae07..131811a9e 100644 --- a/actix-http/src/h1/dispatcher.rs +++ b/actix-http/src/h1/dispatcher.rs @@ -583,6 +583,9 @@ where self.ka_timer = Some(Delay::new(interval)); } else { self.flags.insert(Flags::READ_DISCONNECT); + if let Some(mut payload) = self.payload.take() { + payload.set_error(PayloadError::Incomplete(None)); + } return Ok(()); } } else { @@ -694,7 +697,10 @@ where if let Some(true) = read_available(&mut inner.io, &mut inner.read_buf)? { - inner.flags.insert(Flags::READ_DISCONNECT) + inner.flags.insert(Flags::READ_DISCONNECT); + if let Some(mut payload) = inner.payload.take() { + payload.feed_eof(); + } } }