summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2015-10-13 19:46:04 +0000
committerStefan Bühler <stbuehler@web.de>2015-10-13 19:46:04 +0000
commitf19128086ce59b482fb1010a2891286ffd4fce47 (patch)
treeb76190a7b9a622ac99ded5c6a1ccdf300585be35
parentd7be04beb5757b00a1b25ab355693db13973e9a5 (diff)
downloadlighttpd-git-f19128086ce59b482fb1010a2891286ffd4fce47.tar.gz
[core] don't buffer request bodies smaller than 64k on disk
From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3046 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--NEWS1
-rw-r--r--src/connections.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index d39eedba..26f9e714 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ NEWS
* [core] fix search for header end if split across chunks (fixes #2670)
* [core] check configparserAlloc() result with force_assert
* [mod_auth] implement and use safe_memclear, using memset_s or explicit_bzero if available (thx loganaden)
+ * [core] don't buffer request bodies smaller than 64k on disk
- 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 e5deb50c..3b389f4a 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -983,7 +983,11 @@ found_header_end:
}
break;
case CON_STATE_READ_POST:
- if (0 != chunkqueue_steal_with_tempfiles(srv, dst_cq, cq, con->request.content_length - dst_cq->bytes_in )) {
+ if (con->request.content_length <= 64*1024) {
+ /* don't buffer request bodies <= 64k on disk */
+ chunkqueue_steal(dst_cq, cq, con->request.content_length - dst_cq->bytes_in);
+ }
+ else if (0 != chunkqueue_steal_with_tempfiles(srv, dst_cq, cq, con->request.content_length - dst_cq->bytes_in )) {
con->http_status = 413; /* Request-Entity too large */
con->keep_alive = 0;
connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);