mirror of
https://github.com/actix/actix-web.git
synced 2025-01-30 19:08:33 +00:00
[0.7] Fix never-ending HTTP2 empty response (#737)
* Fix never-ending HTTP2 empty response #737
This commit is contained in:
parent
bf8262196f
commit
d9496d46d1
2 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue