httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dumindu Perera" <>
Subject Re: load data at server startup - is ap_hook_post_config() the right place?
Date Thu, 22 Mar 2007 17:18:09 GMT
Hi Daniel,

> the server_rec doesnt have a pool field. which field can I use to store
> the
> data?

AFAIK, server config is not the same as server_rec.

You create server configuration as in the following:

typedef struct {
     what ever data you need in server config
} my_cfg;

static void *my_server_config_create(apr_pool_t *p, server_rec *s) {
    my_cfg *cfg = (my_cfg *)apr_palloc(p, sizeof(my_cfg));
    Set your configuration in cfg struct
    return (void *)cfg;

module AP_MODULE_DECLARE_DATA my_module = {
    NULL, /*per-dir create,*/
    NULL, /*per-dir merge,*/
    my_server_config_create, /*per-sever create*/
    NULL, /*per-sever merge*/

now you can retrieve your server configuration as follows, when you have a
pointer to a request, 'r':

my_cfg *svr_cfg = (my_cfg *)ap_get_module_config(r->server->module_config,


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