Received: by taz.hyperreal.com (8.6.12/8.6.5) id LAA07044; Mon, 22 Jul 1996 11:43:53 -0700 Received: from acidik.organic.com by taz.hyperreal.com (8.6.12/8.6.5) with ESMTP id LAA07038; Mon, 22 Jul 1996 11:43:50 -0700 Received: from localhost (akosut@localhost) by acidik.organic.com (8.7.5/8.6.12) with SMTP id LAA18085 for ; Mon, 22 Jul 1996 11:43:27 -0700 (PDT) X-Authentication-Warning: acidik.organic.com: akosut owned process doing -bs Date: Mon, 22 Jul 1996 11:43:25 -0700 (PDT) From: Alexei Kosut To: Apache Subject: patch for Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-new-httpd@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com Here's a patch that implements something we discusses a month or so ago; the ability to conditionalize config files based on which modules were installed. It allows you to do, for example (to use a complex example): AuthDBMUserFile htpasswd.dbm AuthDigestFile htdigest AuthUserFile htpasswd Basically, it lets you specifiy a set of directives as being applicatble only if a certain module is (or is not) installed. And it's, as I've shown, nestable. I think it'd be useful enough to include in the distribution. Here's the patch: Index: http_core.c =================================================================== RCS file: /export/home/cvs/apache/src/http_core.c,v retrieving revision 1.18 diff -c -r1.18 http_core.c *** http_core.c 1996/06/12 18:14:31 1.18 --- http_core.c 1996/07/22 18:39:47 *************** *** 65,70 **** --- 65,72 ---- #include "util_md5.h" #include "scoreboard.h" + extern char *module_names[]; + /* Server core module... This module provides support for really basic * server operations, including options and commands which control the * operation of other modules. Consider this the bureaucracy module. *************** *** 575,580 **** --- 577,614 ---- return NULL; } + char *end_ifmod (cmd_parms *cmd, void *dummy) { + return NULL; + } + + char *start_ifmod (cmd_parms *cmd, void *dummy, char *arg) + { + char *endp = strrchr (arg, '>'); + char l[MAX_STRING_LEN]; + int i, not = (arg[0] == '!'); + int found = 0; + int nest = 1; + + if (endp) *endp = '\0'; + if (not) arg++; + + for (i=0; module_names[i]; i++) + if (!strcasecmp(arg, module_names[i])) + found++; + + if ((!not && found) || (not && !found)) + return NULL; + + while (nest && !(cfg_getline (l, MAX_STRING_LEN, cmd->infile))) { + if (!strncasecmp(l, "")) + nest--; + } + + return NULL; + } + /* httpd.conf commands... beginning with the business */ char *end_virthost_magic = " out of place"; *************** *** 834,839 **** --- 868,875 ---- { "KeepAliveTimeout", set_keep_alive_timeout, NULL, RSRC_CONF, TAKE1, "Keep-Alive timeout duration (sec)"}, { "KeepAlive", set_keep_alive, NULL, RSRC_CONF, TAKE1, "Maximum Keep-Alive requests per connection (0 to disable)" }, { "IdentityCheck", set_idcheck, NULL, RSRC_CONF|ACCESS_CONF, FLAG, NULL }, + { "", end_ifmod, NULL, OR_ALL, NO_ARGS, NULL }, { "ContentDigest", set_content_md5, NULL, RSRC_CONF|ACCESS_CONF|OR_AUTHCFG, FLAG, "whether or not to send a Content-MD5 header with each request" }, { "CacheNegotiatedDocs", }, { "StartServers", set_daemons_to_start, NULL, RSRC_CONF, TAKE1, NULL }, -- Alexei Kosut The Apache HTTP Server http://www.nueva.pvt.k12.ca.us/~akosut/ http://www.apache.org/