mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 12:29:07 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user