Hello!
On Wed, Aug 6, 2014 at 8:18 AM, Jon Keys wrote:
> How can I deal with / protect against a truncated response body when using
> `ngx.location.capture`?
>
> When using `body_filter_by_lua` I can check `ngx.arg[2]` to see if the
> response is complete. If it is not complete then I store the partial data in
> an `ngx.ctx.buffer` variable. My `body_filter_by_lua` will yield and be
> resumed when more data is available again and again until I have the
> complete response buffered.
> Is there a similar mechanism I can use with `ngx.location.capture` to ensure
> I get a complete response?
>
I've updated the docs for this flag to make it clearer:
"You always need to check the res.truncated boolean flag to see if
res.body contains truncated data. The data truncation here can only be
caused by those unrecoverable errors in your subrequests like the
cases that the remote end aborts the connection prematurely in the
middle of the response body data stream or a read timeout happens when
your subrequest is receiving the response body data from the remote."
So it's totally different from the case of output body filters.
Regards,
-agentzh