httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ray Morris <supp...@bettercgi.com>
Subject Re: Defining mandatory parameters for Apache modules
Date Thu, 13 Aug 2009 14:12:34 GMT
   This may be a level problem.  Are you thinking of throwing 
an error if it's unset, or simply disabling the module for that 
VirtualHost, directory, etc.?  Pretty much any module must do 
a check with each request to see if it should handle the request - 
for example the module may be wanted in one virtual host and 
ot another, so you typically have an "enable" directive like 
RewriteEngine On.  At configuration time, if you don't have 
your required directive you don't enable your module.  That's 
how most standard modules work, it seems.  For example if you
don't use AuthUserFile you simply don't authenticate against 
any file.  You say you don't want to check with each request, 
but you already have to check whether or not your enabled with
each request, for most any module.  Of course, if this required
directive is the only required directive, you can use it as 
your "enabling" directive, without needing any "MeEnabled"
directive.

   However, I have a feeling, based on little but intuition, 
that you can solve your actual problem by looking it from one 
level higher or lower.  Not knowing what your module is supposed
to do or what the directive is, I can't give any example of 
looking at the problem from a higher level.  At a lower level, 
ask "how can I make a missing or default value work?".  You've
said you don't want to do that, but think about it again.  At 
the higher level, back up to whatever the module is supposed 
to accomplish - the business goal.  How can that goal be 
accomplished in a different manner that doesn' need the 
directive?  (IE, instead of asking "how can I buy a car to 
get to work when I haven't gotten paid yet?", ask "how can I 
get to work without having a car?").
--
Ray Morris
support@bettercgi.com

Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/

Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/

Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php


On 08/13/2009 08:34:42 AM, Raj Iyer wrote:
>  
> 
> 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
> 
>  
> 
> 



Mime
View raw message