summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2007-01-04 18:06:16 +0000
committerdakkar <dakkar@luxion>2007-01-04 18:06:16 +0000
commit301af24615e8d6847f38f3135751f171d2edbc51 (patch)
tree0c60885f9aebdeface8ebd9c4447d9895723fec4
parentcorretto il counter js (diff)
downloadmyProxy-301af24615e8d6847f38f3135751f171d2edbc51.tar.gz
myProxy-301af24615e8d6847f38f3135751f171d2edbc51.tar.bz2
myProxy-301af24615e8d6847f38f3135751f171d2edbc51.zip
i pattern non validi vengono ignorati, aggiunti pattern per evitare i loop in nytimes
git-svn-id: svn://luxion/repos/myProxy/trunk@239 fcb26f47-9200-0410-b104-b98ab5b095f3
-rwxr-xr-xMyProxy.pl10
-rw-r--r--adzap/scripts/prematch.list2
2 files changed, 9 insertions, 3 deletions
diff --git a/MyProxy.pl b/MyProxy.pl
index f7af9fb..df1cda4 100755
--- a/MyProxy.pl
+++ b/MyProxy.pl
@@ -27,10 +27,13 @@ sub subptn2re {
sub ptn2re {
my ($pat)=@_;
- $pat=~s|([.\@\%\$?+])|\\$1|g; # quote specials
+ $pat=~s|([.\@\%\$+])|\\$1|g; # quote specials
+ $pat=~s|([^(])(\?)|$1\\$2|g; # quote some question marks
$pat=~s|/+|/+|g; # turn slashes into "/+"
$pat=~s:(\\.|[^*\\]|\*+):subptn2re($1):ge; # expand wildcards
- return qr{^$pat$};
+ my $ret=eval{qr{^$pat$}};
+ return if $@;
+ return $ret;
}
my %ACTIONS=(
@@ -68,7 +71,8 @@ sub addPattern {
$addPatternLogger->error("Unknown action $action, skipping");
return;
}
- push @PATTERNS,[ptn2re($match),@{$ACTIONS{$action}},@parms];
+ my $re=ptn2re($match);
+ push @PATTERNS,[$re,@{$ACTIONS{$action}},@parms] if $re;
}
my $loadPatternsLogger=Log::Log4perl->get_logger('MyProxy.load.loadPatterns');
diff --git a/adzap/scripts/prematch.list b/adzap/scripts/prematch.list
index 89c3115..426d629 100644
--- a/adzap/scripts/prematch.list
+++ b/adzap/scripts/prematch.list
@@ -7,3 +7,5 @@ PRINT http://(www*.|)wired.com/wired/archive/([^p]**)(?<!_pr).html** http://www.
PRINT http://(www*.|)wired.com/news/[^p]*/0,*,(*),00.html** http://www.wired.com/news/print/0,1294,$2,00.html
PRINT (http://*.boston.com/**/articles/[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/*/)(|?)** $1?mode=PF
COUNTERJS http://*/**counter**.js
+PRINT http://(www*.|)nytimes.com/(aponline|20[0-9][0-9]/[01][0-9]/[0-3][0-9])/**.html?**(?<!print) $&&pagewanted=print
+PASS http://(www*.|)nytimes.com/(aponline|20[0-9][0-9]/[01][0-9]/[0-3][0-9])/**.html?**print