Usage of the shadow field in ngx_buf_t?

agentzh agentzh at
Fri Dec 4 10:05:05 MSK 2009

On Fri, Dec 4, 2009 at 1:32 PM, Dave Bailey <dave at> wrote:
> On Thu, Dec 3, 2009 at 6:29 PM, Brian Pane <brianp at> wrote:
>> After an afternoon with gdb, I think I've found one dependency: before
>> throwing away the buffers, the body filter needs to set buf->pos=buf->last
>> for each one.
> I think that's right.  I've written an nginx body filter that uses
> ngx_chain_update_chains, and the input buffers need to be marked as
> fully consumed (buf->pos = buf->last) in order for
> ngx_chain_update_chains to recycle them properly.

I see. Thanks a lot for the correction and explanation :)

>  In many cases, this
> permits the same one or two buffers to get recycled over and over
> again as the entire request body is passed through the filter.  I
> think it's one of the reasons nginx body filters are so incredibly
> high performance.

Indeed :)


More information about the nginx-devel mailing list