From fc4e766e97c2d3571e845d017784df99d8e450b6 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Sat, 2 Mar 2024 16:12:56 +0100 Subject: [PATCH] websocket: remove dead code in parseCloseBody (#2902) --- lib/web/websocket/receiver.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/web/websocket/receiver.js b/lib/web/websocket/receiver.js index 18dc474f16e..eff9aea569f 100644 --- a/lib/web/websocket/receiver.js +++ b/lib/web/websocket/receiver.js @@ -102,7 +102,7 @@ class ByteParser extends Writable { const body = this.consume(payloadLength) - this.#info.closeInfo = this.parseCloseBody(false, body) + this.#info.closeInfo = this.parseCloseBody(body) if (!this.ws[kSentClose]) { // If an endpoint receives a Close frame and did not previously send a @@ -290,7 +290,7 @@ class ByteParser extends Writable { return buffer } - parseCloseBody (onlyCode, data) { + parseCloseBody (data) { // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5 /** @type {number|undefined} */ let code @@ -302,14 +302,6 @@ class ByteParser extends Writable { code = data.readUInt16BE(0) } - if (onlyCode) { - if (!isValidStatusCode(code)) { - return null - } - - return { code } - } - // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6 /** @type {Buffer} */ let reason = data.subarray(2)