From e7de66603e383207b33748a1d42d76dbbe84d627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sun, 2 Aug 2020 02:45:56 +0200 Subject: [PATCH] aquatic_http: add upper limit on request read buffer --- TODO.md | 1 - aquatic_http/src/lib/network/connection.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index b8fa0f8..5218342 100644 --- a/TODO.md +++ b/TODO.md @@ -14,7 +14,6 @@ enabled), then converting them to mio tcp streams ## aquatic_http -* upper limit on request read buffer * check if connection ValidUntil's are really updated when necessary. there are some connections dropped after a while when load testing * add tests diff --git a/aquatic_http/src/lib/network/connection.rs b/aquatic_http/src/lib/network/connection.rs index 93e811a..aa6e6a0 100644 --- a/aquatic_http/src/lib/network/connection.rs +++ b/aquatic_http/src/lib/network/connection.rs @@ -46,7 +46,7 @@ impl EstablishedConnection { } pub fn read_request(&mut self) -> Result { - if self.buf.len() - self.bytes_read < 512 { + if (self.buf.len() - self.bytes_read < 512) & (self.buf.len() <= 3072){ self.buf.extend_from_slice(&[0; 1024]); }