You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Raj Iyer <Ra...@openwave.com> on 2009/08/13 15:34:19 UTC

Defining mandatory parameters for Apache modules

 

Hello, 

 

The Apache web server on start up iterates through the list of
configuration directives and invokes the associated module handler for
each directive. 

 

For e.g. if module A has handlers for directives D1 and D2, then the
httpd process on start up will invoke the handlers within module A when
it encounters D1 and D2 in httpd.conf.

 

However, what is the best way to find out missing mandatory parameters
from within the module. For e.g. if a directive D3 is mandatory for the
module to work, then how can the module on initialization guarantee that
this configuration parameter is provided? 

 

I do not want to provide a default value for this mandatory
configuration directive and also, I do not want to check whether this
mandatory directive is defined or not while handling each request. 

 

Thanks in advance,

Best regards,

Raj Iyer

 


RE: Defining mandatory parameters for Apache modules

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
I guess the post_config hook should be your friend here.
 
Regards
 
Rüdiger


________________________________

	From: Raj Iyer [mailto:Rajalakshmi.Iyer@openwave.com] 
	Sent: Donnerstag, 13. August 2009 15:34
	To: dev@httpd.apache.org
	Subject: Defining mandatory parameters for Apache modules
	
	

	 

	Hello, 

	 

	The Apache web server on start up iterates through the list of configuration directives and invokes the associated module handler for each directive. 

	 

	For e.g. if module A has handlers for directives D1 and D2, then the httpd process on start up will invoke the handlers within module A when it encounters D1 and D2 in httpd.conf.

	 

	However, what is the best way to find out missing mandatory parameters from within the module. For e.g. if a directive D3 is mandatory for the module to work, then how can the module on initialization guarantee that this configuration parameter is provided? 

	 

	I do not want to provide a default value for this mandatory configuration directive and also, I do not want to check whether this mandatory directive is defined or not while handling each request. 

	 

	Thanks in advance,

	Best regards,

	Raj Iyer

	 


Re: Defining mandatory parameters for Apache modules

Posted by Graham Leggett <mi...@sharp.fm>.
Raj Iyer wrote:

> The Apache web server on start up iterates through the list of
> configuration directives and invokes the associated module handler for
> each directive.
> 
>  
> 
> For e.g. if module A has handlers for directives D1 and D2, then the
> httpd process on start up will invoke the handlers within module A when
> it encounters D1 and D2 in httpd.conf.
> 
>  
> 
> However, what is the best way to find out missing mandatory parameters
> from within the module. For e.g. if a directive D3 is mandatory for the
> module to work, then how can the module on initialization guarantee that
> this configuration parameter is provided?
> 
>  
> 
> I do not want to provide a default value for this mandatory
> configuration directive and also, I do not want to check whether this
> mandatory directive is defined or not while handling each request.

There are lots of examples of this in the httpd source code.

When a directive is parsed, and the directive was parsed successfully,
the parse will return NULL, and the config will continue onto the next
directive.

When a directive has a fatal error in it, and you don't want to
continue, return a string containing the error message you want to give
to the end user explaining why that particular line is wrong.

httpd will automatically stop config file parsing at that point, and
return the fatal error you just provided.

Regards,
Graham
--