c - How to retrieve a variable from the Apache configuration inside the module? -
i'm building custom apache module. how retrieve variable apache configuration inside module?
see variable "some_var_config_from_apache_or_htaacess" inside apache module:
/* source: http://people.apache.org/~humbedooh/mods/examples/mod_example_1.c */ /* include required headers httpd */ #include "httpd.h" #include "http_core.h" #include "http_protocol.h" #include "http_request.h" static void register_hooks(apr_pool_t *pool); static int example_handler(request_rec *r); /* define our module entity , assign function registering hooks */ module ap_module_declare_data example_module = { standard20_module_stuff, null, // per-directory configuration handler null, // merge handler per-directory configurations null, // per-server configuration handler null, // merge handler per-server configurations null, // directives may have httpd register_hooks // our hook registering function }; static void register_hooks(apr_pool_t *pool) { ap_hook_handler(example_handler, null, null, apr_hook_last); } /* handler function our module. * fun happens! */ static int example_handler(request_rec *r) { if (!r->handler || strcmp(r->handler, "example-handler")) return (declined); // first thing write simple "hello, world!" client. //ap_rputs("hello, world!", r); ap_rputs(some_var_config_from_apache_or_htaacess, r); return ok; }
Comments
Post a Comment