util::resources::download_helper (public)
util::resources::download_helper [ -url url ]
Defined in packages/acs-tcl/tcl/utilities-procs.tcl
Helper for ::util::resources::download, since some download sites tend to redirect.
- Switches:
- -url (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set host [dict get [ns_parseurl $url] host] set result [ns_http run -hostname $host -spoolsize 1 $url] set fn "" switch [dict get $result status] { 200 { set fn [dict get $result file] } 301 - 302 { set location [ns_set iget [dict get $result headers] location] ns_log notice "download redirected to $location" #set result [util::http::get -url $location -spool] set host [dict get [ns_parseurl $url] host] set result [ns_http run -hostname $host -spoolsize 1 $location] if {[dict get $result status] == 200} { set fn [dict get $result file] } } default { ns_log warning "::util::resources::download $url" "lead to HTTP status code [dict get $result status]" } } if {$fn eq ""} { error "download from $url failed: $result" } return $resultXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-tcl/tcl/utilities-procs.xql