I had to add an allocator as an argument to
SPLIT_AND_PASS_PRETAG_BUCKETS to get mod_include
and mod_cgi to work (a patch against current CVS head
is attached)

--Brian


Index: modules/filters/mod_include.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.h,v
retrieving revision 1.29
diff -u -r1.29 mod_include.h
--- modules/filters/mod_include.h       23 Feb 2002 20:56:36 -0000      1.29
+++ modules/filters/mod_include.h       2 Mar 2002 23:06:41 -0000
@@ -189,7 +189,8 @@
 {                                                                 \
     /* XXX: it'd probably be nice to use a pool bucket here */    \
     t_buck = apr_bucket_heap_create(cntx->error_str,              \
-                             strlen(cntx->error_str), 1);         \
+                                    strlen(cntx->error_str),      \
+                                    1, h_ptr->list);              \
     APR_BUCKET_INSERT_BEFORE(h_ptr, t_buck);                      \
                                                                   \
     if (ins_head == NULL) {                                       \
@@ -201,14 +202,14 @@
  *   than APR_SUCCESS, then you should return this value up the
  *   call chain.
  */
-#define SPLIT_AND_PASS_PRETAG_BUCKETS(brgd, cntxt, next, rc)      \
+#define SPLIT_AND_PASS_PRETAG_BUCKETS(brgd, cntxt, next, rc, alloc) \
 if ((APR_BRIGADE_EMPTY(cntxt->ssi_tag_brigade)) &&                \
     (cntxt->head_start_bucket != NULL)) {                         \
     apr_bucket_brigade *tag_plus;                                 \
                                                                   \
     tag_plus = apr_brigade_split(brgd, cntxt->head_start_bucket); \
     if (cntxt->output_flush) {                                    \
-        APR_BRIGADE_INSERT_TAIL(brgd, apr_bucket_flush_create()); \
+        APR_BRIGADE_INSERT_TAIL(brgd, apr_bucket_flush_create(alloc)); \
     }                                                             \
     rc = ap_pass_brigade(next, brgd);                             \
     cntxt->bytes_parsed = 0;                                      \
Index: modules/filters/mod_include.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
retrieving revision 1.194
diff -u -r1.194 mod_include.c
--- modules/filters/mod_include.c       28 Feb 2002 23:24:08 -0000      1.194
+++ modules/filters/mod_include.c       2 Mar 2002 23:06:43 -0000
@@ -1180,7 +1180,8 @@
                 char *error_fmt = NULL;
                 apr_status_t rc = APR_SUCCESS;
 
-                SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next, rc);
+                SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next, rc,
+                                              r->connection->bucket_alloc);
                 if (rc != APR_SUCCESS) {
                     return rc;
                 }
@@ -1332,6 +1333,7 @@
             }
             if (!strcmp(tag, "var")) {
                 const char *val = get_include_var(r, ctx, tag_val);
+                conn_rec *c = r->connection;
                 if (val) {
                     switch(encode) {
                     case E_NONE:   
@@ -1347,11 +1349,12 @@
 
                     e_len = strlen(echo_text);
                     tmp_buck = apr_bucket_pool_create(echo_text, e_len,
-                                                      r->pool);
+                                                      r->pool, 
c->bucket_alloc);
                 }
                 else {
                     tmp_buck = apr_bucket_immortal_create("(none)", 
-                                                          sizeof("(none)")-1);
+                                                          sizeof("(none)")-1,
+                                                          c->bucket_alloc);
                 }
                 APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
                 if (*inserted_head == NULL) {
@@ -1589,7 +1592,8 @@
                         s_len = pos;
                     }
 
-                    tmp_buck = apr_bucket_heap_create(buff, s_len, 1);
+                    tmp_buck = apr_bucket_heap_create(buff, s_len, 1,
+                                                  r->connection->bucket_alloc);
                     APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
                     if (*inserted_head == NULL) {
                         *inserted_head = tmp_buck;
@@ -1637,7 +1641,8 @@
                     t_val = ap_ht_time(r->pool, finfo.mtime, ctx->time_str, 0);
                     t_len = strlen(t_val);
 
-                    tmp_buck = apr_bucket_pool_create(t_val, t_len, r->pool);
+                    tmp_buck = apr_bucket_pool_create(t_val, t_len, r->pool,
+                                                  r->connection->bucket_alloc);
                     APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
                     if (*inserted_head == NULL) {
                         *inserted_head = tmp_buck;
@@ -2481,7 +2486,8 @@
         cond_txt[31] = '1';                                                \
     }                                                                      \
     memcpy(&cond_txt[5], tag_text, sizeof(tag_text));                      \
-    t_buck = apr_bucket_heap_create(cond_txt, sizeof(cond_txt), 1);        \
+    t_buck = apr_bucket_heap_create(cond_txt, sizeof(cond_txt),            \
+                                    1, h_ptr->list);                       \
     APR_BUCKET_INSERT_BEFORE(h_ptr, t_buck);                               \
                                                                            \
     if (ins_head == NULL) {                                                \
@@ -2491,7 +2497,8 @@
 #define DUMP_PARSE_EXPR_DEBUG(t_buck, h_ptr, d_buf, ins_head)            \
 {                                                                        \
     if (d_buf[0] != '\0') {                                              \
-        t_buck = apr_bucket_heap_create(d_buf, strlen(d_buf), 1);        \
+        t_buck = apr_bucket_heap_create(d_buf, strlen(d_buf),            \
+                                        1, h_ptr->list);                 \
         APR_BUCKET_INSERT_BEFORE(h_ptr, t_buck);                         \
                                                                          \
         if (ins_head == NULL) {                                          \
@@ -2567,7 +2574,8 @@
                 if (1) {
                     apr_size_t d_len = 0;
                     d_len = sprintf(debug_buf, "**** if expr=\"%s\"\n", expr);
-                    tmp_buck = apr_bucket_heap_create(debug_buf, d_len, 1);
+                    tmp_buck = apr_bucket_heap_create(debug_buf, d_len, 1,
+                                                  r->connection->bucket_alloc);
                     APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
 
                     if (*inserted_head == NULL) {
@@ -2649,7 +2657,8 @@
                 if (1) {
                     apr_size_t d_len = 0;
                     d_len = sprintf(debug_buf, "**** elif expr=\"%s\"\n", 
expr);
-                    tmp_buck = apr_bucket_heap_create(debug_buf, d_len, 1);
+                    tmp_buck = apr_bucket_heap_create(debug_buf, d_len, 1,
+                                                  r->connection->bucket_alloc);
                     APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
 
                     if (*inserted_head == NULL) {
@@ -2829,7 +2838,8 @@
                 *next++ = '\n';
                 *next = 0;
                 tmp_buck = apr_bucket_pool_create(key_val, kv_length - 1,
-                                                  r->pool);
+                                                  r->pool,
+                                                  r->connection->bucket_alloc);
                 APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
                 if (*inserted_head == NULL) {
                     *inserted_head = tmp_buck;
@@ -2887,7 +2897,8 @@
                 apr_bucket *tmp_bkt;
 
                 tmp_bkt = apr_bucket_immortal_create(ctx->start_seq,
-                                                     cleanup_bytes);
+                                                  cleanup_bytes,
+                                                  r->connection->bucket_alloc);
                 APR_BRIGADE_INSERT_HEAD(*bb, tmp_bkt);
                 apr_brigade_cleanup(ctx->ssi_tag_brigade);
             }
@@ -2921,7 +2932,8 @@
                 /* Send the large chunk of pre-tag bytes...  */
                 tag_and_after = apr_brigade_split(*bb, tmp_dptr);
                 if (ctx->output_flush) {
-                    APR_BRIGADE_INSERT_TAIL(*bb, apr_bucket_flush_create());
+                    APR_BRIGADE_INSERT_TAIL(*bb,
+                         apr_bucket_flush_create(r->connection->bucket_alloc));
                 }
 
                 rv = ap_pass_brigade(f->next, *bb);
@@ -2969,7 +2981,8 @@
                 }
                 else if (ctx->output_now ||
                          (ctx->bytes_parsed >= BYTE_COUNT_THRESHOLD)) {
-                    SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next, rv);
+                    SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next, rv,
+                                                  r->connection->bucket_alloc);
                     if (rv != APR_SUCCESS) {
                         return rv;
                     }
@@ -3234,6 +3247,7 @@
 static apr_status_t includes_filter(ap_filter_t *f, apr_bucket_brigade *b)
 {
     request_rec *r = f->r;
+    conn_rec *c = r->connection;
     include_ctx_t *ctx = f->ctx;
     request_rec *parent;
     include_dir_config *conf = 
@@ -3254,7 +3268,7 @@
         if (ap_allow_options(r) & OPT_INCNOEXEC) {
             ctx->flags |= FLAG_NO_EXEC;
         }
-        ctx->ssi_tag_brigade = apr_brigade_create(f->c->pool);
+        ctx->ssi_tag_brigade = apr_brigade_create(c->pool, c->bucket_alloc);
         ctx->status = APR_SUCCESS;
 
         ctx->error_str = conf->default_error_msg;
Index: modules/generators/mod_cgi.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
retrieving revision 1.118
diff -u -r1.118 mod_cgi.c
--- modules/generators/mod_cgi.c        18 Feb 2002 06:15:38 -0000      1.118
+++ modules/generators/mod_cgi.c        2 Mar 2002 23:06:44 -0000
@@ -448,7 +448,7 @@
     else {
         procnew = apr_pcalloc(p, sizeof(*procnew));
         if (e_info->prog_type == RUN_AS_SSI) {
-            SPLIT_AND_PASS_PRETAG_BUCKETS(*(e_info->bb), e_info->ctx, 
e_info->next, rc);
+            SPLIT_AND_PASS_PRETAG_BUCKETS(*(e_info->bb), e_info->ctx, 
e_info->next, rc, r->connection->bucket_alloc);
             if (rc != APR_SUCCESS) {
                 return rc;
             }
@@ -720,10 +720,11 @@
        }
 
        if (!r->header_only) {
-            bb = apr_brigade_create(r->pool);
-           b = apr_bucket_pipe_create(script_in);
+           conn_rec *c = r->connection;
+            bb = apr_brigade_create(r->pool, c->bucket_alloc);
+           b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
            APR_BRIGADE_INSERT_TAIL(bb, b);
-            b = apr_bucket_eos_create();
+            b = apr_bucket_eos_create(c->bucket_alloc);
            APR_BRIGADE_INSERT_TAIL(bb, b);
            ap_pass_brigade(r->output_filters, bb);
        }
@@ -733,10 +734,11 @@
     }
 
     if (script_in && nph) {
-        bb = apr_brigade_create(r->pool);
-       b = apr_bucket_pipe_create(script_in);
+       conn_rec *c = r->connection;
+        bb = apr_brigade_create(r->pool, c->bucket_alloc);
+       b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
        APR_BRIGADE_INSERT_TAIL(bb, b);
-       b = apr_bucket_eos_create();
+       b = apr_bucket_eos_create(c->bucket_alloc);
        APR_BRIGADE_INSERT_TAIL(bb, b);
         ap_pass_brigade(r->output_filters, bb);
     }
@@ -790,6 +792,7 @@
     if (ap_is_HTTP_REDIRECT(rr_status)) {
         apr_size_t len_loc;
         const char *location = apr_table_get(rr->headers_out, "Location");
+        conn_rec *c = r->connection;
 
         location = ap_escape_html(rr->pool, location);
         len_loc = strlen(location);
@@ -799,15 +802,20 @@
          * and a single pool bucket */
 
         tmp_buck = apr_bucket_immortal_create("<A HREF=\"",
-                                              sizeof("<A HREF=\"") - 1);
+                                              sizeof("<A HREF=\"") - 1,
+                                              c->bucket_alloc);
         APR_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
-        tmp2_buck = apr_bucket_heap_create(location, len_loc, 1);
+        tmp2_buck = apr_bucket_heap_create(location, len_loc, 1,
+                                           c->bucket_alloc);
         APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck);
-        tmp2_buck = apr_bucket_immortal_create("\">", sizeof("\">") - 1);
+        tmp2_buck = apr_bucket_immortal_create("\">", sizeof("\">") - 1,
+                                               c->bucket_alloc);
         APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck);
-        tmp2_buck = apr_bucket_heap_create(location, len_loc, 1);
+        tmp2_buck = apr_bucket_heap_create(location, len_loc, 1,
+                                           c->bucket_alloc);
         APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck);
-        tmp2_buck = apr_bucket_immortal_create("</A>", sizeof("</A>") - 1);
+        tmp2_buck = apr_bucket_immortal_create("</A>", sizeof("</A>") - 1,
+                                               c->bucket_alloc);
         APR_BUCKET_INSERT_BEFORE(head_ptr, tmp2_buck);
 
         if (*inserted_head == NULL) {
@@ -855,8 +863,8 @@
         return HTTP_INTERNAL_SERVER_ERROR;
     }
 
-    bcgi = apr_brigade_create(r->pool);
-    b = apr_bucket_pipe_create(script_in);
+    bcgi = apr_brigade_create(r->pool, f->c->bucket_alloc);
+    b = apr_bucket_pipe_create(script_in, f->c->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(bcgi, b);
     ap_pass_brigade(f->next, bcgi);
 
@@ -908,7 +916,8 @@
                     apr_status_t retval = APR_SUCCESS;
 
                     cgi_pfn_ps(r, ctx, tag_val, parsed_string, 
sizeof(parsed_string), 0);
-                    SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next, retval);
+                    SPLIT_AND_PASS_PRETAG_BUCKETS(*bb, ctx, f->next, retval,
+                                                  r->connection->bucket_alloc);
                     if (retval != APR_SUCCESS) {
                         return retval;
                     }

Reply via email to