Package: adzapper
Version: 20050316-1
Severity: wishlist
Tags: patch

The attached patch contains documentation and a small patch to adzapper and
adzapper.wrapper to support proxying with Apache2. This has the advantage of
being IPv6 friendly. Maybe this could be added to adzapper itself as it's
only a small patch.
Probably works with Apache 1.3 as well but since I haven't tested that I
only changed the package dependency for Apache 2.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.11.6
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages adzapper depends on:
ii  perl                          5.8.4-8    Larry Wall's Practical Extraction 
ii  squid                         2.5.9-2    Internet Object Cache (WWW proxy c

-- no debconf information
--- orig/scripts/squid_redirect
+++ mod/scripts/squid_redirect
@@ -47,6 +47,9 @@
 # restart hook
 $SIG{HUP}=sub { exec($0,@ARGV) };
 
+# what to do if we don't change anything
+$::NoChangeValue=( defined $ENV{NO_CHANGE_VALUE} ? $ENV{NO_CHANGE_VALUE} : '' );
+
 # where to find the replacement URLs
 $::StubBase=( defined $ENV{ZAP_BASE} && length $ENV{ZAP_BASE}
 	    ? $ENV{ZAP_BASE}
@@ -283,6 +286,9 @@
   if ( ! length $nurl && defined $::PostMatch)
   { $nurl=&$::PostMatch(@words);
   }
+  if ( ! length $nurl )
+  { $nurl=$::NoChangeValue; 
+  }
 
   return pcnt($nurl);
 }
--- orig/debian/adzapper.wrapper
+++ mod/debian/adzapper.wrapper
@@ -25,7 +25,7 @@
 export ZAP_MODE ZAP_BASE ZAP_BASE_SSL ZAP_PREMATCH ZAP_POSTMATCH
 export STUBURL_AD STUBURL_ADSSL STUBURL_ADJS STUBURL_ADHTML STUBURL_ADMP3 \
 	STUBURL_ADPOPUP STUBURL_ADSWF STUBURL_COUNTER STUBURL_COUNTERJS \
-	STUBURL_WEBBUG STUBURL_WEBBUGJS STUBURL_PRINT
+	STUBURL_WEBBUG STUBURL_WEBBUGJS STUBURL_PRINT NO_CHANGE_VALUE
 
 # Here, having arranged the environment, we exec the real zapper:
 
--- orig/debian/README.Debian
+++ mod/debian/README.Debian
@@ -28,3 +28,24 @@
 overwrite the main adzapper program (/usr/bin/adzapper) !
 
  -- Ludovic Drolez <[EMAIL PROTECTED]>, Fri, 13 Dec 2002 17:37:42 +0100
+
+
+-----
+
+Alternatively, you can also use adzapper with Apache2. This has the advantage of
+being IPv6 compatible. To do this, make Apache2 load mod_proxy and mod_redirect
+and configure it as follows:
+
+        ProxyRequests On
+        RewriteEngine On
+        RewriteLock /var/lock/apache2/rewrite-adzapper
+        RewriteMap adzap prg:/usr/bin/adzapper.wrapper
+        <Proxy *>
+                Order deny,allow
+                Deny from all
+                Allow from localhost
+                RewriteRule ^proxy:(.*)$ proxy:${adzap:$1|$1} [L]
+        </Proxy>
+
+Also, edit the new "NO_CHANGE_VALUE" configuration variable and set it to NULL:
+NO_CHANGE_VALUE="NULL".
--- orig/debian/adzapper.conf
+++ mod/debian/adzapper.conf
@@ -55,3 +55,9 @@
 STUBURL_WEBBUG=$ZAP_BASE/webbug.gif
 STUBURL_WEBBUGJS=$ZAP_BASE/webbug.js
 
+# NO_CHANGE_VALUE
+#
+#   This defines what adzapper outputs when nothing should be redirected.
+#   For squid, this must be empty or undefined (default is empty).
+#   For Apache2's mod_rewrite RewriteMap directive, set this to NULL:
+#NO_CHANGE_VALUE="NULL"
--- orig/debian/control	2005-04-01 04:20:37.629166048 +0200
+++ mod/debian/control	2005-04-01 04:16:40.695185488 +0200
@@ -7,7 +7,7 @@
 
 Package: adzapper
 Architecture: all
-Depends: ${perl:Depends}, squid | polipo
+Depends: ${perl:Depends}, squid | polipo | apache2
 Suggests: apache | httpd, wget
 Enhances: squid
 Description: squid advertisement zapper

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to