From 508a62b0e576fcc850fb702b6275ab204ca94ece Mon Sep 17 00:00:00 2001 From: William Joye Date: Mon, 24 Apr 2017 15:05:45 -0400 Subject: support https via tls --- ds9/library/catvot.tcl | 1 + ds9/library/ds9.tcl | 3 +++ ds9/library/hvsup.tcl | 9 ++++++--- ds9/library/samp.tcl | 1 + ds9/library/siadialog.tcl | 3 ++- ds9/library/url.tcl | 4 +++- ds9/library/util.tcl | 4 ++++ 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ds9/library/catvot.tcl b/ds9/library/catvot.tcl index ad040ef..1425391 100644 --- a/ds9/library/catvot.tcl +++ b/ds9/library/catvot.tcl @@ -16,6 +16,7 @@ proc CATVOTURL {url catalog title} { ftp {CATVOTFTP $r(authority) $r(path)} file {CATVOTFile $r(path)} http - + https - default {CATVOTHTTP $url $catalog $title} } } diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl index 40daef3..d59f28e 100755 --- a/ds9/library/ds9.tcl +++ b/ds9/library/ds9.tcl @@ -206,6 +206,7 @@ switch $ds9(wm) { source $ds9(root)/tkcon/tkcon.tcl source $ds9(root)/tkblt/graph.tcl + source $ds9(root)/tls/tls.tcl source $ds9(root)/library/source.tcl @@ -239,6 +240,7 @@ switch $ds9(wm) { package require tkcon package require Tkblt + package require tls package require xmlrpc @@ -299,6 +301,7 @@ switch $ds9(wm) { package require tkcon package require Tkblt + package require tls package require xmlrpc diff --git a/ds9/library/hvsup.tcl b/ds9/library/hvsup.tcl index c16545a..b5b4a2d 100644 --- a/ds9/library/hvsup.tcl +++ b/ds9/library/hvsup.tcl @@ -213,7 +213,8 @@ proc HVLoadURL {varname url query {sync 0}} { file - {} {HVProcessURLFile $varname $url $query r} ftp {HVProcessURLFTP $varname $url $query r} - http {HVProcessURLHTTP $varname $url $query r $sync} + http - + https {HVProcessURLHTTP $varname $url $query r $sync} default {HVError $varname "[msgcat::mc {Sorry, DS9 does not support}] $r(scheme)"} } } @@ -1125,7 +1126,8 @@ proc HVParseHTML {varname} { set base {} # scheme switch $r(scheme) { - http {append base "$r(scheme)://"} + http - + https {append base "$r(scheme)://"} ftp {} file {} } @@ -1829,7 +1831,8 @@ proc HVImageURL {varname url width height} { } } } - http { + http - + https { set ch {} set fn [tmpnam [file extension $r(path)]] diff --git a/ds9/library/samp.tcl b/ds9/library/samp.tcl index 748fa67..a570358 100644 --- a/ds9/library/samp.tcl +++ b/ds9/library/samp.tcl @@ -1043,6 +1043,7 @@ proc SAMPParseHub {} { } file {set fn $rr(path)} http - + https - default { set fn [tmpnam {.samp}] GetFileHTTP $url $fn diff --git a/ds9/library/siadialog.tcl b/ds9/library/siadialog.tcl index 3542c0f..c4ecdae 100644 --- a/ds9/library/siadialog.tcl +++ b/ds9/library/siadialog.tcl @@ -396,7 +396,8 @@ proc SIAImageCmd {varname} { SIAApplyLoad $varname ParseURL $url r switch -- $r(scheme) { - http { + http - + https { if {$var(save)} { set var(fn) [SaveFileDialog savefitsfbox] if {$var(fn) == {}} { diff --git a/ds9/library/url.tcl b/ds9/library/url.tcl index 60a5a62..1535aa1 100644 --- a/ds9/library/url.tcl +++ b/ds9/library/url.tcl @@ -14,7 +14,8 @@ proc GetFileURL {url fname} { switch -- $rr(scheme) { ftp {GetFileFTP $rr(authority) $rr(path) $fn} file {set fn $rr(path)} - http - + http + https - default {GetFileHTTP $url $fn} } } @@ -87,6 +88,7 @@ proc LoadURLFits {url layer mode} { ftp {LoadURLFitsFTP $r(authority) $r(path) $layer $mode} file {LoadURLFitsFile $r(path) $layer $mode} http - + https - default {LoadURLFitsHTTP $url $layer $mode} } } diff --git a/ds9/library/util.tcl b/ds9/library/util.tcl index 199b106..279257d 100644 --- a/ds9/library/util.tcl +++ b/ds9/library/util.tcl @@ -929,6 +929,7 @@ proc ParseURL {url varname} { {} - ftp - http - + https - file { if {[regexp {/([A-Z]:)(/.*)} $r(path) a b c]} { set r(path) "$b$c" @@ -1014,6 +1015,9 @@ proc ConfigHTTP {} { # set the User-Agent http::config -useragent ds9 + # set up tls + http::register https 443 [list ::tls::socket -tls1 1] + # set the proxy if requested if {$phttp(proxy)} { http::config -proxyhost $phttp(proxy,host) -proxyport $phttp(proxy,port) -- cgit v0.12