Index: client/1.0/neutral/common.tcl ================================================================== --- client/1.0/neutral/common.tcl +++ client/1.0/neutral/common.tcl @@ -149,10 +149,20 @@ variable allowInsecureRedirect; # DEFAULT: false if {![info exists allowInsecureRedirect]} then { set allowInsecureRedirect false } + + # + # NOTE: How long should we wait for the HTTP request to complete? This + # value is the number of milliseconds. + # + variable timeoutGetUrl; # DEFAULT: 0 + + if {![info exists timeoutGetUrl]} then { + set timeoutGetUrl 0 + } } # # NOTE: This procedure was stolen from the "common.tcl" script. It is # designed to emit a message to the console. The channel argument @@ -266,10 +276,16 @@ # NOTE: This variable is used to keep track of the currently scheduled # (i.e. pending) [after] event. # variable afterForPageProgress + # + # NOTE: This variable is used to determine the timeout milliseconds for + # HTTP requests. + # + variable timeoutGetUrl + # # NOTE: This procedure requires the modern version of the HTTP package, # which is typically included with the Tcl core distribution. # package require http 2.0 @@ -351,11 +367,38 @@ # pageLog [appendArgs \ "attempting to download URL \"" $uri \"...] } - set token [eval ::http::geturl [list $uri] $args] + # + # NOTE: Build the (optional?) list of options for the HTTP call. + # + set localArgs [list] + + if {$timeoutGetUrl != 0} then { + lappend localArgs -timeout $timeoutGetUrl; # milliseconds + } + + if {[llength $args] > 0} then { + eval lappend localArgs $args + } + + # + # NOTE: Attempt to perform the actual HTTP request. This can fail + # in an almost unlimited number of ways, which is fun. + # + set token [eval ::http::geturl [list $uri] $localArgs] + + # + # NOTE: Grab the HTTP status. It must be "ok" in order to proceed. + # + set status [::http::status $token] + + if {$status ne "ok"} then { + error [appendArgs \ + "bad HTTP status \"" $status "\" is not \"ok\""] + } # # NOTE: Grab the HTTP response code and data now as they are needed # in almost all cases. # Index: client/1.0/neutral/common.tcl.asc ================================================================== --- client/1.0/neutral/common.tcl.asc +++ client/1.0/neutral/common.tcl.asc @@ -1,17 +1,18 @@ -----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 Comment: Eagle Package Repository -iQIzBAABCAAdFiEEw8dROIPu3TrtH+QlUCyWr0ldwtkFAl871kkAC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