stop body filter execution until header_filter chain is finished

Maxim Dounin mdounin at mdounin.ru
Sun Aug 8 00:44:16 MSD 2010


Hello!

On Fri, Aug 06, 2010 at 05:10:18PM +0200, Mirko Dziadzka wrote:

> Hi
> 
> I'm using a header-filter and a body-filter.
> 
> The header filter creates a subrequest and change the header in response
> 
> static ngx_int_t aod_response_header_filter(ngx_http_request_t *r)
> {
>     if (ctx->state == ...)
>     {
>         // setup subrequest
>         ...
>         res = ngx_http_subrequest(....)
>         return NGX_AGAIN;
>     }
> 
>     // handle subrequest response
>     ....
>     return aod_enforcer_next_header_filter(r);
> }
> so far, this works fine. However, during the execution of the
> subrequest, the response_body_filter of the main request is called. Is
> there a way to postpone this until the header_filter is finished?

Body chunks are serialized in postpone filter.  If you want them 
in correct order - you have to add your body filter after postpone 
one.

Maxim Dounin



More information about the nginx-devel mailing list