1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-12-02 19:32:24 +01:00

[0.7] Fix never-ending HTTP2 empty response (#737)

* Fix never-ending HTTP2 empty response #737
This commit is contained in:
Zeyi Fan 2019-03-28 17:40:12 -07:00 committed by Nikolay Kim
parent bf8262196f
commit d9496d46d1
2 changed files with 12 additions and 0 deletions

View File

@ -20,6 +20,8 @@
* Fix preflight CORS header compliance; refactor previous patch (#603). #717
* Fix never-ending HTTP2 request when response is empty (#709). #737
## [0.7.18] - 2019-01-10
### Added

View File

@ -234,6 +234,16 @@ impl<H: 'static> Writer for H2Writer<H> {
stream.reserve_capacity(cmp::min(self.buffer.len(), CHUNK_SIZE));
}
if self.flags.contains(Flags::EOF)
&& !self.flags.contains(Flags::RESERVED)
&& self.buffer.is_empty()
{
if let Err(e) = stream.send_data(Bytes::new(), true) {
return Err(io::Error::new(io::ErrorKind::Other, e));
}
return Ok(Async::Ready(()));
}
loop {
match stream.poll_capacity() {
Ok(Async::NotReady) => return Ok(Async::NotReady),