summaryrefslogtreecommitdiff
path: root/src/mod_vhostdb_ldap.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-03-16 01:05:47 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2021-03-26 07:33:42 -0400
commit38c873585020ac35f04cd2a7a2a56c8ecd7b0064 (patch)
tree277cd740fec455850e618cb30f3a40f4e402f5f1 /src/mod_vhostdb_ldap.c
parentf9cd50b782e860b54feee2b0ae8f0279058e85fe (diff)
downloadlighttpd-git-38c873585020ac35f04cd2a7a2a56c8ecd7b0064.tar.gz
[multiple] optimize primitives, buffer_extend()
optimize buffer_* primitives Other than buffer_string_set_length(), reallocate with one power-2 step in size (or use the requested size, if larger). This replaces the fixed BUFFER_PIECE_SIZE round-up of only 64 bytes extension each reallocation, which could lead to excessive reallocations in some scenarios. buffer_extend() convenience routine to prep for batch append (combines buffer_string_prepare_append() and buffer_commit()) mod_fastcgi, mod_scgi, mod_proxy and others now leverage buffer_extend() mod_scgi directly performs little-endian encoding of short ints http_response_write_header() optimizes writing response header, leveraging buffer_extend() modify mod_proxy to append line ends similar to how it is done in http_response_write_header() (removes one call to buffer_append_string_len())
Diffstat (limited to 'src/mod_vhostdb_ldap.c')
-rw-r--r--src/mod_vhostdb_ldap.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/mod_vhostdb_ldap.c b/src/mod_vhostdb_ldap.c
index a8fd2299..e0b8737b 100644
--- a/src/mod_vhostdb_ldap.c
+++ b/src/mod_vhostdb_ldap.c
@@ -242,12 +242,10 @@ static void mod_authn_append_ldap_filter_escape(buffer * const filter, const buf
}
/* escape * ( ) \ NUL ('\0') (and all UTF-8 chars with high bit set) */
- buffer_string_prepare_append(filter, 3);
- f = filter->ptr + buffer_string_length(filter);
+ f = buffer_extend(filter, 3);
f[0] = '\\';
f[1] = "0123456789abcdef"[(((unsigned char *)b)[i] >> 4) & 0xf];
f[2] = "0123456789abcdef"[(((unsigned char *)b)[i] ) & 0xf];
- buffer_commit(filter, 3);
}
}