http: clear chunked state before invoking callbacks

Fixes a possible case where the chunked state is lost
if updated through callback.
This commit is contained in:
Robert Nagy committed 2024-03-01 15:20:14 +01:00
1 parent 8a41d9b636
commit 487b7cbe0c
1 file changed
+3 -3
+3 -3
View File
@@ -336,6 +336,9 @@ OutgoingMessage.prototype.uncork = function() {
const len = this[kChunkedLength];
const buf = this[kChunkedBuffer];
this[kChunkedBuffer].length = 0;
this[kChunkedLength] = 0;
assert(this.chunkedEncoding);
let callbacks;
@@ -353,9 +356,6 @@ OutgoingMessage.prototype.uncork = function() {
callback(err);
}
} : null);
this[kChunkedBuffer].length = 0;
this[kChunkedLength] = 0;
};
OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {