Mercurial > hg > egg-tcls
changeset 300:2a9ee3f68225
urllog: Make TLD check configurable.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 27 Jan 2015 08:23:22 +0200 |
parents | 1ff281e821a3 |
children | 916618770490 |
files | config.urllog.example urllog.tcl |
diffstat | 2 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/config.urllog.example Tue Jan 27 08:22:36 2015 +0200 +++ b/config.urllog.example Tue Jan 27 08:23:22 2015 +0200 @@ -55,6 +55,13 @@ # (You probably want this enabled.) set urllog_extra_checks 1 +### Check if the TLD (top level domain) looks sane +set urllog_check_tld 1 + +# The valid known Top Level Domains (TLDs), but not the country code TLDs +set urllog_tld_list "org,com,net,mil,gov,biz,edu,coop,aero,info,museum,name,pro,int,xxx" + + ### Enable "rasiatube" hack that de-mangles rasiatube links set urllog_rasiatube_hack 1 @@ -133,6 +140,3 @@ # (Valid alternatives are "PRIVMSG" and "NOTICE") set urllog_preferredmsg "PRIVMSG" -# The valid known Top Level Domains (TLDs), but not the country code TLDs -# (Now includes the new IANA published TLDs) -set urllog_tlds "org,com,net,mil,gov,biz,edu,coop,aero,info,museum,name,pro,int,xxx"
--- a/urllog.tcl Tue Jan 27 08:22:36 2015 +0200 +++ b/urllog.tcl Tue Jan 27 08:23:22 2015 +0200 @@ -38,7 +38,7 @@ set urllog_name "URLLog" set urllog_version "2.4.0" -set urllog_tlds [split $urllog_tlds ","] +set urllog_tld_list [split $urllog_tld_list ","] set urllog_httprep [split "\@|%40|{|%7B|}|%7D|\[|%5B|\]|%5D" "|"] @@ -62,6 +62,10 @@ putlog " (Additional URL validity checks enabled)" } +if {$urllog_check_tld != 0} { + putlog " (Check TLD)" +} + if {$urllog_verbose != 0} { putlog " (Verbose mode enabled)" } @@ -283,8 +287,8 @@ #------------------------------------------------------------------------- proc urllog_validate_url { urlNick urlChan urlMStr urlMProto } { - global urllog_tlds urllog_extra_checks urlmsg_nosuchhost urllog_httprep - global urllog_shorturl_prefix urllog_shorturl + global urllog_tld_list urlmsg_nosuchhost urllog_httprep + global urllog_shorturl_prefix urllog_shorturl urllog_check_tld upvar 1 $urlMStr urlStr upvar 1 $urlMProto urlProto @@ -340,7 +344,7 @@ } ### Check the Top Level Domain (TLD) validity - if {$u_checktld != 0} { + if {$urllog_check_tld != 0 && $u_checktld != 0} { set u_sane [lindex [split $u_hostname "."] end] set u_tld [lindex [split $u_sane ":"] 0] set u_found 0 @@ -350,7 +354,7 @@ set u_found 1 } else { # Check our list of known TLDs - foreach itld $urllog_tlds { + foreach itld $urllog_tld_list { if {[string match $itld $u_tld]} { set u_found 1 }