Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/_http_incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,14 @@ IncomingMessage.prototype._dump = function _dump() {
// If there is buffered data, it may trigger 'data' events.
// Remove 'data' event listeners explicitly.
this.removeAllListeners('data');
this.resume();
if (this.complete && !this.destroyed && this.readableLength === 0) {
// The message was fully received and never read: there is nothing to
// pull off the wire. Go straight to the 'end' emission instead of
// paying for the resume() and flow() scheduling machinery.
this.read(0);
} else {
this.resume();
}
}
};

Expand Down
Loading