Communicating between nginx' modules

agentzh agentzh at gmail.com
Tue Dec 22 04:39:26 MSK 2009


On Mon, Dec 21, 2009 at 7:24 PM, Piotr Sikora <piotr.sikora at frickle.com> wrote:
>> Any tips on how to identify other modules?
>
> Using ngx_http_copy_filter_module as an example:
>
> First, you need to declare module you want to access:
> "ngx_module_t  ngx_http_copy_filter_module;"
>
> and then you can access it's context using:
> "r->ctx[ngx_http_copy_filter_module.ctx_index]"
>

Or even at runtime by inspecting the global array "ngx_modules" by
looking for familiar config directives ;) Then you'll get the module_t
object you're interested in *at runtime*, as I previously mentioned in
the "optional nginx module dependency" trick ;)

Cheers,
-agentzh



More information about the nginx-devel mailing list