util::external_url_p (public)

 util::external_url_p url

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

check if this URL is external to the current host or a valid alternative valid alternatives include HTTPS or HTTP protocol change HTTP or HTTPS port number added or removed from current hostname or another hostname that the host responds to (from host_node_map)

Parameters:
url (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_page_contract_filters ad_page_contract_filters (test acs-tcl) util::external_url_p util::external_url_p test_ad_page_contract_filters->util::external_url_p security::locations security::locations (public) util::external_url_p->security::locations util_complete_url_p util_complete_url_p (public) util::external_url_p->util_complete_url_p ad_dom_sanitize_html ad_dom_sanitize_html (public) ad_dom_sanitize_html->util::external_url_p ad_page_contract_filter_proc_localurl ad_page_contract_filter_proc_localurl (public) ad_page_contract_filter_proc_localurl->util::external_url_p ad_returnredirect ad_returnredirect (public) ad_returnredirect->util::external_url_p packages/bug-tracker/www/bug-add.tcl packages/bug-tracker/ www/bug-add.tcl packages/bug-tracker/www/bug-add.tcl->util::external_url_p packages/bug-tracker/www/bulk-update-op.tcl packages/bug-tracker/ www/bulk-update-op.tcl packages/bug-tracker/www/bulk-update-op.tcl->util::external_url_p

Testcases:
ad_page_contract_filters
Source code:
    set complete_url_p [util_complete_url_p $url]
    #
    # Only if the URL is syntactical a URL with a protocol, it might
    # be external.
    #
    if {$complete_url_p} {
        set external_url_p $complete_url_p
        #
        # If it has a protocol, we have to be able to find it in security::locations
        #
        set locations_list [security::locations]
        # more valid url pairs with host_node_map

        foreach location $locations_list {
            if {$location eq ""} {
                continue
            }
            set len [string length $location]
            #ns_log notice "util::external_url_p location match <$location/*> with <$url> sub <[string range $url 0 $len-1]>"
            if {[string range $url 0 $len-1] eq $location} {
                set external_url_p 0
                break
            }
        }
    } else {
        try {
            set external_url_p [dict exists [ns_parseurl -strict $url] host]
        } on error {errorMsg} {
            set external_url_p 0
        }
    }
    return $external_url_p
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: