Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.189.2.107 -r1.189.2.108 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 30 Nov 2021 07:33:40 -0000 1.189.2.107 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 28 Dec 2021 09:18:10 -0000 1.189.2.108 @@ -1857,8 +1857,9 @@ } ad_proc util::split_location {location protoVar hostnameVar portVar} { - Split the provided location into "proto", "hostname" and - "port". The results are returned to the provided output + + Split the provided location into "proto", "hostname" and "port". + The results are returned on success to the provided output variables. The function supports IP-literal notation according to RFC 3986 section 3.2.2. @@ -1868,18 +1869,24 @@ } { upvar $protoVar proto $hostnameVar hostname $portVar port - set urlInfo [ns_parseurl $location] - if {[dict exists $urlInfo proto] && [dict exists $urlInfo host]} { - set proto [dict get $urlInfo proto] - set hostname [dict get $urlInfo host] - if {[dict exists $urlInfo port]} { - set port [dict get $urlInfo port] + try { + set urlInfo [ns_parseurl $location] + } on error {errorMsg} { + ns_log warning "cannot parse URL '$location': $errorMsg" + set success 0 + } on ok {result} { + if {[dict exists $urlInfo proto] && [dict exists $urlInfo host]} { + set proto [dict get $urlInfo proto] + set hostname [dict get $urlInfo host] + if {[dict exists $urlInfo port]} { + set port [dict get $urlInfo port] + } else { + set port [dict get {http 80 https 443} $proto] + } + set success 1 } else { - set port [dict get {http 80 https 443} $proto] + set success 0 } - set success 1 - } else { - set success 0 } return $success }