URI Tracker - Question - ERROR: undefined procedure: swith][swith -glob [string tolower [HTTP::uri]]
URI tracker code is driving me nutts. I dont know if my backets are screwed up or if my HTTP::uri is screwed. For awhile, I was getting a cross bracket error, but after using Notepad++, I THINK i got them all. Now Im getting the attached error now. has anyone else used the Link tracker and had issues with the code parsing? when HTTP_REQUEST { set TABLE_LINK "LINK_TRACKING_[virtual name]"; set TABLE_FILTERS "LINK_TRACKING_FILTERS_[virtual name]"; swith -glob [string tolower [HTTP::uri]] { "/linkadmin*" { set count_filter ""; set data_filter ""; set msg [URI::decode [getfield [HTTP::uri] "/" 3]] if { ($msg starts_with "f(") && ($msg ends_with ")") } { set count_filter ""; set data_filter [string range $msg 2 end-1]; set msg ""; } elseif { ($msg starts_with "c(") && ($msg ends_with ")") } { set count_filter [string range $msg end-1]; set data_filter ""; set msg ""; } set count [table keys -subtable $TABLE_LINK -count] set content {URI tracking URI Tracking append content "$TABLE_LINK" append content "Link Count$count" append content {Controls } append content "URI Filters" foreach key [table keys -subtable $TABLE_FILTERS] { append content "\[\] $key "; } append content ""; append content {Add Filter } if { "" !=$msg } { append content "Message%msg"; } append content ""; append content "" append content "Link Metrics"; append content "URICount"; append content {Filter Results } append content " [] } append content " [] }; foreach key [lsort -dictionary [table keys -subtable $TABLE_LINK]] { if { "" !=$data_filter } { if { [string match $data_filter $key] } { set v [table lookup -subtable $TABLE_LINK $key]; append content "\[\] $key$v"; } }elseif { "" != $count_filter } { set v [table lookup -subtable $TABLE_LINK $key]; if { $v >= $count_filter } { append content "\[\] $key$v"; } } else { set v [table lookup -subtable $TABLE_LINK $key]; append content "\[\] $key$v"; } } append content ""; HTTP::respond 200 Content $content; } "/linkcleardata"{ table delete -subtable $TABLE_LINK -all; HTTP::redirect "http://[HTTP::host]/linkadmin/link+Tracking+Cleared" } "/linkremovedata/*" { set val [string range [HTTP::uri] [string length "linkremovedata/"] end] if { "" != $val }{ table delete -subtable $TABLE_LINK $val; } HTTP::redirect "http://[HTTP::host]/linkadmin/Link+Deleted"; } "/linkclearfilter" { table delete -subtable $TABLE_FILTERS -all; HTTP::redirect "http://[HTTP::host]/linkadmin/Link+Filters+Cleared" } "/linkaddfilter/*" { set f [string range [HTTP::uri][string length "/linkaddfilter/"] end] if { "" != $f}{ table add -subtable $TABLE_FILTERS $f 1 indefinite indefinite; } HTTP::redirect "http://[HTTP::host]/linkadmin/Filter+Added"; } "/linkremovefilter/*" { set val [string range [HTTP::uri][string length "linkremovefilter/"] end] if { "" != $val }{ table delete -subtable $TABLE_FILTERS $val; } HTTP::redirect "http::/[HTTP::host]/linkadmin/Filter+Deleted"; } default { set match 1; set c [table keys -subtable $TABLE_FILTERS -count] if { $c != 0 } { set match 0; foreach key [lsort [table keys -subtable $TABLE_FILTERS]] { set m [string match $key [HTTP::uri]]; if { 1 == $m } { set match 1; break; } } } } } }340Views0likes4Comments