httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wortham" <djwort...@gmail.com>
Subject Re: ap_get_module_config() questions...
Date Thu, 11 Jan 2007 20:17:37 GMT
Drew,
  I can only respond to two of your questions (intelligently):

First, how do I return valuable information if there's a config error?
> For example, if my config has the directive "MyFile conf/foo.txt" and
> the file doesn't exist, how can I report this when I run httpd -t?


If the error can be detected during a directive-handler, simply returning a
non-NULL string will output the error string to STDERR and halt the startup
process.
If the error detection happens later during the server process, you will
have to take different actions, but you should use a function like
"ap_log_rerror(...)" to output the error description to the server's error
log (what you do beyond that is up to you... the module programmer).


Second, the documentation (er, at least http_config.h) suggest using
> r->per_dir_config or s->module_config for the conf vector (first arg).
> I can only get things to work if I pass cmd->server->module_config.  Is
> this the same as s->module_config?  Is this a coding blunder?


To explicitly answer your question, they are the same thing, only with an
intermediate variable set to the "server* s".
Look at this page (at the very bottom):
http://modules.apache.org/doc/API.html#servconf
The example function creates its own "server* s" as a pointer to the server
(pointer) in the cmd_parms struct.  I believe this step was skipped over by
your documentation page.

Hope this helps,
Dave

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