diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-05-28 20:15:45 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-05-28 20:15:45 (GMT) |
commit | 2222fb279bd3127891eeb1d57e35dcba0e3f3d83 (patch) | |
tree | 5ff16be2e9b57b31f284c0a4217f262f2412f5df | |
parent | a2ec298aae86bcf577e28753820cb6399b1b80b4 (diff) | |
parent | 45619b5d0d1e761db43f1d8302c223b6746bb998 (diff) | |
download | blt-2222fb279bd3127891eeb1d57e35dcba0e3f3d83.zip blt-2222fb279bd3127891eeb1d57e35dcba0e3f3d83.tar.gz blt-2222fb279bd3127891eeb1d57e35dcba0e3f3d83.tar.bz2 |
merge
-rw-r--r-- | ds9/doc/release/r8.1.html | 1 | ||||
-rw-r--r-- | ds9/library/url.tcl | 22 |
2 files changed, 14 insertions, 9 deletions
diff --git a/ds9/doc/release/r8.1.html b/ds9/doc/release/r8.1.html index abfcb69..4dd67ac 100644 --- a/ds9/doc/release/r8.1.html +++ b/ds9/doc/release/r8.1.html @@ -79,6 +79,7 @@ <li><tt>05.10.2019 AST: update to version 8.7.1.</tt></li> <li><tt>05.13.2019 OPENSSL: DS9 now links against its own version of openssl and no longer is dependent upon system libs.</tt></li> <li><tt><b>05.15.2019 RELEASE version 8.1b1</b></tt></li> +<li><tt>05.28.2019 URL: more tolerant of mime types when downloading via http.</tt></li> <li><tt><b>xx.xx.2019 RELEASE version 8.1b2</b></tt></li> </ol> </div> diff --git a/ds9/library/url.tcl b/ds9/library/url.tcl index 7ad5c60..ce63cd8 100644 --- a/ds9/library/url.tcl +++ b/ds9/library/url.tcl @@ -55,6 +55,7 @@ proc GetFileHTTP {url fn} { -timeout $ihttp(timeout) \ -headers "[ProxyHTTP]"} token]} { close $ch + Error "[msgcat::mc {Unable to locate URL}] $var(url)" return } @@ -138,17 +139,20 @@ proc LoadURLFitsHTTP {url layer mode} { set fn [tmpnam [file extension $r(path)]] set ch [open $fn w] - set token [http::geturl $url \ - -channel $ch \ - -binary 1 \ - -timeout $ihttp(timeout) \ - -headers "[ProxyHTTP]"] + if {[catch {set token [http::geturl $url \ + -channel $ch \ + -binary 1 \ + -timeout $ihttp(timeout) \ + -headers "[ProxyHTTP]"]}]} { + close $var(ch) + Error "[msgcat::mc {Unable to locate URL}] $url" + } # reset errorInfo (may be set in http::geturl) global errorInfo set errorInfo {} - catch {close $ch} + close $ch upvar #0 $token t @@ -225,8 +229,10 @@ proc LoadURLFitsHTTP {url layer mode} { } switch -- [string tolower $mime] { + "text/plain" - + "text/html" - "application/octet-stream" { - # its never fails, someone can't get there mime types correct. + # it never fails, someone can't get there mime types correct. # Override the mime type based on path switch -- [file extension $fn] { .bz2 {set var(encoding) bzip2} @@ -264,8 +270,6 @@ proc LoadURLFitsHTTP {url layer mode} { "image/x-zfits" - "binary/x-zfits" {set encoding pack} - "text/plain" {} - "text/html" - default { Error "[msgcat::mc {File not Found or Unable to load FITS data MIME type}] $mime" return |