From 93e08ecd3b8121ef98503e321a5f3039ce330dd2 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 7 Nov 2001 11:30:52 +0000 Subject: [PATCH] Glob-expressions may be expressed as a list in rules (multi-OR). --- robot.tcl | 35 ++++++++++++++++++++--------------- rules | 11 ++++++----- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/robot.tcl b/robot.tcl index 5210452..b49ca0b 100755 --- a/robot.tcl +++ b/robot.tcl @@ -1,5 +1,5 @@ #!/usr/bin/tclsh -# $Id: robot.tcl,v 1.23 2001/10/31 08:51:49 adam Exp $ +# $Id: robot.tcl,v 1.24 2001/11/07 11:30:52 adam Exp $ # proc RobotFileNext1 {area lead} { # puts "RobotFileNext1 area=$area lead=$lead" @@ -647,12 +647,6 @@ proc Robot200 {url} { RobotWriteMetadata $url $out RobotFileClose $out - if {[file isdirectory flat]} { - regsub -all {/} $URL($url,hostport).$URL($url,path) {.} fname - set out [open "flat/$fname" w] - RobotWriteMetadata $url $out - close $out - } RobotFileUnlink unvisited $URL($url,hostport) $URL($url,path) } @@ -873,17 +867,28 @@ proc checkrule {type this} { # consider type if {[lindex $l 1] != $type} continue # consider mask (! negates) - set mask [lindex $l 2] - if {[string index $mask 0] == "!"} { - set mask [string range $mask 1 end] - if {[string match $mask $this]} continue - } else { - if {![string match $mask $this]} continue + set masks [lindex $l 2] + set ok 0 + foreach mask $masks { + if {$debuglevel > 4} { + puts "consider single mask $mask" + } + if {[string index $mask 0] == "!"} { + set mask [string range $mask 1 end] + if {[string match $mask $this]} continue + } else { + if {![string match $mask $this]} continue + } + set ok 1 + } + if {$debuglevel > 4} { + puts "ok = $ok" } + if {!$ok} continue # OK, we have a match if {[lindex $l 0] == "allow"} { if {$debuglevel > 3} { - puts "CHECKRULE MATH OK" + puts "CHECKRULE MATCH OK" } return 1 } else { @@ -895,7 +900,7 @@ proc checkrule {type this} { } } if {$debuglevel > 3} { - puts "CHECKRULE MATH OK" + puts "CHECKRULE MATCH OK" } return 1 } diff --git a/rules b/rules index 2abca55..4a23a35 100644 --- a/rules +++ b/rules @@ -1,9 +1,8 @@ -# sample rules $Id: rules,v 1.2 2001/10/30 08:29:54 adam Exp $ +# sample rules $Id: rules,v 1.3 2001/11/07 11:30:52 adam Exp $ url http://www.indexdata.dk -allow url http://www.indexdata.dk/software* -allow url http://www.indexdata.dk/zap* +allow url {http://www.indexdata.dk/software* http://www.indexdata.dk/zap*} allow url http://www.indexdata.dk/yaz* allow url http://www.indexdata.dk/ deny url http://www.indexdata.dk/* @@ -11,7 +10,9 @@ deny url !http://*.indexdata.dk/* allow mime text/html allow mime application/pdf -deny mime text/plain +allow mime text/plain deny mime * -set maxdistance 4 +set maxdistance 3 + +set debuglevel 1 -- 1.7.10.4