From dd948f836e75b4edecb912203fe9f6fe89365115 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 14 Oct 2018 08:08:12 -0700 Subject: [PATCH] HttpServer not sending streamed request body on HTTP/2 requests #544 --- CHANGES.md | 7 +++++-- src/httprequest.rs | 2 +- src/server/output.rs | 23 +++++++++-------------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ad5ae9e1b..62d2e9157 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,10 +1,13 @@ # Changes -## [0.7.13] - 2018-10-* +## [0.7.13] - 2018-10-14 ### Fixed -* Fixed rustls build +* Fixed rustls support + +* HttpServer not sending streamed request body on HTTP/2 requests #544 + ## [0.7.12] - 2018-10-10 diff --git a/src/httprequest.rs b/src/httprequest.rs index d8c49496a..0e4f74e5e 100644 --- a/src/httprequest.rs +++ b/src/httprequest.rs @@ -216,7 +216,7 @@ impl HttpRequest { self.url_for(name, &NO_PARAMS) } - /// This method returns reference to current `RouteInfo` object. + /// This method returns reference to current `ResourceInfo` object. #[inline] pub fn resource(&self) -> &ResourceInfo { &self.resource diff --git a/src/server/output.rs b/src/server/output.rs index 35f3c7a45..104700d44 100644 --- a/src/server/output.rs +++ b/src/server/output.rs @@ -299,12 +299,11 @@ impl Output { match resp.chunked() { Some(true) => { // Enable transfer encoding - if version == Version::HTTP_2 { - info.length = ResponseLength::None; - TransferEncoding::eof(buf) - } else { - info.length = ResponseLength::Chunked; + info.length = ResponseLength::Chunked; + if version == Version::HTTP_11 { TransferEncoding::chunked(buf) + } else { + TransferEncoding::eof(buf) } } Some(false) => TransferEncoding::eof(buf), @@ -337,15 +336,11 @@ impl Output { } } else { // Enable transfer encoding - match version { - Version::HTTP_11 => { - info.length = ResponseLength::Chunked; - TransferEncoding::chunked(buf) - } - _ => { - info.length = ResponseLength::None; - TransferEncoding::eof(buf) - } + info.length = ResponseLength::Chunked; + if version == Version::HTTP_11 { + TransferEncoding::chunked(buf) + } else { + TransferEncoding::eof(buf) } } }