summaryrefslogtreecommitdiff
path: root/src/mod_cgi.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/mod_cgi.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/mod_cgi.c')
-rw-r--r--src/mod_cgi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mod_cgi.c b/src/mod_cgi.c
index d9f6a7a5..2214ba89 100644
--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -980,6 +980,13 @@ URIHANDLER_FUNC(cgi_is_handled) {
hctx->conf.upgrade
&& r->http_version == HTTP_VERSION_1_1
&& light_btst(r->rqst_htags, HTTP_HEADER_UPGRADE);
+ hctx->opts.max_per_read =
+ !(r->conf.stream_response_body /*(if not streaming response body)*/
+ & (FDEVENT_STREAM_RESPONSE|FDEVENT_STREAM_RESPONSE_BUFMIN))
+ ? 262144
+ : (r->conf.stream_response_body & FDEVENT_STREAM_RESPONSE_BUFMIN)
+ ? 16384 /* FDEVENT_STREAM_RESPONSE_BUFMIN */
+ : 65536; /* FDEVENT_STREAM_RESPONSE */
hctx->opts.fdfmt = S_IFIFO;
hctx->opts.backend = BACKEND_CGI;
hctx->opts.authorizer = 0;