I'm trying to make a translator using the Yandex API at https://translate.yandex.net/api/ and I'm encountering some difficulties.
Here is what I am doing :
Code: Select all
.tcl ::http::register https 443 ::tls::socket
Tcl: 443 ::tls::socket
.tcl ::http::geturl "https://translate.yandex.net/api/v1.5/tr.json/translate?key=MY_API_KEY&text=this%20is%20a%20test&lang=fr&format=plain&options=1" -timeout 10000
Tcl: ::http::6242
.tcl http::status ::http::6242
Tcl: ok
.tcl ::http::data ::http::6242
Tcl:
.tcl array get ::http::6242
Tcl: sock sock8 http {} querylength 0 -queryblocksize 8192 state connecting charset iso8859-1 type text/html -binary 1 url https://translate.yandex.net/api/v1.5/tr.json/translate?key=MY_API_KEY&text=this%20is%20a%20test&lang=fr&format=plain&options=1 -keepalive 0 -timeout 10000 socketinfo translate.yandex.net:443 queryoffset 0 binary 0 -strict 1 totalsize 0 -validate 0 -protocol 1.1 connection close -queryprogress {} -headers {} after after#40937 -blocksize 8192 coding {} status ok body {} currentsize 0 meta {} -type application/x-www-form-urlencoded
As you can see, geturl returns the "ok" status but I get no data.
Tests have been made using :
Eggdrop v1.6.21 / Tcl 8.5.3 / http package 2.7.5 / tls package 1.50
Any idea would be greatly appreciated.
Edit : Problem solved, adding -tls1 1 to ::tls::socket parameters did the trick.