So is "rewrite_by_lua" also evil?
Eugaia
ngx.eugaia at gmail.com
Sat Oct 15 11:38:43 UTC 2011
On 15/10/2011 14:09, agentzh wrote:
> On Sat, Oct 15, 2011 at 6:43 PM, Eugaia<ngx.eugaia at gmail.com> wrote:
>> If you were just wrapping around set_var, then no. It would only be able to
>> handle non-reentrant code, just like setby.
>>
> Gathered so ;) I asked because I didn't want to miss any quick magic ;)
Nope. WYSIWYG. :-)
>> In order to have reentrant code, it would need to have a generic layer that
>> would be able to jump in/out of the script engine (and handle re-calling the
>> script engine post subrequest etc). The rewrite handler would also need to
>> be re-written to handle re-entering the script engine.
>>
>> The advantage of having a generic rewrite re-entrant layer, though, would be
>> that set_var would also be able to accept subrequests etc (assuming you used
>> that to base setby on).
>>
> I've been waiting for this feature for more than a year now ;)
Well, I've built a more generic scripting framework that implements
ngx_http_script_xxx - type stuff at any phase for which you can define
handlers, not just the rewrite phase, and have build a large number of
functions that work of this framework (echo, memcache, json parsing,
arrays, math functions, shell_exec and a bunch of other things). It is
almost able to do everything that you can do in ngx_lua (not quite, but
I'm getting there), as well as a few things I've not seen in Lua, and it
also works with the ngx_tcp_module (so you can do scripting on arbitrary
TCP traffic as well as at the various phases of HTTP requests). I've
had it running in production for a while, and am actively developing it,
I just haven't open-sourced it yet (I'm not sure yet whether I will or
not, so I'm holding off on doing so for the time being).
I could probably make what I've done work with the current Nginx and NDK
code, but since I'm not using the NDK set_var stuff for this scripting
stuff, I don't intend on spending quite a bit of time developing
something for the NDK that I'm never going to use.
Sorry.
Marcus.
More information about the nginx
mailing list