changeset 372:9dd4d2e3a4ac

urllog: Fix missing http(s)/ftp:// protocol prefix guessing.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 30 Jan 2016 00:28:14 +0200
parents 36869897f21d
children bc7746ca622e
files urllog.tcl
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/urllog.tcl	Wed Jan 06 20:41:47 2016 +0200
+++ b/urllog.tcl	Sat Jan 30 00:28:14 2016 +0200
@@ -291,10 +291,12 @@
 
   ### Try to guess the URL protocol component (if it is missing)
   set u_checktld 1
-  if {[string match "*www.*" $urlStr] && ![string match "http://*" $urlStr] && ![string match "https://*" $urlStr]} {
-    set urlStr "http://$urlStr"
-  } elseif {[string match "*ftp.*" $urlStr] && ![string match "ftp://*" $urlStr]} {
-    set urlStr "ftp://$urlStr"
+  if {![string match "http://*" $urlStr] && ![string match "https://*" $urlStr] && ![string match "ftp://*" $urlStr]} {
+    if {[string match "*www.*" $urlStr]} {
+      set urlStr "http://$urlStr"
+    } elseif {[string match "*ftp.*" $urlStr]} {
+      set urlStr "ftp://$urlStr"
+    }
   }
 
   ### Handle URLs that have an IPv4-address