summaryrefslogtreecommitdiff
path: root/src/mod_proxy.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2018-10-29 03:48:09 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2018-10-29 09:00:46 -0400
commit7e8beee57773fbf37b6a6dcd5bb0f3a701fa8843 (patch)
tree59ef7524c761b74551d37564597e6c7518a5e64c /src/mod_proxy.c
parent610d5c03ab99c604f2e5b109a8067a821713f469 (diff)
downloadlighttpd-git-7e8beee57773fbf37b6a6dcd5bb0f3a701fa8843.tar.gz
[multiple] perf: power-2 alloc large headers
allocate large headers by power-2 as headers to backend is generated (mod_proxy, mod_fastcgi, mod_scgi)
Diffstat (limited to 'src/mod_proxy.c')
-rw-r--r--src/mod_proxy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mod_proxy.c b/src/mod_proxy.c
index 5ca2b757..0da05a4e 100644
--- a/src/mod_proxy.c
+++ b/src/mod_proxy.c
@@ -792,6 +792,12 @@ static handler_t proxy_create_env(server *srv, gw_handler_ctx *gwhctx) {
vlen = buffer_string_length(ds->value);
if (0 == vlen) continue;
+ if (buffer_string_space(b) < klen + vlen + 4) {
+ size_t extend = b->size * 2 - buffer_string_length(b);
+ extend = extend > klen + vlen + 4 ? extend : klen + vlen + 4 + 4095;
+ buffer_string_prepare_append(b, extend);
+ }
+
buffer_append_string_len(b, ds->key->ptr, klen);
buffer_append_string_len(b, CONST_STR_LEN(": "));
buffer_append_string_len(b, ds->value->ptr, vlen);