Welcome! Log In Create A New Profile

Advanced

Read a local variable / http variable from config file in C [dev]

August 30, 2010 12:30PM
Hello,

I write a new module to nginx, and I have a small problem, because I don't know how I can read local/http variable (for example from GeoIP module) from nginx configuration file in my module. Below is a piece of my code :

my_module.c
-
{ ngx_string("my_language"),
NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_HTTP_SIF_CONF|NGX_CONF_TAKE1,
ngx_conf_set_str_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_my_loc_conf_t, language),
NULL },
-

nginx.conf
-
...
geoip_country_file /usr/local/nginx/GeoIP.dat;
...
my_language $geoip_country_code;
...
-

But in the variable language in ngx_http_my_loc_conf_t struct, I have string not parsed "$geoip_country_code" not a "US". GeoIP module works, I checked.

Please for any suggestions,
Thanks in advance.
-
Subject Author Posted

Read a local variable / http variable from config file in C [dev]

breaks August 30, 2010 12:30PM

Re: Read a local variable / http variable from config file in C [dev]

michalkraus December 17, 2010 06:03AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 90
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready