Posted to tcl by mjanssen at Sat Aug 15 12:12:38 GMT 2009view raw

  1. proc downurl {url {token {}}} {
  2. if {$token eq {}} {
  3. http::geturl $url -command [list downurl $url]
  4. return
  5. }
  6. if {[http::ncode $token] == 302} {
  7. puts "handle redirect to [dict get [http::meta $token] Location] by calling downlurl again"
  8. downurl [dict get [http::meta $token] Location]
  9. } else {
  10. puts "no redirect"
  11. parray $token
  12. }
  13. http::cleanup $token
  14. }