Posted to tcl by aspect at Sun Oct 18 06:42:42 GMT 2015view pretty
# Tcl: 8.6.4 # http: 2.8.9 # tls: 1.6.7 (OpenSSL 1.0.2d 9 Jul 2015) # Fetching https://google.com/ ... # OK! 261 bytes # Fetching https://1337x.to/ ... # ERROR: error flushing "sock24ad900": connection reset by peer # Fetching https://google.com/ ... # OK! 261 bytes puts "Tcl: [package require Tcl]" puts "http: [package require http]" puts "tls: [package require tls] ([tls::version])" http::register https 443 tls::socket # if this is omitted, the message appears on stderr during the next request *after* 1337x.to: # SSL channel "sock1829830": error: tlsv1 alert internal error ::tls::init -command ::tls_cb proc tls_cb {what args} { #puts "TLS: $what $args" return 1 ;# cert OK, for "verify" } # wrapper with error handling proc fetch {url} { puts "Fetching $url ..." try { set t [::http::geturl $url] set d [::http::data $t] ::http::cleanup $t puts "OK! [string length $d] bytes" } on error {e o} { puts "ERROR: $e" } } fetch https://google.com/ ;# this succeeds fetch https://1337x.to/ ;# this fails fetch https://google.com/ ;# then a (harmless?) error is emitted here