View | Details | Raw Unified | Return to bug 183768
Collapse All | Expand All

(-)adzap/Makefile (-13 / +18 lines)
Lines 3-38 Link Here
3
3
4
PORTNAME=	adzap
4
PORTNAME=	adzap
5
PORTVERSION=	20110915
5
PORTVERSION=	20110915
6
PORTREVISION=	1
6
CATEGORIES=	www perl5
7
CATEGORIES=	www perl5
7
MASTER_SITES=	http://adzapper.sourceforge.net/
8
MASTER_SITES=	http://adzapper.sourceforge.net/
8
9
9
MAINTAINER=	ports@FreeBSD.org
10
MAINTAINER=	horia@racoviceanu.com
10
COMMENT=	Filter out animated ad banners from web pages
11
COMMENT=	Filter out animated ad banners from web pages
11
12
13
LICENSE=	BSD
14
12
USES=		perl5
15
USES=		perl5
13
NO_BUILD=	yes
16
NO_BUILD=	yes
14
USE_PERL5=	run
17
USE_PERL5=	run
15
18
19
OPTIONS_DEFINE=	DOCS EXAMPLES
20
21
PORTDOCS=	index.html update-instructions.txt TODO my-bsd-license.html
16
SUB_FILES=	adzap.conf pkg-message
22
SUB_FILES=	adzap.conf pkg-message
17
PKGMESSAGE=	${WRKDIR}/pkg-message
18
23
19
NO_STAGE=	yes
20
do-configure:
24
do-configure:
21
.for FILE in squid_redirect-nodata wrapzap zapchain
25
.for FILE in squid_redirect-nodata wrapzap zapchain
22
	${REINPLACE_CMD} -e "s:/usr/bin/perl:${PERL5}:g" \
26
	@${REINPLACE_CMD} -e "s:/usr/bin/perl:${PERL5}:g" \
23
			-e "s:%%PREFIX%%:${PREFIX}:g" ${WRKSRC}/scripts/${FILE}
27
			-e "s:%%PREFIX%%:${PREFIX}:g" ${WRKSRC}/scripts/${FILE}
24
.endfor
28
.endfor
25
29
26
do-install:
30
do-install:
27
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/squid_redirect-nodata ${PREFIX}/libexec/
31
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/squid_redirect-nodata ${STAGEDIR}${PREFIX}/libexec/squid_redirect
28
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/wrapzap ${PREFIX}/libexec/adzap
32
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/wrapzap ${STAGEDIR}${PREFIX}/libexec/adzap
29
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/zapchain ${PREFIX}/libexec/
33
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/zapchain ${STAGEDIR}${PREFIX}/libexec/
30
	${INSTALL} -d ${EXAMPLESDIR}
34
31
	${CP} -R ${WRKSRC}/zaps ${EXAMPLESDIR}
35
	${INSTALL} -d ${STAGEDIR}${EXAMPLESDIR}
32
	${CP} -R ${WRKSRC}/rc ${EXAMPLESDIR}
36
	${CP} -R ${WRKSRC}/zaps ${STAGEDIR}${EXAMPLESDIR}
33
	${INSTALL_DATA} ${WRKDIR}/adzap.conf ${EXAMPLESDIR}
37
	${CP} -R ${WRKSRC}/rc ${STAGEDIR}${EXAMPLESDIR}
38
	${INSTALL_DATA} ${WRKDIR}/adzap.conf ${STAGEDIR}${EXAMPLESDIR}
34
39
35
post-install:
40
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
36
	@${CAT} ${PKGMESSAGE}
41
	${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
37
42
38
.include <bsd.port.mk>
43
.include <bsd.port.mk>
(-)adzap/files/patch-scripts_squid_redirect-nodata (+107 lines)
Line 0 Link Here
1
--- scripts/squid_redirect-nodata.orig
2
+++ scripts/squid_redirect-nodata
3
@@ -31,7 +31,7 @@ use bytes;
4
 
5
 use POSIX ":sys_wait_h";
6
 use Socket;
7
-require 'flush.pl';
8
+use IO::Handle;
9
 
10
 $::IOSIZE=1024;
11
 
12
@@ -232,7 +232,7 @@ while (defined ($_=<STDIN>))
13
 {
14
   if (defined $::LogFile)
15
   { print LOGFILE $_;
16
-    flush(LOGFILE);
17
+    LOGFILE->flush();
18
   }
19
   chomp;
20
   
21
@@ -259,7 +259,7 @@ while (defined ($_=<STDIN>))
22
     }
23
   }
24
 
25
-  flush(STDOUT);
26
+  STDOUT->flush();
27
 }
28
 
29
 exit 0;
30
@@ -789,14 +788,16 @@ sub proxy_forkchild($$$)
31
       }
32
 
33
       # dispatch request and headers
34
-      printflush(GCHILD_WRITE,"$method $uri $v1 $v2\n")
35
+      print GCHILD_WRITE "$method $uri $v1 $v2\n"
36
 	|| die "tell grandchild the request: $!";
37
+      GCHILD_WRITE->flush();
38
 
39
       print PROXY "$method $uri HTTP/$v1.$v2\r\n";
40
       for my $H (@hdrs)
41
       { print PROXY $H->[0], ":", $H->[1], "\r\n";
42
       }
43
-      printflush(PROXY,"\r\n");
44
+      print PROXY "\r\n";
45
+      PROXY->flush();
46
       ##warn "[$$]: sent rq to proxy\n";
47
 
48
       proxy_copybody(CONN,PROXY,$method,$persist,\@hdrs)
49
@@ -965,8 +966,9 @@ sub proxy_grandchild($)
50
     }
51
 
52
     warn "[$child:$$]: pass response to parent\n";
53
-    printflush(TOCHILD,($persist ? PERSIST : CLOSE)." $code $info")
54
+    print TOCHILD ($persist ? PERSIST : CLOSE)." $code $info"
55
 	|| die "[$child:$$]: print(TOCHILD) fails: $!";
56
+    TOCHILD->flush();
57
     warn "[$child:$$]: told parent, passing response to client\n";
58
 
59
     # copy to child
60
@@ -974,7 +976,8 @@ sub proxy_grandchild($)
61
     for my $H (@hdrs)
62
     { print CONN $H->[0], ":", $H->[1], "\r\n";
63
     }
64
-    printflush(CONN,"\r\n");
65
+    print CONN "\r\n";
66
+    CONN->flush();
67
 
68
     # see RFC2616 section 10
69
     if (
70
@@ -1050,11 +1053,13 @@ sub proxy_copycl($$$)
71
 	)
72
   {
73
     ##warn "[$$]: read ".length($_)." bytes of request body\n";
74
-    if (! printflush($to,$_))
75
-    { warn "$::cmd: [$$]: printflush($to,..): $!";
76
+    $to->autoflush(1);
77
+    if (! print $to $_)
78
+    { warn "$::cmd: [$$]: print $to ..): $!";
79
       $ok=0;
80
       last COPY;
81
     }
82
+    $to->autoflush(0);
83
     $cl-=length if defined $cl;
84
   }
85
   warn "[$$]: finished unchunked body, ok=$ok";
86
@@ -1083,10 +1088,10 @@ sub proxy_copychunked($$)
87
     { print $to $_;
88
       $chunksize-=length;
89
     }
90
-    flush($to);
91
+    $to->flush();
92
   }
93
 
94
-  flush($to);
95
+  $to->flush();
96
 
97
   # pass trailer headers
98
   while (defined($_=<$from>) && !/^\r?\n/)
99
@@ -1096,7 +1101,7 @@ sub proxy_copychunked($$)
100
   { ##warn "[$$]: final trailer: $_";
101
     print $to $_;
102
   }
103
-  flush($to);
104
+  $to->flush();
105
 
106
   return (1,"");
107
 }
(-)adzap/pkg-descr (-2 / +2 lines)
Lines 1-7 Link Here
1
  Adzap is a http-redirector script for squid, that zaps by replacing
1
Adzap is a http-redirector script for squid, that zaps by replacing
2
those annoying ad banners from web pages with placeholder GIFs.
2
those annoying ad banners from web pages with placeholder GIFs.
3
It lives in the web proxy and so requires no special browser
3
It lives in the web proxy and so requires no special browser
4
facilities.  It's readily customizable, small, fast, and easy to
4
facilities. It's readily customizable, small, fast, and easy to
5
install.
5
install.
6
6
7
WWW: http://adzapper.sourceforge.net/
7
WWW: http://adzapper.sourceforge.net/
(-)adzap/pkg-plist (-45 / +1 lines)
Lines 1-47 Link Here
1
libexec/adzap
1
libexec/adzap
2
libexec/squid_redirect-nodata
2
libexec/squid_redirect
3
libexec/zapchain
3
libexec/zapchain
4
%%EXAMPLESDIR%%/adzap.conf
5
%%EXAMPLESDIR%%/rc/proxy-home.pac
6
%%EXAMPLESDIR%%/rc/proxy-zip.pac
7
%%EXAMPLESDIR%%/rc/patterns
8
%%EXAMPLESDIR%%/rc/squid/ERR_ACCESS_DENIED
9
%%EXAMPLESDIR%%/rc/squid/Mykefile
10
%%EXAMPLESDIR%%/rc/squid/ip-ranges@zip.raw
11
%%EXAMPLESDIR%%/rc/squid/tplt
12
%%EXAMPLESDIR%%/rc/squid/tplt-home
13
%%EXAMPLESDIR%%/rc/squid/tplt-zip
14
%%EXAMPLESDIR%%/zaps/ad-clear.gif
15
%%EXAMPLESDIR%%/zaps/ad-clear.mp3
16
%%EXAMPLESDIR%%/zaps/ad-clear.swf
17
%%EXAMPLESDIR%%/zaps/ad-grey.gif
18
%%EXAMPLESDIR%%/zaps/ad-old.gif
19
%%EXAMPLESDIR%%/zaps/ad.gif
20
%%EXAMPLESDIR%%/zaps/ad.mp3
21
%%EXAMPLESDIR%%/zaps/ad.swf
22
%%EXAMPLESDIR%%/zaps/adbg-clear.gif
23
%%EXAMPLESDIR%%/zaps/adbg.gif
24
%%EXAMPLESDIR%%/zaps/closepopup-clear.html
25
%%EXAMPLESDIR%%/zaps/closepopup.html
26
%%EXAMPLESDIR%%/zaps/counter-clear.gif
27
%%EXAMPLESDIR%%/zaps/counter-clear.js
28
%%EXAMPLESDIR%%/zaps/counter.gif
29
%%EXAMPLESDIR%%/zaps/counter.js
30
%%EXAMPLESDIR%%/zaps/no-op-clear.html
31
%%EXAMPLESDIR%%/zaps/no-op-clear.js
32
%%EXAMPLESDIR%%/zaps/no-op-counter-clear.html
33
%%EXAMPLESDIR%%/zaps/no-op-counter-clear.js
34
%%EXAMPLESDIR%%/zaps/no-op-counter.html
35
%%EXAMPLESDIR%%/zaps/no-op-counter.js
36
%%EXAMPLESDIR%%/zaps/no-op.html
37
%%EXAMPLESDIR%%/zaps/no-op.js
38
%%EXAMPLESDIR%%/zaps/webbug-clear.gif
39
%%EXAMPLESDIR%%/zaps/webbug-clear.html
40
%%EXAMPLESDIR%%/zaps/webbug-clear.js
41
%%EXAMPLESDIR%%/zaps/webbug.gif
42
%%EXAMPLESDIR%%/zaps/webbug.html
43
%%EXAMPLESDIR%%/zaps/webbug.js
44
@dirrm %%EXAMPLESDIR%%/rc/squid
45
@dirrm %%EXAMPLESDIR%%/rc
46
@dirrm %%EXAMPLESDIR%%/zaps
47
@dirrm %%EXAMPLESDIR%%

Return to bug 183768