Re: [MP2]how to catch the response body of a subrequest? - modperl

This is a discussion on Re: [MP2]how to catch the response body of a subrequest? - modperl ; On Tue 01 Jul 2008, titetluc titetluc wrote: > I am facing a problem: I would like to call sub-requests, but the content > of these sub-requests should not 'pollute' the main request. my $content=''; my $subr=$r->lookup_uri( $tmpl ); $subr->add_output_filter( ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: [MP2]how to catch the response body of a subrequest?

  1. Re: [MP2]how to catch the response body of a subrequest?

    On Tue 01 Jul 2008, titetluc titetluc wrote:
    > I am facing a problem: I would like to call sub-requests, but the content
    > of these sub-requests should not 'pollute' the main request.


    my $content='';
    my $subr=$r->lookup_uri( $tmpl );
    $subr->add_output_filter( sub {
    my ($f, $bb) = @_;
    while (my $e = $bb->first) {
    $e->read(my $buf);
    $content.=$buf;
    $e->delete;
    }
    return Apache2::Const::OK;
    } );
    $subr->run;

    Torsten

    --
    Need professional mod_perl support?
    Just hire me: torsten.foertsch@gmx.net


  2. Re: [MP2]how to catch the response body of a subrequest?

    Less than half an hour to have an answer !!!!
    And the code is correctly running (my work now is to understand this cryptic
    code ;-))

    Thanks a lot


    2008/7/1 Torsten Foertsch :

    > On Tue 01 Jul 2008, titetluc titetluc wrote:
    > > I am facing a problem: I would like to call sub-requests, but the content
    > > of these sub-requests should not 'pollute' the main request.

    >
    > my $content='';
    > my $subr=$r->lookup_uri( $tmpl );
    > $subr->add_output_filter( sub {
    > my ($f, $bb) = @_;
    > while (my $e = $bb->first) {
    > $e->read(my $buf);
    > $content.=$buf;
    > $e->delete;
    > }
    > return Apache2::Const::OK;
    > } );
    > $subr->run;
    >
    > Torsten
    >
    > --
    > Need professional mod_perl support?
    > Just hire me: torsten.foertsch@gmx.net
    >



+ Reply to Thread