Nginx module "data sent" handler

Yichun Zhang (agentzh) agentzh at
Tue Feb 3 22:18:30 UTC 2015


On Tue, Feb 3, 2015 at 1:26 AM, Tigran Bayburtsyan wrote:
> As I understand all that 700kb data Nginx not sending at once it will take
> some Nginx loops to be sent.

Right. Both of the ngx_http_finalize_request and
ngx_http_output_filter are asynchronous calls. So data might be later
flushed out upon new write events via the ngx_http_writer handler.

> So is there any function or event to handle "data sent" event ?

One good approximation for this is to register your own *pool cleanup*
handler in r->pool. The request pool will not be destroyed when
there's still pending data (don't get confused it with the request
cleanup thing created by ngx_http_cleanup_add, which gets called too
early for this).


More information about the nginx-devel mailing list