custom handler module - dynamic response with unknown content length
yasser.zamani at live.com
Sat Mar 1 09:18:11 UTC 2014
Thanks for your response....
On Sat 01 Mar 2014 03:41:24 AM IRST, Maxim Dounin wrote:
> You've tried to send the same chain with the same buffer multiple
> times. After a buffer is sent for the first time, its pointers
> are adjusted to indicate it was sent - b->pos moved to b->last, and
> buffer's size become zero. Second attempt to send the same buffer
> will expectedly trigger the "zero size buf" check.
Great! I tried:
rc, rc:%d", rc);return rc;}b->pos = ngx_hello_string;b->last =
ngx_hello_string + sizeof(ngx_hello_string) - 1;b->memory =
1;b->last_buf = 0;}
which now fails with:
2014/03/01 12:23:39 [alert] 5022#0: *1 bad rc, rc:-2, client:
127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host:
2014/03/01 12:23:39 [alert] 5022#0: *1 zero size buf in writer t:0 r:0
f:0 00000000 080C7431-080C7431 00000000 0-0, client: 127.0.0.1, server:
localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
And to resolve this I know I should follow the solution at .
But is this a clean way to call 'ngx_http_output_filter' more than
once? (please see below to know why I have to call it multiple times)
FYI: Previous try did not fail in SECOND attempt but it failed when
client successfully download 936 bytes of repeated "Hello, World!"s (72
> Trivial aproach is to prepare full output chain, and then send it
> using single ngx_http_output_filter() call.
The full output chain will be usually a long video which is not a file
but will be generated in memory on the fly. I have to send each chunk
as soon as it's ready because the stream generation is time consuming
and client COULD NOT wait for all to be done. Suppose it's a 1 hour
video which dynamically has been generated and I would like to send
each minute as soon as it's ready without waiting for all 1 hour
transcoding. I'm aware about nginx's mp4 module but it does not support
time consuming dynamically generated video on memory.
WHAT WILL BE THE CORRECT WAY TO DO THIS IN NGINX?
More information about the nginx