I am trying to capture the content of a sub request that I create in my module (mod_transform) to a bucket brigade. I want to do this so libxml2 can use it as an input buffer. As an example, this would allow mod_transform to XInclude content from another Handler (PHP, mod_perl, or my own module...).

I looked through the mail archives & google, and couldn't find anyone else that has done this.

Some people tried doing it with mod_perl more than a year ago, but ended up fetching it over HTTP via LWP, not capturing the output of a sub request.

I cannot seem to get my output filter ran by Apache. I tried tracing through it with GDB, but it is being quite stubborn on my sparc tonight.

My output filter looks like:

static apr_status_t
apachefs_filter(ap_filter_t * f, apr_bucket_brigade * bb)
{
    apr_status_t rv;
    apr_bucket_brigade *data = f->ctx;
    rv = ap_save_brigade(f, &data, &bb, f->r->pool);
    f->ctx = data;
    return rv;
}

However, my capturing output filter doesn't seem to ever be called.

So, I think something about my manually adding my output filter
to the subrequest is wrong:

ap_filter_t cf;
....
cf.frec = ap_get_output_filter_handle(APACHEFS_FILTER_NAME);
cf.next = NULL;
cf.ctx = input_ctx->bb;
cf.r = f->r;
cf.c = f->c;
....
rr = ap_sub_req_lookup_uri(URI, f->r, &cf);
....
rr_status = ap_run_sub_req(rr);

If I pass NULL as the 3rd arg to ap_sub_req_lookup_uri(...) it will use my current request's filters. I don't want the content sent to the client, I just want it buffered to a bucket brigade.

Is there a better way to do this?

-Paul Querna

Reply via email to