Jérôme Augé wrote:
On Tue, Jan 14, 2003 at 12:32:29PM +1100, Stas Bekman wrote:

<Location /plop/>
   SetHandler perl-script
   PerlHeaderParserHandler Apache::Plop
</Location>

Well, this is not really what I want to do ...
I would like to catch all the "proxy request" and apply modifications to
the requested document before forwarding the answer back to the client.
That's why I used the "PerlTransHandler" which is "global" and not tied
to a particular directory.
Ah sorry, I've missed the Trans part and tried it as Response handler.

Now to your code:

1. You can't push_handlers when you are inside a response handler.
Use PerlHeaderParserHandler instead

2. $r->headers_in->do() expects a return value and will abort on 0; see the attached code

also it should be:
$request->header( $_[0] => $_[1] );
instead of:
$request->header( {$_[0]} => $_[1] );

have you looked at error_log? You'd have seen that error reported.

3. This is not good:
my $request = HTTP::Request->new( $r->method, $r->uri);
since you don't the whole url. Use this instead:
my $request = HTTP::Request->new( $r->method, $r->construct_url);
this requires 'use Apache::URI'

4. Finally I've used a special header: (which can be anything)
$request->header( GetReal => 1 );
to know that now I'm inside the real request.


Thanks for your remarks.

I installed modperl-1.99_08 and I keep getting SEGFAULT with my original
code ... I think I'll try to get it working first on mod_perl 1.x then
get back to modperl 2
I've applied a fix that hopefully cures this thing in cvs. Please try again with the latest cvs version.
http://perl.apache.org/download/source.html#2_0_Development_Source_Distribution
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com

Reply via email to