]> git.kaiwu.me - nginx.git/commit
Range filter: fixed loss of incoming chain links.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 13 May 2019 19:44:02 +0000 (22:44 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 13 May 2019 19:44:02 +0000 (22:44 +0300)
commitce0f35317e16c85c1ccae8f3a0a1d6f2426b2e78
tree9e0978cb306a8ef051cea2d63b9218f5e28fc66f
parenta39380a41e7d7ceeda2c0526c5df474f158c6a53
Range filter: fixed loss of incoming chain links.

Filters are not allowed to change incoming chain links, and should allocate
their own links if any modifications are needed.  Nevertheless
ngx_http_range_singlepart_body() modified incoming chain links in some
cases, notably at the end of the requested range.

No problems caused by this are currently known, mostly because of
limited number of possible modifications and the position of the range
body filter in the filter chain.  Though this behaviour is clearly incorrect
and tests demonstrate that it can at least cause some proxy buffers being
lost when using proxy_force_ranges, leading to less effective handling
of responses.

Fix is to always allocate new chain links in ngx_http_range_singlepart_body().
Links are explicitly freed to ensure constant memory usage with long-lived
requests.
src/http/modules/ngx_http_range_filter_module.c