From 21e15c1c735b22c50ccf2c20f920f0e6bd0aad89 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Thu, 12 Oct 2023 23:18:39 +0200 Subject: [PATCH] fixup --- lib/_http_outgoing.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index db711788972270..b248521150ba25 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -966,13 +966,12 @@ function write_(msg, chunk, encoding, callback, fromEnd) { let ret; if (msg.chunkedEncoding && chunk.length !== 0) { + len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength; if (msg[kCorked] && msg._headerSent) { - len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength; msg[kChunkedBuffer].push(chunk, encoding, callback); msg[kChunkedLength] += len; ret = msg[kChunkedLength] < msg[kHighWaterMark]; } else { - len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength; msg._send(NumberPrototypeToString(len, 16), 'latin1', null); msg._send(crlf_buf, null, null); msg._send(chunk, encoding, null, len);