getturl bug?

Dos http::geturl methods with channel option has bug in it?

Test this. The file downloaded has extra stuff in it at the top and the end:

package req Tk package req http

proc test {} { set url " "

set chan open "downloaded" w

set token ::http::geturl $url -channel $chan

if {$token == ""} {

 close $chan

} else {

  flush $chan
  close $chan
  http::cleanup $token


puts "open downloaded in editor"