diff --git a/CHANGES.md b/CHANGES.md index 2aa9cbfd2..1e66cff87 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,16 +1,21 @@ # Changes -## [0.7.14] - 2018-10-x +## [0.7.14] - 2018-11-x ### Fixed +* Fix keep-alive timer reset + * HttpServer now treats streaming bodies the same for HTTP/1.x protocols. #549 + ### Added * Add method to configure custom error handler to `Query` and `Path` extractors. + * Add method to configure `SameSite` option in `CookieIdentityPolicy`. + ## [0.7.13] - 2018-10-14 ### Fixed diff --git a/Cargo.toml b/Cargo.toml index d98ce5eac..4a6e23173 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-web" -version = "0.7.13" +version = "0.7.14" authors = ["Nikolay Kim "] description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust." readme = "README.md" diff --git a/src/server/h1.rs b/src/server/h1.rs index a2ffc0551..07f773eba 100644 --- a/src/server/h1.rs +++ b/src/server/h1.rs @@ -87,7 +87,10 @@ where H: HttpHandler + 'static, { pub fn new( - settings: ServiceConfig, stream: T, buf: BytesMut, is_eof: bool, + settings: ServiceConfig, + stream: T, + buf: BytesMut, + is_eof: bool, keepalive_timer: Option, ) -> Self { let addr = stream.peer_addr(); @@ -123,8 +126,11 @@ where } pub(crate) fn for_error( - settings: ServiceConfig, stream: T, status: StatusCode, - mut keepalive_timer: Option, buf: BytesMut, + settings: ServiceConfig, + stream: T, + status: StatusCode, + mut keepalive_timer: Option, + buf: BytesMut, ) -> Self { if let Some(deadline) = settings.client_timer_expire() { let _ = keepalive_timer.as_mut().map(|delay| delay.reset(deadline)); @@ -298,16 +304,19 @@ where if let Some(deadline) = self.settings.client_shutdown_timer() { - timer.reset(deadline) + timer.reset(deadline); + let _ = timer.poll(); } else { return Ok(()); } } } else if let Some(dl) = self.settings.keep_alive_expire() { - timer.reset(dl) + timer.reset(dl); + let _ = timer.poll(); } } else { - timer.reset(self.ka_expire) + timer.reset(self.ka_expire); + let _ = timer.poll(); } } Ok(Async::NotReady) => (), diff --git a/src/server/h2.rs b/src/server/h2.rs index 35afa3397..c9e968a39 100644 --- a/src/server/h2.rs +++ b/src/server/h2.rs @@ -60,7 +60,10 @@ where H: HttpHandler + 'static, { pub fn new( - settings: ServiceConfig, io: T, buf: Bytes, keepalive_timer: Option, + settings: ServiceConfig, + io: T, + buf: Bytes, + keepalive_timer: Option, ) -> Self { let addr = io.peer_addr(); let extensions = io.extensions(); @@ -284,10 +287,12 @@ where if self.tasks.is_empty() { return Err(HttpDispatchError::ShutdownTimeout); } else if let Some(dl) = self.settings.keep_alive_expire() { - timer.reset(dl) + timer.reset(dl); + let _ = timer.poll(); } } else { - timer.reset(self.ka_expire) + timer.reset(self.ka_expire); + let _ = timer.poll(); } } Ok(Async::NotReady) => (), @@ -348,8 +353,11 @@ struct Entry { impl Entry { fn new( - parts: Parts, recv: RecvStream, resp: SendResponse, - addr: Option, settings: ServiceConfig, + parts: Parts, + recv: RecvStream, + resp: SendResponse, + addr: Option, + settings: ServiceConfig, extensions: Option>, ) -> Entry where