Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem requesting a HTTPS with TCL

Tags:

https

tcl

I'm trying to do the following request using TCL (OpenACS)

http::register https 443 tls::socket

set url "https://encrypted.google.com"

set token [http::geturl $url -timeout 30000]

set status [http::status $token]
set answer [http::data $token]

http::cleanup $token
http::unregister https

The problem is that when I read the $status variable I get "eof" and the $answer variable becomes empty. I tried enabling tls V.1

http::register https 443 [list tls::socket -tls1 1]

and it works only for the site https://www.galileo.edu, but not for https://encrypted.google.com.

The site what I'm trying to connect is https://graph.facebook.com/me/feed?access_token=... but it doesn't work.

I used curl to retrieve the contents of the pages in HTTPS and it works, I have installed OpenSSL, so I can't see the problem, there is another way to do HTTPS connections with TCL?.

I can't see if this is a problem of coding (maybe I'm registered wrong the https protocol) or maybe It is a bad configuration of my server. Hope somebody helps!! Thanks!

like image 771
javiertoledos Avatar asked Sep 28 '26 04:09

javiertoledos


1 Answers

Hmm, I can't reproduce that. Which patchlevel of Tcl are you using, and which version of the tls package?

I did this:

package require http
package require tls

# This is your code, cut-n-pasted with blank lines removed
http::register https 443 tls::socket
set url "https://encrypted.google.com"
set token [http::geturl $url -timeout 30000]
set status [http::status $token]
set answer [http::data $token]
http::cleanup $token
http::unregister https

puts $status

And it produces “ok” as output, with $status's contents looking likely too (but too long to paste here). This is with Tcl 8.5.2 (I know I need to upgrade), http 2.7 and tls 1.6.

like image 98
Donal Fellows Avatar answered Oct 01 '26 05:10

Donal Fellows



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!