1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 02:19:22 +02:00

fix handle big data chunkd for parsing

This commit is contained in:
Nikolay Kim
2018-02-27 23:04:57 -08:00
parent 4a48b43927
commit 7591592279
3 changed files with 16 additions and 13 deletions

View File

@ -2,7 +2,7 @@ use std::mem;
use httparse;
use http::{Version, HttpTryFrom, HeaderMap, StatusCode};
use http::header::{self, HeaderName, HeaderValue};
use bytes::{Bytes, BytesMut};
use bytes::{Bytes, BytesMut, BufMut};
use futures::{Poll, Async};
use error::{ParseError, PayloadError};
@ -64,7 +64,7 @@ impl HttpResponseParser {
if buf.capacity() >= MAX_BUFFER_SIZE {
return Err(HttpResponseParserError::Error(ParseError::TooLarge));
}
if read {
if read || buf.remaining_mut() == 0 {
match utils::read_from_io(io, buf) {
Ok(Async::Ready(0)) => return Err(HttpResponseParserError::Disconnect),
Ok(Async::Ready(_)) => (),