summaryrefslogtreecommitdiff
path: root/src/connections.c
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 /src/connections.c
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
Diffstat (limited to 'src/connections.c')
-rw-r--r--src/connections.c6
1 files changed, 5 insertions, 1 deletions
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);