Hello!
On Mon, Jul 16, 2012 at 3:11 AM, Tzury Bar Yochay wrote:
> I am getting the following error
>
> 2012/07/16 09:53:36 [error] 26590#0: *5430 lua handler aborted: runtime
> error: /etc/reblaze/active-domains/filter/session.lua:663: requesty body in
> temp file not supported
> stack traceback:
> [C]: in function 'get_post_args'
>
> which I spotted at ngx_http_lua_arg.c:93-95
> ...
> if (r->request_body->temp_file) {
> return luaL_error(L, "requesty body in temp file not supported");
> }
> ...
>
> What is that means?
> How can I avoid it not getting handler aborted,etc.
ngx.req.get_post_args() only supports pure in-memory request bodies.
That is, when the request body size is exceeding
client_body_buffer_size (but not exceeding client_max_body_size),
nginx will buffer the request body into temporary files, and in this
case, ngx.req.get_post_args() will refuse proceeding and throw out an
exception because it will involve reading the temporary files (usually
on the disk).
One work-around is to increase your client_body_buffer_size setting.
But please note that the ngx.req.get_post_args() API is mainly for web
apps written directly in Lua instead of web app firewalls. For the
latter, the right approach is to use the "downstream cosocket API",
i.e., the cosocket object returned by the ngx.req.socket() API, and
read the request body by pieces, and finally append the filtered bits
into the nginx request body buffers (both in-memory buffers or in-file
buffers) by the ngx.req.init_body(), ngx.req.append_body(), and
ngx.finish_body() APIs.
In short, I think you really need the "Lua input body filter"
mechanism provided by the ngx.req.socket(), ngx.req.init_body(),
ngx.req.append_body(), and ngx.req.finish_body() methods. The last
three methods only exist in the git "req-body" branch for now, but I'm
going to merge that branch into master in this week.
BTW, I'm cc'ing the openresty mailing list:
https://groups.google.com/group/openresty/
Best regards,
-agentzh