2009-04-24 Jeff Hobbs <jeffh@ActiveState.com>
+ * tkcon.tcl (::tkcon::Retrieve): support http code redirect for
+ downloading latest version. [Bug 1755500]
+
* README.txt, docs/limits.html, docs/nontcl.html: bump to 2.6
* pkgIndex.tcl, tkcon.tcl: Use Tcl 8.4 code style.
::http::wait $token
set code [catch {
set ncode [::http::ncode $token]
+ set i 0
+ while {(($ncode >= 301) && ($ncode <= 307)) && [incr i] < 5} {
+ # redirect to meta Location
+ array set meta [::http::meta $token]
+ ::http::cleanup $token
+ if {![info exists meta(Location)]} { break }
+ set url $meta(Location)
+ if {![string match "http*" $url]
+ && [regexp {https?://[^/]+} $PRIV(HEADURL) srvr]} {
+ # attach the same http server info
+ set url $srvr/$url
+ }
+ set token [::http::geturl $url -headers $headers -timeout 30000]
+ ::http::wait $token
+ set ncode [::http::ncode $token]
+ }
if {$ncode != 200} {
return "expected http return code 200, received $ncode"
}