httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sander Temme <scte...@apache.org>
Subject Re: [RFC] Error directive to generate custom error messages from httpd.conf
Date Mon, 08 Nov 2010 01:29:39 GMT

On Nov 7, 2010, at 4:35 PM, Jeff Trawick wrote:

> This is handy when a module depends on another module at load time or
> run time, and the config for that module needs to display a message
> more helpful than the normal symbol-not-found or
> optional-function-not-found or invalid-filter message.

+1.  We also discussed last week the possibility that a module provides functionality not
captured in the config file, and server startup should fail if that module is not loaded.

> With the Error directive:
> 
> <IfModule !mod_include.c>
> Error mod_foo requires mod_include!  Use the LoadModule directive to
> load mod_include.
> </IfModule>
> 
> 
> $ ./httpd -t
> Syntax error on line 486 of /home/trawick/inst/23/conf/httpd.conf:
> mod_foo requires mod_include!  Use the LoadModule directive to load mod_include.
> 
> Index: server/core.c
> ===================================================================
> --- server/core.c	(revision 1032266)
> +++ server/core.c	(working copy)
> @@ -1092,6 +1092,11 @@
>     return NULL;
> }
> 
> +static const char *set_error(cmd_parms *cmd, void *dummy, const char *arg)
> +{
> +    return arg;
> +}
> +
> #ifdef GPROF
> static const char *set_gprof_dir(cmd_parms *cmd, void *dummy, const char *arg)
> {
> @@ -3432,6 +3437,8 @@
>               "Define the existence of a variable.  Same as passing
> -D to the command line."),
> AP_INIT_TAKE1("UnDefine", unset_define, NULL, RSRC_CONF,
>               "Undefine the existence of a variable. Undo a Define."),
> +AP_INIT_RAW_ARGS("Error", set_error, NULL, OR_ALL,
> +                 "Generate error message from within configuration"),
> AP_INIT_RAW_ARGS("<If", ifsection, NULL, OR_ALL,
>   "Container for directives to be conditionally applied"),

+1

Pardon my rust, but what actually makes the process error out?  Returning !nil? 

S.

-- 
Sander Temme
sctemme@apache.org
PGP FP: FC5A 6FC6 2E25 2DFD 8007  EE23 9BB8 63B0 F51B B88A

View my availability: http://tungle.me/sctemme




Mime
View raw message