]> git.kaiwu.me - nginx.git/commit
Sub filter: eliminate unnecessary buffering.
authorRoman Arutyunyan <arut@nginx.com>
Sat, 2 Jul 2016 12:59:53 +0000 (15:59 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Sat, 2 Jul 2016 12:59:53 +0000 (15:59 +0300)
commitc9dae918fdf370367e2dfd92f3b19853783c9fc9
treea8694cf8333a3fc498e397deae2d3c8fd8f8f9de
parentec7015575559f4e54cf3fc542437489ab6741264
Sub filter: eliminate unnecessary buffering.

Previously, when a buffer was processed by the sub filter, its final bytes
could be buffered by the filter even if they don't match any pattern.
This happened because the Boyer-Moore algorithm, employed by the sub filter
since b9447fc457b4 (1.9.4), matches the last characters of patterns prior to
checking other characters.  If the last character is out of scope, initial
bytes of a potential match are buffered until the last character is available.

Now, after receiving a flush or recycled buffer, the filter performs
additional checks to reduce the number of buffered bytes.  The potential match
is checked against the initial parts of all patterns.  Non-matching bytes are
not buffered.  This improves processing of a chunked response from upstream
by sending the entire chunks without buffering unless a partial match is found
at the end of a chunk.
src/http/modules/ngx_http_sub_filter_module.c