Skip to content

Commit

Permalink
http: don't cork .end when not needed
Browse files Browse the repository at this point in the history
PR-URL: #36633
Backport-PR-URL: #36940
Fixes: #36620
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
  • Loading branch information
mitsos1os authored and BethGriggs committed Jan 28, 2021
1 parent c03cddb commit 25a3204
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/_http_outgoing.js
Expand Up @@ -775,7 +775,8 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
encoding = null;
}

if (this.socket) {
// Not finished, socket exists and data will be written (chunk or header)
if (this.socket && !this.finished && (chunk || !this._header)) {
this.socket.cork();
}

Expand Down

0 comments on commit 25a3204

Please sign in to comment.