Communicating between nginx' modules

agentzh agentzh at gmail.com
Sat Dec 19 14:18:44 MSK 2009


On Sat, Dec 19, 2009 at 5:27 PM, Srebrenko Šehić <ssehic at gmail.com> wrote:
>
> Perhaps a module A can put something in it's ctx() and module B can
> read it using ngx_http_get_module_ctx(r, ...)?
>

Sure! And module A can also create module B's ctx for B to "fool" B ;)
ngx_http_get_module_ctx just reads an item from the r->ctx array using
the module index. No magic here :)

Just as a side note, I've designed a way for a module to detect
existence of another module at runtime, so as to implement "optional
dependency" mechanism for nginx modules. It's all about mudding
ngx_modules and looking for special directive name strings in each
module struct's commands array :)

Cheers,
-agentzh



More information about the nginx-devel mailing list