diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 055f6491b37..8edc8666def 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -413,9 +413,15 @@ OutgoingMessage.prototype.write = function(chunk, encoding) { } else { // buffer, or a non-toString-friendly encoding len = chunk.length; - this._send(len.toString(16) + CRLF); - this._send(chunk, encoding); - ret = this._send(CRLF); + + if (this.connection) + this.connection.cork(); + this._send(len.toString(16)); + this._send(crlf_buf); + this._send(chunk); + ret = this._send(crlf_buf); + if (this.connection) + this.connection.uncork(); } } else { ret = this._send(chunk, encoding);