Hello!
On Mon, Mar 24, 2014 at 3:29 AM, Heiko Möller wrote:
> I'm currently developing a module that would profit greatly from executing
> lua scripts. However, it would need to execute it from a request filter and
> not a config directive, ala *_by or *_by_file.
>
> Currently, I don't think that would be possible with the supplied api header
> in api/ngx_http_lua_api.h. Could you give me some pointers how that would be
> possible?
>
We can expose an API for this in ngx_http_lua_api.h. You're welcome to
create a patch for ngx_lua based on the existing code in
ngx_http_lua_header_filter_by_chunk or ngx_http_lua_log_by_chunk.
> workflow would be something like the following;
>
> - activate module
> - check predefined (or user supplied) paths for a lua script
> - if present, load file and cache
> - for each request (in a request filter), take the ngx_http_request_t, execute the lua code with it as parameter
> - depending on a return value set by the lua code do certain things
>
You also need to add a new "context" for such hooks. See
https://github.com/chaoslawful/lua-nginx-module/blob/master/src/ngx_http_lua_common.h#L81
I'm cc'ing the openresty-en mailing list:
https://groups.google.com/group/openresty-en You're recommended to put
such discussion there :)
Regards,
-agentzh