summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2017-06-07 11:25:24 -0400
committerBrian White <mscdex@mscdex.net>2017-06-12 20:42:46 -0400
commitc4fc7d90eddbdb23d814a38192e6979f8fc285a7 (patch)
tree397aa47668cbd44da57d93428076733ae78cd3ac /lib
parent77d575d0057692413f0c26ad90425077c40f339f (diff)
downloadandroid-node-v8-c4fc7d90eddbdb23d814a38192e6979f8fc285a7.tar.gz
android-node-v8-c4fc7d90eddbdb23d814a38192e6979f8fc285a7.tar.bz2
android-node-v8-c4fc7d90eddbdb23d814a38192e6979f8fc285a7.zip
http: always cork outgoing writes
PR-URL: https://github.com/nodejs/node/pull/13522 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/_http_outgoing.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js
index 84aa57151f..b3706d5a9e 100644
--- a/lib/_http_outgoing.js
+++ b/lib/_http_outgoing.js
@@ -660,6 +660,11 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
// signal the user to keep writing.
if (chunk.length === 0) return true;
+ if (!fromEnd && msg.connection && !msg.connection.corked) {
+ msg.connection.cork();
+ process.nextTick(connectionCorkNT, msg.connection);
+ }
+
var len, ret;
if (msg.chunkedEncoding) {
if (typeof chunk === 'string')
@@ -667,11 +672,6 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
else
len = chunk.length;
- if (msg.connection && !msg.connection.corked) {
- msg.connection.cork();
- process.nextTick(connectionCorkNT, msg.connection);
- }
-
msg._send(len.toString(16), 'latin1', null);
msg._send(crlf_buf, null, null);
msg._send(chunk, encoding, null);