NGX_DONE from body_filter, and what's next?

bbm nginx-forum at
Thu Sep 17 15:22:59 MSD 2009

I'm writing a filter which do something like this:

1. collect incoming data from chains
2. enqueues some asynchronous connections using nginx event mechanism
3. returns NGX_DONE

How should I finalize work of this filter from callback?

Calling next_body_filter(request, result) from callback doesn't work, probably because of NGX_DONE returned from body_filter.
Calling next_body_filter and ngx_http_finalize_request(r, rc) seems to work (site is served, client can see the result), but it causes segfaults in strange places (outside my filter). Probably ngx_http_finalize_request must not be used in that way.

Does anybody know how to finalize work of filter which returned NGX_DONE?
Is it allowed to return NGX_DONE from filter?

Posted at Nginx Forum:,7413,7413#msg-7413

More information about the nginx mailing list