summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2015-09-24 06:03:38 +0000
committerstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2015-09-24 06:03:38 +0000
commitc7c61c01c215ae7081d183f62fc4bd9f147aa138 (patch)
treee3546fdc7ed6b114921b18f2584a7a70eeee8240
parent13aab19cb6ef96ea4526f8ee23386355e14fbaee (diff)
downloadlighttpd-c7c61c01c215ae7081d183f62fc4bd9f147aa138.tar.gz
[core] allocate at least 4k buffer for incoming data
From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3042 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--NEWS1
-rw-r--r--src/connections.c5
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);