You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When taking the example code, google.com works fine, though sites such as github.com or wikipedia.org don't work reporting Unsupported protocol version.
This is the code I am testing with
constnet=require('net')constforge=require('node-forge')varsocket=newnet.Socket();varclient=forge.tls.createConnection({server: false,verify: function(connection,verified,depth,certs){// skip verification for testingconsole.log('[tls] server certificate verified');returntrue;},connected: function(connection){console.log('[tls] connected');// prepare some data to send (note that the string is interpreted as// 'binary' encoded, which works for HTTP which only uses ASCII, use// forge.util.encodeUtf8(str) otherwiseclient.prepare('GET / HTTP/1.1\r\nHost: www.github.com\r\n\r\n');},tlsDataReady: function(connection){// encrypted data is ready to be sent to the servervardata=connection.tlsData.getBytes();socket.write(data,'binary');// encoding should be 'binary'},dataReady: function(connection){// clear data from the server is readyvardata=connection.data.getBytes();console.log('[tls] data received from the server: '+data);},closed: function(){console.log('[tls] disconnected');},error: function(connection,error){console.log('[tls] error',error);}});socket.on('connect',function(){console.log('[socket] connected');client.handshake();});socket.on('data',function(data){client.process(data.toString('binary'));// encoding should be 'binary'});socket.on('end',function(){console.log('[socket] disconnected');});// connect to google.comsocket.connect(443,'www.github.com');// or connect to gmail's imap server (but don't send the HTTP header above)//socket.connect(993, 'imap.gmail.com');
The text was updated successfully, but these errors were encountered:
When taking the example code, google.com works fine, though sites such as github.com or wikipedia.org don't work reporting
Unsupported protocol version.
This is the code I am testing with
The text was updated successfully, but these errors were encountered: