From dev-return-70030-apmail-httpd-dev-archive=httpd.apache.org@httpd.apache.org Mon Nov 08 01:29:43 2010 Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 99215 invoked from network); 8 Nov 2010 01:29:43 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Nov 2010 01:29:43 -0000 Received: (qmail 81832 invoked by uid 500); 8 Nov 2010 01:30:13 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 81756 invoked by uid 500); 8 Nov 2010 01:30:13 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 81748 invoked by uid 99); 8 Nov 2010 01:30:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Nov 2010 01:30:13 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [207.106.84.159] (HELO atlas.jtan.com) (207.106.84.159) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Nov 2010 01:30:07 +0000 X-JTAN-Outgoing-From: sctemme@apache.org X-JTAN-Outgoing-To: X-JTAN-Received: c-98-248-189-213.hsd1.ca.comcast.net [98.248.189.213] X-JTAN-Recipient: X-JTAN-AntiSPAM: not spam, Outgoing not scanned X-JTAN-AntiVirus: Found to be clean, Outgoing not scanned Received: from legadema.sandla.org (c-98-248-189-213.hsd1.ca.comcast.net [98.248.189.213]) (authenticated bits=0) by atlas.jtan.com (8.12.8p1/8.12.8) with ESMTP id oA81TjWO023476 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Mon, 8 Nov 2010 01:29:46 GMT Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) Subject: Re: [RFC] Error directive to generate custom error messages from httpd.conf From: Sander Temme In-Reply-To: Date: Sun, 7 Nov 2010 17:29:39 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <89A5F10E-44F9-4321-AF3F-63906B81B2AB@apache.org> References: To: dev@httpd.apache.org X-Mailer: Apple Mail (2.1081) 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: >=20 > > Error mod_foo requires mod_include! Use the LoadModule directive to > load mod_include. > >=20 >=20 > $ ./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. >=20 > Index: server/core.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- server/core.c (revision 1032266) > +++ server/core.c (working copy) > @@ -1092,6 +1092,11 @@ > return NULL; > } >=20 > +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(" "Container for directives to be conditionally applied"), +1 Pardon my rust, but what actually makes the process error out? = Returning !nil?=20 S. --=20 Sander Temme sctemme@apache.org PGP FP: FC5A 6FC6 2E25 2DFD 8007 EE23 9BB8 63B0 F51B B88A View my availability: http://tungle.me/sctemme