http: don't cork .end when not needed

PR-URL: https://github.com/nodejs/node/pull/36633
Backport-PR-URL: https://github.com/nodejs/node/pull/36940
Fixes: https://github.com/nodejs/node/issues/36620
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
This commit is contained in:
Dimitris Halatsis authored and Beth Griggs committed 2021-01-28 17:56:03 +00:00
1 parent c03cddb46f
commit 25a3204fe2
1 file changed
+2 -1
+2 -1
View File
@@ -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();
}