Posted to tcl by aspect at Sun Oct 18 04:03:44 GMT 2015view raw
- puts "Tcl: [package require Tcl]"
- puts "tls: [package require tls]"
- puts "http: [package require http]"
- http::register https 443 tls::socket
- # makes no difference in my env ...
- # ::tls::init -tls1 0 -tls1.2 1 -tls1.1 0 -ssl3 0 -ssl2 0
- proc pdict {d} {
- array set {} $d
- parray {}
- }
- proc fetch {url} {
- puts "Fetching $url ..."
- try {
- set t [::http::geturl $url]
- set l [string length [::http::data $t]]
- ::http::cleanup $t
- puts "OK! $l bytes"
- } on error {e o} {
- puts "ERROR: $e"
- pdict $o
- puts "CHANS: [chan names]"
- }
- }
- fetch https://google.com/ ;# this succeeds
- fetch https://1337x.to/ ;# this fails
- fetch https://google.com/ ;# then a (harmless?) error is emitted here
- if 0 {
- # annotated output: "-:" = stdout; "#!" = stderr
- -: Tcl: 8.6.4
- -: tls: 1.6.7
- -: http: 2.8.9
- -: Fetching https://google.com/ ...
- -: OK! 261 bytes
- -: Fetching https://1337x.to/ ...
- -: ERROR: error flushing "sock1d18440": connection reset by peer
- -: (-code) = 1
- -: (-errorcode) = NONE
- -: (-errorinfo) = error flushing "sock1d18440": connection reset by peer
- -: while executing
- -: "::http::geturl $url"
- -: (-errorline) = 4
- -: (-errorstack) = INNER {invokeStk1 ::http::geturl https://1337x.to/} CALL {fetch https://1337x.to/}
- -: (-level) = 0
- -: CHANS: stdin stdout stderr
- -: Fetching https://google.com/ ...
- #! SSL channel "socka20440": error: tlsv1 alert internal error
- -: OK! 261 bytes
- }