diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 7bf8d563e55455..dd78ddf645f1e5 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -157,10 +157,12 @@ OutgoingMessage.prototype._writeRaw = function(data, encoding, callback) { var output = this.output; var outputEncodings = this.outputEncodings; var outputCallbacks = this.outputCallbacks; + connection.cork(); for (var i = 0; i < outputLength; i++) { connection.write(output[i], outputEncodings[i], outputCallbacks[i]); } + connection.uncork(); this.output = []; this.outputEncodings = []; @@ -637,10 +639,12 @@ OutgoingMessage.prototype._flush = function() { var output = this.output; var outputEncodings = this.outputEncodings; var outputCallbacks = this.outputCallbacks; + socket.cork(); for (var i = 0; i < outputLength; i++) { ret = socket.write(output[i], outputEncodings[i], outputCallbacks[i]); } + socket.uncork(); this.output = []; this.outputEncodings = [];