Usage of the shadow field in ngx_buf_t?

agentzh agentzh at
Fri Dec 4 04:35:33 MSK 2009

On Fri, Dec 4, 2009 at 7:13 AM, Brian Pane <brianp at> wrote:
> A follow-up question: When a body filter is processing buffers that
> were produced by the proxy module (i.e., buffers containing an HTTP response
> from a back-end server), is it safe to discard those buffers?

I think so :) My ngx_chunkin module's output body filter does
something like that to simply disgard the contents of the 411 error
page and I don't think an upstream module like ngx_proxy will have any
difference here :)

> Or is it necessary to
> pass the buffers through to the standard filters?

Then your client will probably see those stuffs sooner or later, which
is certainly not what you want :)

>  It's not clear to me
> whether anything in the standard filter chain needs to see the buffers
> containing the upstream response in order to do cleanup or flow control.

No, at least according to my knowledge :) Cleanup and flow control
usually happens in places like ngx_http_finalize_request, or a
read/write event handler. A notable exception might be bufs with the
temporary field set to 1. These bufs might need to be freed sooner
rather than later, but they're usually allocated in the current
request's pool anyway, it may not be a very big issue.

Feel free to correct me if I am wrong :)


More information about the nginx-devel mailing list