-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Description
Version
17.4.0
Platform
Windows 10
Subsystem
No response
What steps will reproduce the bug?
An insecure socket server is created as:
const connect = function (socket) {},
server = net.createServer();
server.listen({
port: 80
}, listener);
server.on("connection", connect);
A secure socket server is created as:
const connect = function (socket) {},
server = tls.createServer({
cert: "string",
key: "string"
}, connect);
server.listen({
port: 443
}, listener);
The major difference is where I put the connect
event handler for the "connection" event. I can execute a TLS server with the same pattern as the insecure server and the connect
handler will fire, but the socket passed into the connect
handler will never execute data events or error events. You can console.log that socket, but it is effectively mute. This is impossible to troubleshoot and no feedback is provided.
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior?
There is a choice of resolutions:
- Throw on assignment to the
connection
event of a TLS server, eg:server.on("connection", connect);
- Fully support sockets created by an assigned connection handler.
What do you see instead?
Nothing. When this error is encountered I can see the handler for the connection event fire and I can console.log the socket passed into that handler, but all events assigned to that socket are ignored and there is no feedback of any kind. Problematic code example:
const connect = function (socket) {},
server = tls.createServer();
server.listen({
port: 80
}, listener);
server.on("connection", connect);
Additional information
No response