[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using input filters and bucket brigades to pass data to subrequests


in a given situation we get xml data POSTed to our server, much alike RPC
calls (actually they're a number of http (webdav) requests).

A (mod_perl) Fixuphandler traps these requests, parses the xml, and (should)
from there on issue all requests to our server.

It seemed quite logical to (dynamically) create a subrequest for each given
request. We would dynamically add a input filter to each subrequest, create
a bucket brigade there, and fill the bb with the desired data; set the
correct request headers, and run the sub-request.
A output filter on the subrequest fetches the response. The handler then
assembles an xml answer and sends it back to the client.

(Part of) the code in the input filter that should do the trick is:

$bb = APR::Brigade->new($c->pool, $c->bucket_alloc);
my $ba = $bb->bucket_alloc();
my $nb = APR::Bucket->new($ba, $data);
$bb->insert_tail($nb);
my $b = APR::Bucket::eos_create($ba);
$bb->insert_tail($b);
$r->headers_in->{'Content-Length'} = length ($data);
$f->fflush($bb);
[download]
For some reason, the sub-request never picks up the bucket brigade. Is there
something I've overseen, or am I just trying to do the plain impossible ?

FYI: the given solution works perfectly with webdav requests that don't need
a body (like MOVE, DELETE, ...). We are using the $r->pnotes for passing the
data from the handler to the input filter, and from the output filter back
to the handler.

rgrds,

walinsky



Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.