From 091ce8030fdc3a690d0646f72cbd627476c907a3 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 6 Dec 2016 13:03:24 +0100 Subject: [PATCH] Drop the request reader earlier --- src/request.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/request.rs b/src/request.rs index 30c6619d8..d088a8847 100644 --- a/src/request.rs +++ b/src/request.rs @@ -368,6 +368,9 @@ impl Request { fn respond_impl(&mut self, response: Response) -> Result<(), IoError> where R: Read { + // Droping the request reader now so that further requests can start processing immediately. + self.data_reader = None; + let mut writer = self.into_writer_impl(); let do_not_send_body = self.method == Method::Head; @@ -396,6 +399,9 @@ impl fmt::Debug for Request { impl Drop for Request { fn drop(&mut self) { + // Droping the request reader now so that further requests can start processing immediately. + self.data_reader = None; + if self.response_writer.is_some() { let response = Response::empty(500); let _ = self.respond_impl(response); // ignoring any potential error