0

any idea why config values I set in post_config hook on my module are not visible in my rewrite_mapfunc.

Here is my code snippet:

/** post_config*/
static int post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) {

hs_mod_cfg_t *mod_conf = ap_get_module_config(s->module_config, &my_module);
hs_conf *conf = mod_conf->hs_config;
int thread_count;

ap_mpm_query(AP_MPMQ_MAX_THREADS, &thread_count);

conf->nudge_url = apr_pstrcat(pconf, conf->service_url, "/", HS_API_VERSION, "/", HS_API_NUDGE_PATH, NULL);

return OK;}

and then, when I want to access conf->nudge_url in my rewrite_mapfunc this value is NULL. Please note that it is properly set in post_config and I never rewrite it.

Here is rewrite_mapfunc and the way how I get configuration.

static char *hailstorm_rewrite_mapfunc(request_rec *r, char *data) {

hs_mod_cfg_t *mod_conf = ap_get_module_config(r->server->module_config, &hailstorm_module);
hs_conf *hs_conf = mod_conf->hs_config;

ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "URL= %s", hs_conf->nudge_url);

return HS_MOD_OPEN;}

When I print URL I always get NULL even if I set it previously. Other values (I set as default) in hs_conf all have valid values.

Any idea what I'm missing or doing wrong.

pjolep
  • 21
  • 3

1 Answers1

0

Do you need to call ap_set_module_config() after updating your config data?

Leland Wallace
  • 228
  • 1
  • 5
  • This is asking a question not providing an answer and should be a comment. Once you have enough rep you'll be able to leave comments. – James Adkison Jul 02 '16 at 02:23