Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Hey Guys

I wrote a simple Filter which calls a subrequest - and started by
doing this very simply along the SSI style lines...

Please note - that although I could do this on the fly rather than
buffer, the end result for my code requires capture of the content,
so just imagine that bit is correct :-)

sub filter {
... buffer content into $context->{buffer} ...

if ($f->seen_eos) {

my $buffer = $context->{buffer};

while ((my $i = index($buffer, "EXPAND")) >= 0) {
$f->print(substr($buffer, 0, $i));
$buffer = substr($buffer, $i + 6);

my $subr = $f->r->lookup_uri("/sub.html");

The above code always segfaults. Now the first thing that came to
mind was that a $subr->run() would output by printing to stderr which
of course would not work in the filter. Therefore I changed the code,
using the Apache2::TrapSubRequest module to...

my $subr = $f->r->lookup_uri('/sub.html');
my $data;
$subr->run_trapped(\$data, sub { return Apache2::Const::OK });

Same problem.

So I got thinking about how it works and thought maybe they just
don't work within a Filter.

When I try the same code within a normal handler it works fine...

BUT (and finally my question) mod_include runs as a filter and does
Sub Requests to get the content, so why don't they work in Perl ?

Am I missing something fundamental in Apache ? In mod_perl (e.g.
Apache::SubRequest is specifically for a provider)? or is there a
likely bug somewhere?

BTW. I tested this in both apache 2.0 and 2.2 using mod_perl2.0.2. I
have not added any traces or debug information yet in case there is
already an obvious answer.


* - * http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
VP in charge of Pancakes

Dismaimer: If you receive this email in error - please eat it
immediately to prevent it from falling into the wrong hands.

Please do not send me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Microsoft is not the answer. It's the question. And the answer is no.

content-type: application/pgp-signature; x-mac-type=70674453;
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

Version: GnuPG v1.2.4 (Darwin)

iD8DBQFElf8IDCFCcmAm26YRApgTAJ9TvsHknVyaiXQhM+FerD Sq3W/vsACfWskq