The problem shows itself with the following simple module.
When the hook is of type "ap_hook_post_read_request" per dir configuration is not   instantiated  
correctly and debug  has always value -1. With other kinds of hooks the debug variable is correctly is instantiated   with the various values found in the DIRECTORY LOCATION and FILES directives.
 
Is this a bug?
 
Regards,
Luca
 
  
module AP_MODULE_DECLARE_DATA config_module;
typedef struct __my {
    int debug;

} config_dir_t;


 static const char *debug_cmd(cmd_parms *cmd, void *in_dc,
                                      const char *name)
{
    config_dir_t *dc = in_dc;

    dc->debug= atoi(name);
    return NULL;
}


static void *create_dir_config_t(apr_pool_t *p,char *dummy)
{
    config_dir_t *dc = (config_dir_t *)apr_pcalloc(p,sizeof(config_dir_t));
    dc->debug = -1;
    return dc;
}

 static int find_code_page(request_rec *r)
{
    config_dir_t *dc = ap_get_module_config(r->per_dir_config,
                                             &config_module);
    fprintf(stderr,"Config: %d \n",dc->debug); 
    fflush(stderr);
    return DECLINED;
}

static const command_rec cmds[] =
{
    AP_INIT_TAKE1("debug",
                  debug_cmd,
                  NULL,
                  OR_FILEINFO,
                  "debug config di m....a"),

    {NULL}
};

static void charset_register_hooks(apr_pool_t *p)
{
    ap_hook_post_read_request(find_code_page, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA config_module =
{
    STANDARD20_MODULE_STUFF,
    create_dir_config_t,
    NULL,
    NULL,
    NULL,
    cmds,
    charset_register_hooks
};

 

Reply via email to