From f58ce945a4e26120144a0f0ba472292eaec39f2e Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Fri, 7 Nov 2025 10:49:35 +0000 Subject: [PATCH] Remove redundant node:http compression check from Zig code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set compression: false directly in the node:http JS code instead of checking onNodeHTTPRequest in Zig. This is simpler and follows the pattern of setting it at the source. Since compression is opt-in by default (false), this also removes unnecessary special-case logic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/bun.js/api/server.zig | 5 +---- src/js/node/_http_server.ts | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 7ff49f780b..ab5f6e00a5 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -1678,10 +1678,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d server.request_pool_allocator = RequestContext.pool.?; // Transfer compression config from ServerConfig to Server - // Disable if onNodeHTTPRequest is set (node:http compatibility) - server.compression_config = if (!config.onNodeHTTPRequest.isEmptyOrUndefinedOrNull()) - null // node:http: always disable compression - else if (config.compression_config_from_js) |comp_config| switch (comp_config) { + server.compression_config = if (config.compression_config_from_js) |comp_config| switch (comp_config) { .use_default => brk: { const default_config = bun.handleOom(bun.default_allocator.create(bun.http.CompressionConfig)); default_config.* = bun.http.CompressionConfig.DEFAULT; diff --git a/src/js/node/_http_server.ts b/src/js/node/_http_server.ts index e40bb70bb5..61c2b227dc 100644 --- a/src/js/node/_http_server.ts +++ b/src/js/node/_http_server.ts @@ -477,6 +477,7 @@ Server.prototype[kRealListen] = function (tls, port, host, socketPath, reusePort } this[serverSymbol] = Bun.serve({ idleTimeout: 0, // nodejs dont have a idleTimeout by default + compression: false, // node:http doesn't support auto-compression tls, port, hostname: host,