This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Read https website

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Read https website

Post by CrazyCat »

Hello there,

I'm in trouble with a short code I did. It fetches info from a website, but the website is now in https and I cannot connect anymore with my script.

Here is what I did:

Code: Select all

set website "https://my.website.com"
package require http
package require tls
set agent "Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"
http::register https 443 [list ::tls::socket -tls1 1]

proc get {} {
   set httpconfig [::http::config -useragent $::agent]
   set tok [::http::geturl $::website/index.php]
}
And I always get:

Code: Select all

Currently: error reading "sock8": software caused connection abort
Currently:     while executing
Currently: "::http::geturl $::website/index.php"
Currently:     (procedure "get" line 28)
I'd tried different settings for the register https, but no one is working. The ssl cerrtificat is coming from cloudflare.

Any idea ?
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

try with:

Code: Select all

http::register https 443 ::tls::socket 
instead of

Code: Select all

http::register https 443 [list ::tls::socket -tls1 1] 
Once the game is over, the king and the pawn go back in the same box.
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Idem:

Code: Select all

Currently: error reading "sock10": software caused connection abort
Currently:     while executing
Currently: "::http::geturl $::website/index.php"
Currently:     (procedure "get" line 3)
Currently:     invoked from within
Currently: "get"
My source:

Code: Select all

package require http
package require tls
variable agent "Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"

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

proc get {} {
   set httpconfig [::http::config -useragent $::agent]
   set tok [::http::geturl $::website/index.php]
}
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

I'm just tested on wish. it is works.

http://i.imgur.com/tdaX17R.png

I don't think this issue caused tls::socket looks working good with

Code: Select all

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

Code: Select all

http::register https 443 ::tls::socket
Must be something else , but I didn't understand what goes wrong...
Life iS Just a dReaM oN tHE wAy to DeaTh
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

CrazyCat you've tried only with your website?
Why not try twitter as did heartbroken to see if you can connect?
Maybe it's the problem of your website...
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I think it's a cloudflare trouble.
Here's a lynx' dump:

Code: Select all

Connexion HTTPS à my.website.com
TCP: Error 115 in `SOCKET_ERRNO' after call to this socket's first connect() failed.
        Opération maintenant en cours
TCP: Error 115 in `SOCKET_ERRNO' after call to this socket's first select() failed.
        Opération maintenant en cours
HTGetSSLHandle: certfile is set to /etc/ssl/certs/ca-certificates.crt by config SSL_CERT_FILE
->:+VERS-SSL3.0:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0
->:+AES-256-GCM:+AES-128-GCM:+AES-256-CBC:+AES-128-CBC:+CAMELLIA-256-CBC:+CAMELLIA-128-CBC:+3DES-CBC
->:+COMP-NULL
->:+DHE-RSA:+RSA:+DHE-DSS
->:+SHA1:+MD5
set priorities NONE:+VERS-SSL3.0:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:+AES-256-GCM:+AES-128-GCM:+AES-256-CBC:+AES-128-CBC:+CAMELLIA-256-CBC:+CAMELLIA-128-CBC:+3DES-CBC:+COMP-NULL:+DHE-RSA:+RSA:+DHE-DSS:+SHA1:+MD5
CHECK 0:NONE:+VERS-SSL3.0:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:+AES-256-GCM:+AES-128-GCM:+AES-256-CBC:+AES-128-CBC:+CAMELLIA-256-CBC:+CAMELLIA-128-CBC:+3DES-CBC:+COMP-NULL:+DHE-RSA:+RSA:+DHE-DSS:+SHA1:+MD5
(...)
...called gnutls_server_name_set(my.website.com) ->0
HTTP: Unable to complete SSL handshake for 'https://my.website.com/', SSL_connect=0, SSL error stack dump follows
HTTP: SSL: A TLS fatal alert has been received.

Alert!: Unable to make secure connection to remote host.
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Seems to be a SNI trouble.

I'd seen http://sourceforge.net/p/tls/patches/12/ but it doesn't work with the tls package. Tryed -sni and -servername options...
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

I made couple of tests to see how Works with other https sites whoever using cloudflare service.

I found a list of websites at cloudflare's document pages.

( to be honest ,first i thought maybe this problem caused build link between your site to cloudflare. but...)

in my tests i've seen that i can get data from some https sites :
(all of these websites are using this cloudflare service.these are listed in cloudflare site.)

http://i.imgur.com/sLeCqef.png
sometimes its been success but sometimes it fails and returns tls sock error:

http://i.imgur.com/JP57c6T.png

as far as i know that tcl-tls package still has bugs and Tcl guys (aku "Andreas Kupries" especially) working on these bug reports.

They were bumb tls version to 1.6.5 ,
four weeks ago in their cvs :
http://tls.cvs.sourceforge.net/viewvc/tls/tls/

but they didn't released this officially yet.

I think they are waiting to fix all reported bugs to release this new version.

so maybe you better wait until they are done with this new fixed version of tls.

You could get further information at freenode #tcl channel about this issue.
ofcourse they know better .
Life iS Just a dReaM oN tHE wAy to DeaTh
b
bugme
Voice
Posts: 6
Joined: Fri Jan 13, 2017 9:49 am

Post by bugme »

SNI trouble can be fixed as described in a wiki https://wiki.tcl.tk/2630
Post Reply