diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index e3a032ad21273b..c8a393ddcf31b4 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -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(); }