Welcome! Log In Create A New Profile

Advanced

Re: Communicating between nginx' modules

Marcus Clyne
December 21, 2009 06:38AM
Piotr Sikora wrote:
>> I'm really missing a way to identify other modules. It would be really
>> nice if modules had an id (in Apache, that is the filename) that could
>> be looked up by other modules.
>>
>> 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]"
>
> Same applies to r->main_conf, r->srv_conf and r->loc_conf.

Or you can just use the functions you'd normally use to access your own
module, e.g.

ngx_http_conf_get_module_loc_conf (cf, ngx_http_copy_filter_module);

You might want to re-define the loc_conf's etc in a header file, if you
need to access their members.


Also, what about just using global variables defined in both modules -
if the modules are both one's you're creating?

Marcus.

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Communicating between nginx' modules

Srebrenko Šehić 4343 December 19, 2009 04:28AM

Re: Communicating between nginx' modules

agentzh 1432 December 19, 2009 06:20AM

Re: Communicating between nginx' modules

agentzh 1355 December 20, 2009 09:00PM

Re: Communicating between nginx' modules

Srebrenko Šehić 1372 December 21, 2009 05:46AM

Re: Communicating between nginx' modules

Piotr Sikora 1444 December 21, 2009 06:26AM

Re: Communicating between nginx' modules

Marcus Clyne 1334 December 21, 2009 06:38AM

Re: Communicating between nginx' modules

Piotr Sikora 1307 December 21, 2009 06:48AM

Re: Communicating between nginx' modules

Marcus Clyne 1409 December 21, 2009 07:02AM

Re: Communicating between nginx' modules

agentzh 2100 December 21, 2009 08:40PM

Re: Communicating between nginx' modules

Igor Sysoev 1337 December 19, 2009 06:34AM

Re: Communicating between nginx' modules

Srebrenko Šehić 1318 December 19, 2009 07:18AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready