I am creating my own Apache module. How to get a variable from Apache configuration inside a module?
See the variable "some_var_config_from_apache_or_htaacess" inside the Apache module:
#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);
module AP_MODULE_DECLARE_DATA example_module =
{
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
register_hooks
};
static void register_hooks(apr_pool_t *pool)
{
ap_hook_handler(example_handler, NULL, NULL, APR_HOOK_LAST);
}
static int example_handler(request_rec *r)
{
if (!r->handler || strcmp(r->handler, "example-handler")) return (DECLINED);
ap_rputs(some_var_config_from_apache_or_htaacess, r);
return OK;
}
source
share