hi all...

currently, using DECLINE_CMD to override config directives has a limitation - you can't override ITERATE or ITERATE2 prototypes properly. what ends up happening is that DECLINE_CMD is returned for the first argument, but then Apache skips over your module for all subsequent arguments. the only way around this (that I was able to figure out, that is) is to use RAW_ARGS when overriding these prototypes and do the parsing yourself.

attached is a patch that fixes this, keeping ITERATE and ITERATE2 focused on the current module until the argument list is exhausted.

--Geoff
Index: server/config.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/config.c,v
retrieving revision 1.164
diff -u -r1.164 config.c
--- server/config.c     17 Feb 2003 07:04:50 -0000      1.164
+++ server/config.c     5 Aug 2003 19:26:59 -0000
@@ -697,7 +697,7 @@
                               void *mconfig, const char *args)
 {
     char *w, *w2, *w3;
-    const char *errmsg;
+    const char *errmsg = NULL;
 
     if ((parms->override & cmd->req_override) == 0)
         return apr_pstrcat(parms->pool, cmd->name, " not allowed here", NULL);
@@ -797,11 +797,14 @@
 
     case ITERATE:
         while (*(w = ap_getword_conf(parms->pool, &args)) != '\0') {
-            if ((errmsg = cmd->AP_TAKE1(parms, mconfig, w)))
+
+            errmsg = cmd->AP_TAKE1(parms, mconfig, w);
+
+            if (errmsg && strcmp(errmsg, DECLINE_CMD) != 0)
                 return errmsg;
         }
 
-        return NULL;
+        return errmsg;
 
     case ITERATE2:
         w = ap_getword_conf(parms->pool, &args);
@@ -812,11 +815,14 @@
                                cmd->errmsg ? ", " : NULL, cmd->errmsg, NULL);
 
         while (*(w2 = ap_getword_conf(parms->pool, &args)) != '\0') {
-            if ((errmsg = cmd->AP_TAKE2(parms, mconfig, w, w2)))
+
+            errmsg = cmd->AP_TAKE2(parms, mconfig, w, w2);
+
+            if (errmsg && strcmp(errmsg, DECLINE_CMD) != 0)
                 return errmsg;
         }
 
-        return NULL;
+        return errmsg;
 
     case FLAG:
         w = ap_getword_conf(parms->pool, &args);

Reply via email to