Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 2eddd74

Browse files
committed
http: use writev on chunked encoding
Now will process all write() that were done on a single tick in a single writev().
1 parent 82c2084 commit 2eddd74

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/_http_outgoing.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,18 @@ OutgoingMessage.prototype.write = function(chunk, encoding, callback) {
438438
else
439439
len = chunk.length;
440440

441-
if (this.connection)
441+
if (this.connection && !this.connection.corked) {
442442
this.connection.cork();
443+
var conn = this.connection;
444+
process.nextTick(function connectionCork() {
445+
if (conn)
446+
conn.uncork();
447+
});
448+
}
443449
this._send(len.toString(16), 'binary', null);
444450
this._send(crlf_buf, null, null);
445451
this._send(chunk, encoding, null);
446452
ret = this._send(crlf_buf, null, callback);
447-
if (this.connection)
448-
this.connection.uncork();
449453
}
450454
} else {
451455
ret = this._send(chunk, encoding, callback);

0 commit comments

Comments
 (0)