summaryrefslogtreecommitdiff
path: root/lib/_http_outgoing.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2018-01-23 15:23:33 -0500
committerFedor Indutny <fedor@indutny.com>2018-01-27 00:46:21 -0500
commitf29c2cbec59c5e08a25689b81093107604f8f9ef (patch)
treee5990e267837cdd59d7ab6524d5dd29740cc2c25 /lib/_http_outgoing.js
parent287f21e31dafce2cf10fc7e349dbd26ebb392a08 (diff)
downloadandroid-node-v8-f29c2cbec59c5e08a25689b81093107604f8f9ef.tar.gz
android-node-v8-f29c2cbec59c5e08a25689b81093107604f8f9ef.tar.bz2
android-node-v8-f29c2cbec59c5e08a25689b81093107604f8f9ef.zip
http: there is no `corked` property of `stream`
Do not check/use unexistent property, use `OutgoingMessage` instead. PR-URL: https://github.com/nodejs/node/pull/18325 Reviewed-By: Mithun Sasidharan <mithunsasidharan89@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/_http_outgoing.js')
-rw-r--r--lib/_http_outgoing.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js
index 5f4e8e2cf1..425cfbcc29 100644
--- a/lib/_http_outgoing.js
+++ b/lib/_http_outgoing.js
@@ -38,6 +38,8 @@ const errors = require('internal/errors');
const { CRLF, debug } = common;
const { utcDate } = internalHttp;
+const kIsCorked = Symbol('isCorked');
+
var RE_FIELDS =
/^(?:Connection|Transfer-Encoding|Content-Length|Date|Expect|Trailer|Upgrade)$/i;
var RE_CONN_VALUES = /(?:^|\W)close|upgrade(?:$|\W)/ig;
@@ -99,6 +101,7 @@ function OutgoingMessage() {
this.finished = false;
this._headerSent = false;
+ this[kIsCorked] = false;
this.socket = null;
this.connection = null;
@@ -648,9 +651,10 @@ 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) {
+ if (!fromEnd && msg.connection && !msg[kIsCorked]) {
msg.connection.cork();
- process.nextTick(connectionCorkNT, msg.connection);
+ msg[kIsCorked] = true;
+ process.nextTick(connectionCorkNT, msg, msg.connection);
}
var len, ret;
@@ -679,7 +683,8 @@ function writeAfterEndNT(err, callback) {
}
-function connectionCorkNT(conn) {
+function connectionCorkNT(msg, conn) {
+ msg[kIsCorked] = false;
conn.uncork();
}