Skip to content
Prev Previous commit
Next Next commit
http: don't cork .end when not needed
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
commit 25a3204fe29a8470f5a90a6bf424059757a09363
3 changes: 2 additions & 1 deletion lib/_http_outgoing.js
Original file line number Diff line number Diff line change
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