httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dave <>
Subject Re: WELCOME to
Date Tue, 10 Feb 2009 22:29:20 GMT
Hi All,

I'm having trouble with the server_rec->module_config variable and perhaps I
am misunderstanding something.

Using the apache2 C api, I have created a child_init callback (registered
through ap_hook_child_init) that is supposed to set up a per-process
resource when the server is first started (based off the pid.) Then, as each
request comes in through the handler (registered through ap_hook_handler) I
want the handler to look up that resource for its own use.

Currently I am attempting to store/retrieve this data using the
server_rec->module_config pointer. What I am having trouble with is that the
module_config pointed to during the child_init process seems to be different
than the module_config pointed to by the handler, so the resource
initialization isn't working.

Here's some a snippet code that illustrates my problem. Note that my_module
is a global variable. Am I doing something wrong?

static void get_resource(void *module_config) {
    my_config *cfg = (my_config *)ap_get_module_config(module_config,
    printf("module_config: %d\n", cfg);


static int my_child_init(apr_pool_t *p, server_rec *s) {
    printf("init server_config: %d\n", s->module_config);

static int my_handler(request_rec *r){
    printf("request server_config: %d\n", r->server->module_config);

This code prints out four different address locations where I would
expect/hope for two - one for the server_rec->module_config and one for the
returned value of ap_get_module_config().


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message