Mercurial > hg > egg-tcls
changeset 95:687bdd74dfac
urllog: Check if TLS support is enabled when checking if we can fetch title information via HTTP or SSL/HTTP.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 12 Sep 2011 19:00:20 +0300 |
parents | b4fdb3300faa |
children | e5a6c27be365 |
files | urllog.tcl |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/urllog.tcl Mon Sep 12 18:57:52 2011 +0300 +++ b/urllog.tcl Mon Sep 12 19:00:20 2011 +0300 @@ -363,6 +363,7 @@ global urllog_tlds urllog_check urlmsg_nosuchhost urlmsg_ioerror global urlmsg_timeout urlmsg_errorgettingdoc urllog_httprep global urllog_shorturl_prefix urllog_shorturl urllog_encoding + global http_tls_support ### Try to determine the URL protocol component (if it is missing) set u_checktld 1 @@ -372,7 +373,8 @@ set urlStr "ftp://$urlStr" } - if {[regexp "(ftp|http|https)://(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})" $urlStr u_match u_prefix ni1 ni2 ni3 ni4]} { + ### Handle URLs that have an IPv4-address + if {[regexp "(\[a-z\]+)://(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})\\.(\[0-9\]{1,3})" $urlStr u_match u_proto ni1 ni2 ni3 ni4]} { # Check if the IP is on local network if {$ni1 == 127 || $ni1 == 10 || ($ni1 == 192 && $ni2 == 168) || $ni1 == 0} { urllog_log "URL pointing to local or invalid network, ignored ($urlStr)." @@ -388,6 +390,11 @@ return 0 } + ### Get URL protocol component + set u_proto "" + if {[regexp "(\[a-z\]+)://" $urlStr u_match u_proto]} { + } + ### Check the PORT (if the ":" is there) set u_record [split $urlStr "/"] set u_hostname [lindex $u_record 2] @@ -441,7 +448,7 @@ } ### Do we perform additional optional checks? - if {$urllog_check == 0 || [string range $urlStr 0 3] != "http"} { + if {$urllog_check == 0 || ($http_tls_support == 0 && $u_proto == "https") || $u_proto != "http"} { # No optional checks, just add the URL, if it does not exist already urllog_addurl $urlStr $urlNick $urlHost $urlChan "" return 1