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

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