Skip to content

TLS Server Interface Buf #41880

@prettydiff

Description

@prettydiff

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:

  1. Throw on assignment to the connection event of a TLS server, eg: server.on("connection", connect);
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    tlsIssues and PRs related to the tls subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions