atom feed15 messages in ru.sysoev.nginxRe: sending data in "chunks"
FromSent OnAttachments
Manlio PerilloSep 16, 2007 10:36 am 
Igor SysoevSep 16, 2007 10:43 am 
Manlio PerilloSep 16, 2007 11:07 am 
Igor SysoevSep 16, 2007 11:13 am 
Manlio PerilloSep 16, 2007 11:35 am 
Igor SysoevSep 16, 2007 11:43 am 
Adrian Perez de CastroSep 16, 2007 1:35 pm 
Manlio PerilloSep 16, 2007 1:50 pm 
Igor SysoevSep 18, 2007 11:29 am 
Igor SysoevSep 18, 2007 11:32 am 
Manlio PerilloSep 18, 2007 12:16 pm 
Igor SysoevSep 18, 2007 12:30 pm 
Manlio PerilloSep 18, 2007 12:44 pm 
Adrian Perez de CastroSep 19, 2007 7:59 am 
Manlio PerilloSep 21, 2007 1:02 pm 
Subject:Re: sending data in "chunks"
From:Manlio Perillo (manl@public.gmane.org)
Date:Sep 16, 2007 11:07:46 am
List:ru.sysoev.nginx

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. The data is read from a Python file like object.

Right now I'm using a static ngx_chain_t variable, and for each cycle I read data from the "file" object in a buffer and do:

// allocate buf and b out.buf = b; out.next = NULL;

b->pos = buf; b->last = buf + n;

b->memory = 1; b->last_buf = 0;

rc = ngx_http_output_filter(r, &out); if (rc != NGX_OK) { goto error;

Then at the end of the cycle, then, I do a

return ngx_http_output_filter(r, NULL);

Unfortunately this does not works. What is the right method for sending data in chunks?

You should set b->last_buf in last buf. NULL is simply pump. It is used for exmple by default write handler to pass all buffered data to client.

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...