You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Stein <gs...@lyra.org> on 2000/07/04 01:50:36 UTC

updated mod_gargle? not really... (was: [PATCH] revised, final filtering patch. (ready for review))

On Mon, Jul 03, 2000 at 08:48:24AM -0400, Jeff Trawick wrote:
> Greg:
> 
> Do you have a revised mod_gargle.c to go with this latest patch?

Only for the header/footer part. The other two depended on the char*
handler. With the removal of that functionality, I must now go and duplicate
the whole char* functionality inside the functions. (well, develop some
utility functions)

Until I get those utilities done, which allows my handlers to look at the
bytes of the content (given arbitrary buckets), then the two old examples
are hopelessly broken/impossible.

Here is the header/footer function now:

static void gargle_bucket(ap_filter_t *filter, ap_bucket_t *bucket)
{
    gargle_ctx *ctx = filter->ctx;
    
    if (bucket->type == AP_BUCKET_EOS) {
        ap_fc_puts(filter, "Here is the gargle footer!");
    }
    else if (ctx->position == 0) {
        ap_fc_puts(filter, "Here is the gargle header!");
        ctx->position = 1;
    }

    ap_fc_putbucket(filter, bucket);
}

Note that it would also be possible to create new buckets for the strings
and hook them into a chain for delivery down the pipe. I chose to use the
simpler route of ac_fc_puts().

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/