From 30860abddbba8b83f4a103492a003619485fd244 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 18 Dec 2025 22:42:49 +0000 Subject: [PATCH] Add compression method name lookup in TLS parser Resolves two TODO comments by implementing a compression method lookup table similar to the existing cipher suites and extensions lookups. Now displays human-readable names (null, DEFLATE, LZS) instead of raw numeric values when parsing TLS compression methods. Changes: - Added COMPRESSION_METHODS_LOOKUP constant with standard TLS compression methods - Updated parseServerHello to use lookup for compression method display - Updated parseCompressionMethods to use lookup for compression method display --- src/core/lib/TLS.mjs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/lib/TLS.mjs b/src/core/lib/TLS.mjs index 6373bfa2..dda3d4c2 100644 --- a/src/core/lib/TLS.mjs +++ b/src/core/lib/TLS.mjs @@ -247,7 +247,7 @@ function parseServerHello(s, b, h) { description: "Selected Compression Method", length: 1, data: b.getBytes(1), - value: s.readInt(1) // TODO: Compression method name here + value: COMPRESSION_METHODS_LOOKUP[s.readInt(1)] || "Unknown" }; // Extensions Length @@ -303,7 +303,7 @@ function parseCompressionMethods(bytes) { description: "Compression Method", length: 1, data: b.getBytes(1), - value: s.readInt(1) // TODO: Compression method name here + value: COMPRESSION_METHODS_LOOKUP[s.readInt(1)] || "Unknown" }); } return cm; @@ -836,6 +836,15 @@ export const GREASE_VALUES = [ 0xfafa ]; +/** + * Compression methods lookup table + */ +const COMPRESSION_METHODS_LOOKUP = { + 0: "null", + 1: "DEFLATE", + 64: "LZS" +}; + /** * Parses the supported_versions extension and returns the highest supported version. * @param {Uint8Array} bytes