sending data in "chunks"
Manlio Perillo
manlio_perillo at libero.it
Sat Sep 22 00:02:39 MSD 2007
Igor Sysoev ha scritto:
> [...]
>> So, please let me know if I'm right:
>>
>> - when a call to ngx_http_output_filter with a buffer chain of *only
>> one* buffer returns with NGX_OK, it means that the *entire* buffer
>> has been sent to the client.
>
> Yes. Or if gzipping is enabled the entire buffer is buffered inside zlib.
>
>> If nginx return NGX_AGAIN then I have to set the
>> request->write_event_handler so that my handler is executed when the
>> socket is ready to send data again.
>
> Yes.
>
I have done some tests with mod_wsgi.
If a WSGI application returns a big buffer, ngx_http_output_filter
returns NGX_AGAIN, *however* the entire buffer is sent to the client.
This is the same behaviour with a "full" buffer chain, with the
difference that even if I return NGX_AGAIN from my request handler, the
client reads the full response (with a "full" buffer chain in a previous
test, I have to return NGX_OK, when receiving NGX_AGAIN).
So, it seems that nginx will send the entire content of a buffer, as
soon as control returns to it.
This is important for me: when ngx_http_output_filter returns NGX_AGAIN,
should I have to send again the previous buffer when my handler is
called from the write event, or I can safely send the next buffer?
Thanks and regards Manlio Perillo
More information about the nginx
mailing list