I have the following Javascript code which shows a different behaviour
depending on whether you run it against a HTTP or HTTPS endpoint.
* var url=require('url').parse('https://anyserver'); // Change here
to http to reproduce the difference var
secure=url.protocol.indexOf('https')===0; var socket=new
require('net').Socket(); socket.setTimeout(2000, function()
{ this.destroy(); console.log('TCP connection
timed out'); }); socket.connect({ host: url.hostname, port:
url.port || (secure?443:80) }, function() { if
(secure) { require('tls').connect({
socket: this, rejectUnauthorized: false, servername: url.hostname },
function() {
this.destroy(); console.log('SSL
successfully connected'); }).on('error',
function(error){
this.destroy(); console.log('Error during
SSL handshake'); }); }
else {
this.destroy(); console.log('Non-SSL successfully
connected'); } }).on('error', function(error)
{ this.destroy(); console.log('Error during
TCP connection '+error.code); }); // Just a dummy listener to
keep node from exiting require('http').createServer().listen(2000);*
Everything is fine in the case of a regular HTTP connection, however
switching to HTTPS the timeout handler will be called regardless.
>From what I debugged it might happen because I am not closing the socket
itself but the TLS wrapper socket object. Could this be the reason or could
it be a bug in the library (it started happening only recently after the
upgrade from 0.10 to 0.12).
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/e21d21a9-98f6-4918-a925-a3c7b27dc6d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.