You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Doug MacEachern <do...@telebusiness.co.nz> on 1998/01/06 10:58:11 UTC

[PATCH] add -C and -c switches

Here's the patch to add -C (command for pre read config) and -c (post
read config).
It works fine for everything I've tried, except what I was trying to do
with -MApache::httpd_conf :-(  The s->lookup_defaults pointer seems to
smashed inside handle_command() before it's passed to
invoke_command().   I don't know yet if it's a problem with mod_perl or
apache, calling perl_cmd_module() directly works fine (instead of
handle_command).   I'll dig into it more sometime this week, any
thoughts in the meantime would be great.

-Doug

Re: [PATCH] add -C and -c switches

Posted by Dean Gaudet <dg...@arctic.org>.

On Wed, 7 Jan 1998, Doug MacEachern wrote:

> I agree, but this comment in http_conf_globals.h threw me off:
> /* Trying to allocate these in the config pool gets us into some *nasty*
>  * chicken-and-egg problems in http_main.c --- where do you stick them
>  * when pconf gets cleared?  Better to just allocate a little space
>  * statically...
>  */
> 
> If I want to use pstrcat or use some other pool function in this area of
> http_main, which, if any, pool* can I use?  Other recommendations?

Yeah it's a pain... you could actually create a pool with
make_sub_pool(NULL) which wouldn't be destroyed across resets.  Then you
could use the array routines to build a command list.  In fact such a pool
would be useful for more than just this...

Dean


Re: [PATCH] add -C and -c switches

Posted by Doug MacEachern <do...@telebusiness.co.nz>.
Ben Laurie wrote:

> Doug MacEachern wrote:
> >
> > Here's the patch to add -C (command for pre read config) and -c (post
> > read config).
> > It works fine for everything I've tried, except what I was trying to do
> > with -MApache::httpd_conf :-(  The s->lookup_defaults pointer seems to
> > smashed inside handle_command() before it's passed to
> > invoke_command().   I don't know yet if it's a problem with mod_perl or
> > apache, calling perl_cmd_module() directly works fine (instead of
> > handle_command).   I'll dig into it more sometime this week, any
> > thoughts in the meantime would be great.
>
> For this to be properly useful, you need to allow for arbitrary numbers
> of commands, not just a single one.

I agree, but this comment in http_conf_globals.h threw me off:
/* Trying to allocate these in the config pool gets us into some *nasty*
 * chicken-and-egg problems in http_main.c --- where do you stick them
 * when pconf gets cleared?  Better to just allocate a little space
 * statically...
 */

If I want to use pstrcat or use some other pool function in this area of
http_main, which, if any, pool* can I use?  Other recommendations?

-Doug


Re: [PATCH] add -C and -c switches

Posted by Ben Laurie <be...@algroup.co.uk>.
Doug MacEachern wrote:
> 
> Here's the patch to add -C (command for pre read config) and -c (post
> read config).
> It works fine for everything I've tried, except what I was trying to do
> with -MApache::httpd_conf :-(  The s->lookup_defaults pointer seems to
> smashed inside handle_command() before it's passed to
> invoke_command().   I don't know yet if it's a problem with mod_perl or
> apache, calling perl_cmd_module() directly works fine (instead of
> handle_command).   I'll dig into it more sometime this week, any
> thoughts in the meantime would be great.

For this to be properly useful, you need to allow for arbitrary numbers
of commands, not just a single one.

Sorry, no idea what your problem is at the mo. :-)

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: [PATCH] add -C and -c switches

Posted by Mark J Cox <ma...@awe.com>.
On Tue, 6 Jan 1998, Doug MacEachern wrote:
>+	case 'C':
>+	    ap_cpystrn(server_pre_read_config, optarg, 
>+		       sizeof(server_post_read_config));
>+	    break;

That should be sizeof(server_pre_read_config)) just in case :)

Mark