$NetBSD: patch-aa,v 1.2 2007/06/30 15:05:08 joerg Exp $

Allow the directives to be set in the global configuration file, too.
Fix APR 1.2 build.

--- src/apache2/mod_suphp.c.orig	2005-02-27 17:56:37.000000000 +0000
+++ src/apache2/mod_suphp.c
@@ -313,8 +313,8 @@ static const command_rec suphp_cmds[] =
     AP_INIT_TAKE2("suPHP_UserGroup", suphp_handle_cmd_user_group, NULL, RSRC_CONF | ACCESS_CONF,
                   "User and group scripts shall be run as"),
 #endif
-    AP_INIT_ITERATE("suPHP_AddHandler", suphp_handle_cmd_add_handler, NULL, ACCESS_CONF, "Tells mod_suphp to handle these MIME-types"),
-    AP_INIT_ITERATE("suPHP_RemoveHandler", suphp_handle_cmd_remove_handler, NULL, ACCESS_CONF, "Tells mod_suphp not to handle these MIME-types"),
+    AP_INIT_ITERATE("suPHP_AddHandler", suphp_handle_cmd_add_handler, NULL, RSRC_CONF | ACCESS_CONF, "Tells mod_suphp to handle these MIME-types"),
+    AP_INIT_ITERATE("suPHP_RemoveHandler", suphp_handle_cmd_remove_handler, NULL, RSRC_CONF | ACCESS_CONF, "Tells mod_suphp not to handle these MIME-types"),
     {NULL}
 };
 
@@ -558,7 +558,9 @@ static int suphp_handler(request_rec *r)
             return rv;
         }
         
-        APR_BRIGADE_FOREACH(bucket, bb)
+	for (bucket = APR_BRIGADE_FIRST(bb);
+	     bucket != APR_BRIGADE_SENTINEL(bb);
+	     bucket = APR_BUCKET_NEXT(bucket))
         {
             const char *data;
             apr_size_t len;
@@ -629,7 +631,9 @@ static int suphp_handler(request_rec *r)
             
             const char *buf;
             apr_size_t blen;
-            APR_BRIGADE_FOREACH(b, bb)
+
+	    for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb);
+		 b = APR_BUCKET_NEXT(b))
             {
                 if (APR_BUCKET_IS_EOS(b))
                     break;
@@ -650,7 +654,9 @@ static int suphp_handler(request_rec *r)
             /* empty brigade (script output) */
             const char *buf;
             apr_size_t blen;
-            APR_BRIGADE_FOREACH(b, bb)
+
+            for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb);
+		 b = APR_BUCKET_NEXT(b))
             {
                 if (APR_BUCKET_IS_EOS(b))
                     break;
