From 3512b5cb77939a213f10559dfc3128e3a3658454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Thu, 24 Sep 2015 06:03:38 +0000 Subject: [PATCH] [core] allocate at least 4k buffer for incoming data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Stefan Bühler git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3042 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/connections.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 20328b1c..8888ce2f 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ NEWS - 1.4.38 * [stat-cache] fix handling of collisions, might have returned wrong data (fixes #2669) + * [core] allocate at least 4k buffer for incoming data - 1.4.37 - 2015-08-30 * [mod_proxy] remove debug log line from error log (fixes #2659) diff --git a/src/connections.c b/src/connections.c index 7e205aff..46e46b1f 100644 --- a/src/connections.c +++ b/src/connections.c @@ -336,10 +336,11 @@ static int connection_handle_read(server *srv, connection *con) { len = recv(con->fd, mem, mem_len, 0); #else /* __WIN32 */ if (ioctl(con->fd, FIONREAD, &toread) || toread == 0 || toread <= 4*1024) { - if (toread > MAX_READ_LIMIT) toread = MAX_READ_LIMIT; - } else { toread = 4096; } + else if (toread > MAX_READ_LIMIT) { + toread = MAX_READ_LIMIT; + } chunkqueue_get_memory(con->read_queue, &mem, &mem_len, 0, toread); len = read(con->fd, mem, mem_len);