1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

Enforce HW_BUFFER_SIZE inside h1::dispatcher (#1550)

This commit is contained in:
Andrew
2020-06-17 00:58:23 -07:00
committed by GitHub
parent 4f9a1ac3b7
commit e72ee28232
2 changed files with 13 additions and 0 deletions

View File

@ -861,7 +861,14 @@ where
T: AsyncRead + Unpin,
{
let mut read_some = false;
loop {
// If buf is full return but do not disconnect since
// there is more reading to be done
if buf.len() >= HW_BUFFER_SIZE {
return Ok(Some(false));
}
let remaining = buf.capacity() - buf.len();
if remaining < LW_BUFFER_SIZE {
buf.reserve(HW_BUFFER_SIZE - remaining);