mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-28 01:52:57 +01:00
Merge pull request #173 from jannic/pr
fix end-of-stream handling in parse_payload
This commit is contained in:
commit
7295846426
@ -81,16 +81,11 @@ impl HttpResponseParser {
|
||||
if self.decoder.is_some() {
|
||||
loop {
|
||||
// read payload
|
||||
let not_ready = match utils::read_from_io(io, buf) {
|
||||
Ok(Async::Ready(0)) => {
|
||||
if buf.is_empty() {
|
||||
return Err(PayloadError::Incomplete)
|
||||
}
|
||||
true
|
||||
}
|
||||
let (not_ready, stream_finished) = match utils::read_from_io(io, buf) {
|
||||
Ok(Async::Ready(0)) => (false, true),
|
||||
Err(err) => return Err(err.into()),
|
||||
Ok(Async::NotReady) => true,
|
||||
_ => false,
|
||||
Ok(Async::NotReady) => (true, false),
|
||||
_ => (false, false),
|
||||
};
|
||||
|
||||
match self.decoder.as_mut().unwrap().decode(buf) {
|
||||
@ -104,6 +99,9 @@ impl HttpResponseParser {
|
||||
if not_ready {
|
||||
return Ok(Async::NotReady)
|
||||
}
|
||||
if stream_finished {
|
||||
return Err(PayloadError::Incomplete)
|
||||
}
|
||||
}
|
||||
Err(err) => return Err(err.into()),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user