http.IncomingMessage doesn't fire callback on 'timeout'

  • Version:14.3.0
  • Platform:
  • Subsystem:

What steps will reproduce the bug?

Source code from lib/_http_incoming.js:

IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
  if (callback)
    this.on('timeout', callback);
  this.socket.setTimeout(msecs);
  return this;
};

IncomingMessage doesn't emit 'timeout' so callback will never be fired

How often does it reproduce? Is there a required condition?

What is the expected behavior?

IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
   this.socket.setTimeout(msecs,callback);
  return this;
};

EDIT(trivikr): put code in a code block