You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Douglas Younger <dy...@corp.earthlink.net> on 2002/05/14 20:46:57 UTC
mod_perl 2.0 - writing a proxy handler
Hello,
Has anyone written a proxy handler in 2.0 similar to example 7-12 of the
O`Reilly book? I've tried converting it without much luck. I don't need the
add-blocker stuff, just a generic proxy handle that I can add some
additional lines to parse the output.
I've had some problems with Apache's default mod_proxy so I'd like to just
do everything with mod_perl. (problems include chunked data and empty pages)
Thanks!
-Doug
Re: mod_perl 2.0 - writing a proxy handler
Posted by Doug MacEachern <do...@covalent.net>.
On Tue, 14 May 2002, Douglas Younger wrote:
> Hello,
> Has anyone written a proxy handler in 2.0 similar to example 7-12 of the
> O`Reilly book? I've tried converting it without much luck. I don't need the
> add-blocker stuff, just a generic proxy handle that I can add some
> additional lines to parse the output.
you'll need modperl from cvs (or wait for _02) for $r->proxyreq to
auto-detect a proxy request. with modperl-cvs and Apache::compat loaded,
i have run Apache::AdBlocker without any modperl api changes. however, i
did need the patch below because my GD install does have gif support.
--- lib/Apache/AdBlocker.pm~ Fri Mar 3 21:08:35 2000
+++ lib/Apache/AdBlocker.pm Mon May 20 17:31:22 2002
@@ -61,7 +61,7 @@
my $content = \$response->content;
if($r->content_type =~ /^image/ and $r->uri =~ /\b($Ad)\b/i) {
block_ad($content);
- $r->content_type("image/gif");
+ $r->content_type("image/png");
}
$r->content_type('text/html') unless $$content;
@@ -85,7 +85,7 @@
$im->string(GD::gdLargeFont(),5,5,"Blocked Ad",$red);
$im->rectangle(0,0,$x-1,$y-1,$black);
- $$data = $im->gif;
+ $$data = $im->png;
}
1;