Browse Source

http: use writev on chunked encoding

Now will process all write() that were done on a single tick in a single
writev().
v0.11.11-release
Trevor Norris 11 years ago
parent
commit
2eddd74112
  1. 10
      lib/_http_outgoing.js

10
lib/_http_outgoing.js

@ -438,14 +438,18 @@ OutgoingMessage.prototype.write = function(chunk, encoding, callback) {
else else
len = chunk.length; len = chunk.length;
if (this.connection) if (this.connection && !this.connection.corked) {
this.connection.cork(); this.connection.cork();
var conn = this.connection;
process.nextTick(function connectionCork() {
if (conn)
conn.uncork();
});
}
this._send(len.toString(16), 'binary', null); this._send(len.toString(16), 'binary', null);
this._send(crlf_buf, null, null); this._send(crlf_buf, null, null);
this._send(chunk, encoding, null); this._send(chunk, encoding, null);
ret = this._send(crlf_buf, null, callback); ret = this._send(crlf_buf, null, callback);
if (this.connection)
this.connection.uncork();
} }
} else { } else {
ret = this._send(chunk, encoding, callback); ret = this._send(chunk, encoding, callback);

Loading…
Cancel
Save