Mercurial > hg > egg-tcls
changeset 304:f1589fe20732
urllog: Added urllog_extra_strict option.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 27 Jan 2015 08:40:17 +0200 |
parents | a55beb347bad |
children | 930a13c20d6c |
files | config.urllog.example urllog.tcl |
diffstat | 2 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/config.urllog.example Tue Jan 27 08:39:50 2015 +0200 +++ b/config.urllog.example Tue Jan 27 08:40:17 2015 +0200 @@ -33,6 +33,12 @@ # (You probably want this enabled.) set urllog_extra_checks 1 +### Set to 1 if you want "strict" extra checking. This will cause +### ftp URLs not being added, and if TLS support is disabled, https URLs +### will not be added either. You probably don't want this set. +set urllog_extra_strict 0 + + ### Check if the TLD (top level domain) looks sane. You might want to disable ### this, because lately (as of 2013+) ICANN has allowed addition of loads ### and loads of new TLDs which would be impossible to keep list of here ..
--- a/urllog.tcl Tue Jan 27 08:39:50 2015 +0200 +++ b/urllog.tcl Tue Jan 27 08:40:17 2015 +0200 @@ -376,7 +376,7 @@ #------------------------------------------------------------------------- proc urllog_check_url {urlStr urlNick urlHost urlChan} { global urllog_encoding http_tls_support urlmsg_errorgettingdoc - global urllog_extra_checks urllog_rasiatube_hack + global urllog_extra_checks urllog_extra_strict urllog_rasiatube_hack ### Does the URL already exist? if {![urllog_exists $urlStr $urlNick $urlHost $urlChan]} { @@ -392,9 +392,17 @@ ### Do we perform additional checks? if {$urllog_extra_checks == 0 || !(($http_tls_support != 0 && $u_proto == "https") || $u_proto == "http")} { # No optional checks, or it's not http/https. - # Just add the URL, if it does not exist already. - urllog_addurl $urlStr $urlNick $urlHost $urlChan "" - return 1 + if ($urllog_extra_strict == 0} { + # Strict checking disabled, so add the URL, if it does not exist already. + urllog_addurl $urlStr $urlNick $urlHost $urlChan "" + return 1 + } elseif ($http_tls_support == 0 && $u_proto == "https") { + # Strict ENABLED: If TLS support is disabled and we have https, do nothing + return 1 + } elseif ($u_proto != "http" && $u_prot != "https") { + # Strict ENABLED: It's not http, or https + return 1 + } } ### Does the document pointed by the URL exist?