sending data in "chunks"
Igor Sysoev
is at rambler-co.ru
Tue Sep 18 22:29:29 MSD 2007
On Sun, Sep 16, 2007 at 10:35:42PM +0200, Adrian Perez de Castro wrote:
> El Sun, 16 Sep 2007 22:14:14 +0400
> Igor Sysoev <is at rambler-co.ru> escribi??:
>
> > On Sun, Sep 16, 2007 at 08:08:09PM +0200, Manlio Perillo wrote:
> >
> > > Igor Sysoev ha scritto:
> > > >On Sun, Sep 16, 2007 at 07:36:49PM +0200, Manlio Perillo wrote:
> > > >
> > > >>I need to send to the client some data in chunks. [...]
> > > Ok, thanks.
> > >
> > > [...]
> > >
> > > I have also found the real problem: one of the call to
> > > ngx_http_output_filter fails with a return value -2.
> > >
> > > Now I have to found the problem...
> >
> > It's NGX_AGAIN.
> > If you have got all your data ready you may send them at once in one
> > chain. But if you are getting then gradually, then after NGX_AGAIN
> > you should set event handlers and timer and return control to nginx.
>
> Mmmh, this affects me as well in the fancyindex module. When doing
> subrequests for header inclusion the call to ngx_http_output_filter
> returns NGX_AGAIN. I have just assumed NGX_AGAIN does not need extra
> work, and the rest of the data I send goes to the client...
>
> So I suppose I am making the worker process block too much, isn't it?
>
> I can only send all data in one chain when not using header/footer
> (they are subrequests), so I think it will be better to fix my code :D
In your case, when you subrequest local files you can treat NGX_AGIAN
as NGX_OK. If you subrequest remote sites, then you need some handling
of this subrequests.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list