summaryrefslogtreecommitdiff
path: root/src/http_chunk.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-09-17 11:49:55 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2021-09-28 11:05:55 -0400
commitf19f71625cbf2d9ec482ae831e68ef7f66aa62bb (patch)
tree0e0df1e95de8b34d34b48ca0b989b0a31b66982a /src/http_chunk.c
parentd59d5e59b929b55653c1ad61378715f1ab439fbe (diff)
downloadlighttpd-git-f19f71625cbf2d9ec482ae831e68ef7f66aa62bb.tar.gz
[multiple] internal control for backend read bytes
separate internal control for backend max_per_read When not streaming, large reads will be flushed to temp files on disk. When streaming, use a smaller buffer to help reduce memory usage. When not streaming, attempt to read and empty kernel socket bufs. (e.g. MAX_READ_LIMIT 256k) When writing to sockets (or pipes) attempt to fill kernel socket bufs. (e.g. MAX_WRITE_LIMIT 256k)
Diffstat (limited to 'src/http_chunk.c')
-rw-r--r--src/http_chunk.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/http_chunk.c b/src/http_chunk.c
index ed8e381a..4cf32d4c 100644
--- a/src/http_chunk.c
+++ b/src/http_chunk.c
@@ -194,24 +194,16 @@ static int http_chunk_append_cq_to_tempfile(request_st * const r, chunkqueue * c
/*(inlined by compiler optimizer)*/
__attribute_pure__
-static int http_chunk_uses_tempfile(const request_st * const r, const chunkqueue * const cq, const size_t len) {
+static int http_chunk_uses_tempfile(const chunkqueue * const cq, const size_t len) {
/* current usage does not append_mem or append_buffer after appending
* file, so not checking if users of this interface have appended large
* (references to) files to chunkqueue, which would not be in memory
* (but included in calculation for whether or not to use temp file) */
-
- /*(allow slightly larger mem use if FDEVENT_STREAM_RESPONSE_BUFMIN
- * to reduce creation of temp files when backend producer will be
- * blocked until more data is sent to network to client)*/
-
const chunk * const c = cq->last;
return
((c && c->type == FILE_CHUNK && c->file.is_temp)
- || chunkqueue_length(cq) + len
- > ((r->conf.stream_response_body & FDEVENT_STREAM_RESPONSE_BUFMIN)
- ? 128*1024
- : 64*1024));
+ || chunkqueue_length(cq) + len > 65536);
}
__attribute_noinline__
@@ -221,7 +213,7 @@ int http_chunk_append_buffer(request_st * const r, buffer * const mem) {
chunkqueue * const cq = &r->write_queue;
- if (http_chunk_uses_tempfile(r, cq, len)) {
+ if (http_chunk_uses_tempfile(cq, len)) {
int rc = http_chunk_append_to_tempfile(r, mem->ptr, len);
buffer_clear(mem);
return rc;
@@ -246,7 +238,7 @@ int http_chunk_append_mem(request_st * const r, const char * const mem, const si
chunkqueue * const cq = &r->write_queue;
- if (http_chunk_uses_tempfile(r, cq, len))
+ if (http_chunk_uses_tempfile(cq, len))
return http_chunk_append_to_tempfile(r, mem, len);
if (r->resp_send_chunked)
@@ -265,7 +257,7 @@ int http_chunk_transfer_cqlen(request_st * const r, chunkqueue * const src, cons
chunkqueue * const cq = &r->write_queue;
- if (http_chunk_uses_tempfile(r, cq, len))
+ if (http_chunk_uses_tempfile(cq, len))
return http_chunk_append_cq_to_tempfile(r, src, len);
if (r->resp_send_chunked)