httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject RE: Config tree code finished.
Date Sat, 22 Apr 2000 19:47:21 GMT
On Sat, 22 Apr 2000, Eric Cholet wrote:
> > > when we parse the tree, at some point, mod_perl's <Perl> handler will
be
> > > called, and it will be passed the first directive in the perl
> > > section.
> > 
> > I thought that was raw Perl, not directives.
> 
> Correct:
> 
> <Perl>
>   ... arbitrary perl code...
> </Perl>

Dunno why Eric didn't cc: new-httpd, so I'll do it for him :-)


Given the arbitrary perl code, we _will_ need a mechanism (as I described)
to allow modules to hook the reading process. And yes, this also requires
that we load the modules before/during the read.

Blue-sky design:

*) Note this is specific to the Apache-style config reading. Therefore,
   the API will not be a "generic config" hook.

   [not a problem, as we may not end up with pluggable config syntaxes,
    but that is to be argued for another day; it is moot here]

*) During a module's init() handler, it can call this function:

     void ap_cfg_register_reader(const ap_cfg_reader_t *readers);

     typedef struct {
         const char *directive;
         const char * /* errmsg */  reader( /* some params */ );
     } ap_cfg_reader_t;

*) The config reader keeps a list of the above structures. For each
   directive found during the parse, it scans through the list of readers
   to see if any need to deal with that section. If so, then it calls the
   reader function (which will read the config file up to the
   close-section), then resumes the normal read loop. One of the
   parameters is an ap_directive_t (for the open-section directive) where 
   the reader can hang some data.

   [note: the list of directives/readers is small, so the scan-per-line
    is cheap]


That should be it. When the directive is normally executed later, then
(say) mod_perl yanks the Perl text from directive->reader_data and feeds
it to the Perl interpreter.

The AddModule and LoadModule would be readers, too. Maybe a different
name for this stuff, since these two directives do no reading? But it does
take place during the *reading* of the config, rather than the later
*processing/walking* of it.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/


Mime
View raw message