You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by John David Duncan <jd...@mysql.com> on 2007/08/29 07:52:09 UTC

EXEC_ON_READ

Hi,

I'm working on a SQL parser for a module, mod_ndb.

The parser works fine in Apache 1.3 -- in httpd.conf I have stuff  
like this:

<Location /ndb/table1>
   DefaultType text/plain
   SELECT a,b,c from table1
    WHERE blah blah blah;
</LOCATION>

"SELECT" is treated like a container config, with the ";" as the end- 
container.  I use ap_cfg_getc() to read the whole query into a buffer  
(up to the ";") and then pass it to a real recursive-descent parser.   
The SQL query applies to a particular location, so it belongs in  
ACCESS_CONF.

But in apache 2, I can't win.  If I don't set EXEC_ON_READ,  
ap_cfg_getc() segfaults because cmd->config_file is null. If I *do*  
set the cmd->req_override = ACCESS_CONF | EXEC_ON_READ, then  
ap_cfg_getc() works, but things segfault later because the directory  
config context, which I need, contains some garbage.

I'll take any solution I can get to let me process the buffer.  But  
it seems that EXEC_ON_READ has an intended purpose -- for directives  
like "IfModule" and "ErrorLog" that really need to be processed on  
the first config pass.  And clearly, I do not need this, so by this  
definition I should not set EXEC_ON_READ.  But then EXEC_ON_READ also  
has taken on an "idiomatic" purpose simply because you *must* set it  
in order to get access to ap_cfg_getline(), ap_cfg_getc(), etc.  And  
that seems like a bug.

JD