-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Open
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
Description
- Version: v6.9.4, v7.4.0
- Platform: Linux pc 4.2.0-30-generic docs: re-word project messaging #36-Ubuntu SMP Fri Feb 26 00:58:07 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: net, tls
When wrapping an existing socket with tls, the socket's 'end' event is not called if the socket was already connected.
Example:
In this case 'end' will be called:
var Socket = require('net').Socket;
var tls = require('tls');
var HOST = 'www.google.com';
var socket = new Socket();
var tlsOptions = {
host: HOST,
socket: socket
};
socket.on('close', function() { console.log('close'); });
socket.on('end', function() { console.log('end'); });
var tlsSocket = tls.connect(tlsOptions, function() {
console.log('connected');
tlsSocket.end();
});
socket.connect({
port: 443,
host: HOST
});
In this case 'end' will not be called:
var Socket = require('net').Socket;
var tls = require('tls');
var HOST = 'www.google.com';
var socket = new Socket();
var tlsOptions = {
host: HOST,
socket: socket
};
socket.on('close', function() { console.log('close'); });
socket.on('end', function() { console.log('end'); });
socket.connect({
port: 443,
host: HOST
});
var tlsSocket = tls.connect(tlsOptions, function() {
console.log('connected');
tlsSocket.end();
});
natasky, gramakri and hpx7
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.