http server upgrade event

  • Version: 11.0.0, 10.0.0, and probably more
  • Platform: macos
  • Subsystem: http

http server upgrade event:

When the 'upgrade' event is emitted, the http server doesn't unregister the 'timeout' handler (function socketOnTimeout).

If a timeout event occurs later, the http server code will destroy the socket.

workaround:

server.on("upgrade", (req,socket,head) => {
socket.removeAllListeners("timeout");
socket.setTimeout(0);
...
});