diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2018-10-29 03:48:09 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2018-10-29 09:00:46 -0400 |
commit | 7e8beee57773fbf37b6a6dcd5bb0f3a701fa8843 (patch) | |
tree | 59ef7524c761b74551d37564597e6c7518a5e64c /src/mod_proxy.c | |
parent | 610d5c03ab99c604f2e5b109a8067a821713f469 (diff) | |
download | lighttpd-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.c | 6 |
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); |