Skip to content

Commit 2552520

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

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;
@@ -648,9 +651,10 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
648651
// signal the user to keep writing.
649652
if (chunk.length === 0) return true;
650653

651-
if (!fromEnd && msg.connection && !msg.connection.corked) {
654+
if (!fromEnd && msg.connection && !msg[kIsCorked]) {
652655
msg.connection.cork();
653-
process.nextTick(connectionCorkNT, msg.connection);
656+
msg[kIsCorked] = true;
657+
process.nextTick(connectionCorkNT, msg, msg.connection);
654658
}
655659

656660
var len, ret;
@@ -679,7 +683,8 @@ function writeAfterEndNT(err, callback) {
679683
}
680684

681685

682-
function connectionCorkNT(conn) {
686+
function connectionCorkNT(msg, conn) {
687+
msg[kIsCorked] = false;
683688
conn.uncork();
684689
}
685690

0 commit comments

Comments
 (0)