Remove redundant node:http compression check from Zig code

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 <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-11-07 10:49:35 +00:00
parent 4b6f043c78
commit f58ce945a4
2 changed files with 2 additions and 4 deletions

View File

@@ -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;

View File

@@ -477,6 +477,7 @@ Server.prototype[kRealListen] = function (tls, port, host, socketPath, reusePort
}
this[serverSymbol] = Bun.serve<any>({
idleTimeout: 0, // nodejs dont have a idleTimeout by default
compression: false, // node:http doesn't support auto-compression
tls,
port,
hostname: host,