Skip to content

Commit 7fc395a

Browse files
indutnyevanlucas
authored andcommitted
http: there is no corked property of stream
Do not check/use unexistent property, use `OutgoingMessage` instead. PR-URL: #18325 Reviewed-By: Mithun Sasidharan <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d829237 commit 7fc395a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/_http_outgoing.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const errors = require('internal/errors');
3838
const { CRLF, debug } = common;
3939
const { utcDate } = internalHttp;
4040

41+
const kIsCorked = Symbol('isCorked');
42+
4143
var RE_FIELDS =
4244
/^(?:Connection|Transfer-Encoding|Content-Length|Date|Expect|Trailer|Upgrade)$/i;
4345
var RE_CONN_VALUES = /(?:^|\W)close|upgrade(?:$|\W)/ig;
@@ -99,6 +101,7 @@ function OutgoingMessage() {
99101

100102
this.finished = false;
101103
this._headerSent = false;
104+
this[kIsCorked] = false;
102105

103106
this.socket = null;
104107
this.connection = null;
@@ -657,9 +660,10 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
657660
// signal the user to keep writing.
658661
if (chunk.length === 0) return true;
659662

660-
if (!fromEnd && msg.connection && !msg.connection.corked) {
663+
if (!fromEnd && msg.connection && !msg[kIsCorked]) {
661664
msg.connection.cork();
662-
process.nextTick(connectionCorkNT, msg.connection);
665+
msg[kIsCorked] = true;
666+
process.nextTick(connectionCorkNT, msg, msg.connection);
663667
}
664668

665669
var len, ret;
@@ -688,7 +692,8 @@ function writeAfterEndNT(err, callback) {
688692
}
689693

690694

691-
function connectionCorkNT(conn) {
695+
function connectionCorkNT(msg, conn) {
696+
msg[kIsCorked] = false;
692697
conn.uncork();
693698
}
694699

0 commit comments

Comments
 (0)