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;