mod_annot editor

Annotate Section

Request and Connection Variables

It is not appropriate to use the configuration structs for variables used in processing a Request or Connection. However, similar structs are provided for these, and can be allocated on the request or connection pools with the lifetime of the request or connection.

typedef struct {
} my_request_vars ;

We can now set this in some hook:
my_request_vars* vars = apr_palloc(r->pool, sizeof(my_request_vars)) ;
/* store stuff in vars */
ap_set_module_config(r->request_config, &my_module, vars) ;

and retrieve what we set later in the request:
my_request_vars* vars = ap_get_module_config(r->request_config, &my_module) ;

The conn_rec has an analagous conn_config field. Apache provides other contexts that may be useful for some applications: each filter and namespace has a context field for its own data. These topics will be the subjects of separate articles.