Apache module - How to check existence of directive in httpd.conf -
i trying write sample apache module read config file file path specified in httpd.conf that:
<location ~ /(?!.*\.(png|jpeg|jpg|gif|bmp|tif)$)> setinputfilter sample_input_filter setoutputfilter sample_output_filter configfilepath "/etc/httpd/conf.d/sample/sample.config" </location>
at command record structure, do:
static const command_rec config_check_cmds[] = { ap_init_take1( "configfilepath", read_config_file, null, or_all, "sample config"), { null } };
i set:
module ap_module_declare_data sample_module = { standard20_module_stuff, create_dir_config, /* create per-dir config structures */ null, /* merge per-dir config structures */ null, /* create per-server config structures */ null, /* merge per-server config structures */ config_check_cmds, /* table of config file commands */ sample_register_hooks /* register hooks */ };
i read config file path successfully. , want check if "configfilepath" not specified in httpd.conf, show error @ console when use "service httpd restart"
how that?
you'd register ap_hook_post_config
hook , verification of required settings there. aware that hook called twice documented in answer here: init modules in apache2
see example post config hook implementation here: http://svn.apache.org/repos/asf/httpd/httpd/tags/2.3.0/modules/examples/mod_example_hooks.c
Comments
Post a Comment