From 6b2248ecdfb8bcfa745db8c9a8033a60b9d04452 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 29 Oct 2017 14:51:30 -0700 Subject: [PATCH] do not add error response if current response is in process --- src/lib.rs | 2 +- src/server.rs | 16 +++++++++------- src/task.rs | 1 - 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 960cc56e4..75cdddf2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -60,7 +60,7 @@ pub use context::HttpContext; pub use staticfiles::StaticFiles; // re-exports -pub use http::{Method, StatusCode}; +pub use http::{Method, StatusCode, Version}; pub use cookie::{Cookie, CookieBuilder}; pub use cookie::{ParseError as CookieParseError}; pub use http_range::{HttpRange, HttpRangeParseError}; diff --git a/src/server.rs b/src/server.rs index 7aede0879..a441ad7f5 100644 --- a/src/server.rs +++ b/src/server.rs @@ -324,13 +324,15 @@ impl Future for HttpChannel // tasks need to be completed self.error = true; - if let ReaderError::Error(err) = err { - self.items.push_back( - Entry {task: Task::reply(err), - req: UnsafeCell::new(HttpRequest::for_error()), - eof: false, - error: false, - finished: false}); + if self.items.is_empty() { + if let ReaderError::Error(err) = err { + self.items.push_back( + Entry {task: Task::reply(err), + req: UnsafeCell::new(HttpRequest::for_error()), + eof: false, + error: false, + finished: false}); + } } } Ok(Async::NotReady) => { diff --git a/src/task.rs b/src/task.rs index 992121c9e..74bb98b8d 100644 --- a/src/task.rs +++ b/src/task.rs @@ -412,7 +412,6 @@ impl Task { fut.borrow_mut().set() } self.drain.clear(); - // return self.poll_io(io, req); } // response is completed