reflected the recent standard changes in the doc
This commit is contained in:
+8
-4
@@ -78,8 +78,7 @@ proc url2dict {inputurl} {
|
||||
}
|
||||
|
||||
proc reqresp {host port reqline is_tls encoding} {
|
||||
global sock_response
|
||||
set sock_net_timeout 5000
|
||||
global sock_response net_timeout
|
||||
set sock 0
|
||||
if {$is_tls eq 1} {
|
||||
catch {set sock [::tls::socket -autoservername true -async $host $port]}
|
||||
@@ -109,7 +108,7 @@ proc reqresp {host port reqline is_tls encoding} {
|
||||
}
|
||||
set rcv_end_$sock 0
|
||||
}
|
||||
after $sock_net_timeout "global rcv_end_$sock; set rcv_end_$sock 1"
|
||||
after $net_timeout "global rcv_end_$sock; set rcv_end_$sock 1"
|
||||
vwait rcv_end_$sock
|
||||
catch {close $sock}
|
||||
unset -nocomplain rcv_end_$sock
|
||||
@@ -118,6 +117,7 @@ proc reqresp {host port reqline is_tls encoding} {
|
||||
|
||||
# file download helper
|
||||
proc getfile {url} {
|
||||
global net_timeout
|
||||
set url [regsub -all {([^:])//} $url {\1/}]
|
||||
set urlparts [url2dict $url]
|
||||
set scheme [dict get $urlparts scheme]
|
||||
@@ -156,7 +156,7 @@ proc getfile {url} {
|
||||
https - http {
|
||||
set hs ""
|
||||
while {$hs eq ""} {
|
||||
set hs [::http::geturl $url -binary 1 -keepalive 0 -timeout 10000]
|
||||
set hs [::http::geturl $url -binary 1 -keepalive 0 -timeout $net_timeout]
|
||||
}
|
||||
if {[::http::ncode $hs] eq "200"} {
|
||||
return [::http::data $hs]
|
||||
@@ -369,6 +369,7 @@ set localdb [file join $appdir "tii.db"]
|
||||
|
||||
# populate general HTTP configuration
|
||||
set cfgfile [file join $appdir "config.txt"]
|
||||
set net_timeout 5000
|
||||
if {[file exists $cfgfile]} {
|
||||
set cfg [readfile $cfgfile]
|
||||
if {[dict exists $cfg useragent]} {
|
||||
@@ -380,6 +381,9 @@ if {[file exists $cfgfile]} {
|
||||
if {[dict exists $cfg proxyport]} {
|
||||
::http::config -proxyport [dict get $cfg proxyport]
|
||||
}
|
||||
if {[dict exists $cfg net_timeout]} {
|
||||
set net_timeout [dict get $cfg net_timeout]
|
||||
}
|
||||
}
|
||||
|
||||
if {$argc > 0} {
|
||||
|
||||
Reference in New Issue
Block a user