diff options
author | 2023-08-30 13:50:09 -0300 | |
---|---|---|
committer | 2023-08-30 13:50:09 -0300 | |
commit | 908018a4df5b03168988993f0b664d9443fca381 (patch) | |
tree | 0050aa856c245713457b5e59c7c3efee2d3c7c77 /src/bun.js | |
parent | f24ca3900400bb41faefb42f426651d5d7e7c2e6 (diff) | |
download | bun-908018a4df5b03168988993f0b664d9443fca381.tar.gz bun-908018a4df5b03168988993f0b664d9443fca381.tar.zst bun-908018a4df5b03168988993f0b664d9443fca381.zip |
fix(http/https) disable decompress on http/https client (#4399)
* disable decompress on http/https module
* make js again
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/webcore/response.zig | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig index a1be53917..9b428ae69 100644 --- a/src/bun.js/webcore/response.zig +++ b/src/bun.js/webcore/response.zig @@ -1163,6 +1163,7 @@ pub const Fetch = struct { fetch_tasklet.http.?.client.disable_timeout = fetch_options.disable_timeout; fetch_tasklet.http.?.client.verbose = fetch_options.verbose; fetch_tasklet.http.?.client.disable_keepalive = fetch_options.disable_keepalive; + fetch_tasklet.http.?.client.disable_decompression = fetch_options.disable_decompression; // we wanna to return after headers are received fetch_tasklet.signal_store.header_progress.store(true, .Monotonic); @@ -1198,6 +1199,7 @@ pub const Fetch = struct { timeout: usize, disable_timeout: bool, disable_keepalive: bool, + disable_decompression: bool, url: ZigURL, verbose: bool = false, redirect_type: FetchRedirect = FetchRedirect.follow, @@ -1353,6 +1355,7 @@ pub const Fetch = struct { }; var disable_timeout = false; var disable_keepalive = false; + var disable_decompression = false; var verbose = script_ctx.log.level.atLeast(.debug); var proxy: ?ZigURL = null; var redirect_type: FetchRedirect = FetchRedirect.follow; @@ -1490,9 +1493,11 @@ pub const Fetch = struct { disable_keepalive = keepalive_value.to(i32) == 0; } } + if (options.get(globalThis, "verbose")) |verb| { verbose = verb.toBoolean(); } + if (options.get(globalThis, "signal")) |signal_arg| { if (signal_arg.as(JSC.WebCore.AbortSignal)) |signal_| { _ = signal_.ref(); @@ -1500,6 +1505,14 @@ pub const Fetch = struct { } } + if (options.get(ctx, "decompress")) |decompress| { + if (decompress.isBoolean()) { + disable_decompression = !decompress.asBoolean(); + } else if (decompress.isNumber()) { + disable_keepalive = decompress.to(i32) == 0; + } + } + if (options.get(globalThis, "proxy")) |proxy_arg| { if (proxy_arg.isString() and proxy_arg.getLength(ctx) > 0) { var href = JSC.URL.hrefFromJS(proxy_arg, globalThis); @@ -1659,6 +1672,7 @@ pub const Fetch = struct { if (options.get(globalThis, "verbose")) |verb| { verbose = verb.toBoolean(); } + if (options.get(globalThis, "signal")) |signal_arg| { if (signal_arg.as(JSC.WebCore.AbortSignal)) |signal_| { _ = signal_.ref(); @@ -1666,6 +1680,14 @@ pub const Fetch = struct { } } + if (options.get(ctx, "decompress")) |decompress| { + if (decompress.isBoolean()) { + disable_decompression = !decompress.asBoolean(); + } else if (decompress.isNumber()) { + disable_keepalive = decompress.to(i32) == 0; + } + } + if (options.getTruthy(globalThis, "proxy")) |proxy_arg| { if (proxy_arg.isString() and proxy_arg.getLength(globalThis) > 0) { var href = JSC.URL.hrefFromJS(proxy_arg, globalThis); @@ -1919,6 +1941,7 @@ pub const Fetch = struct { .timeout = std.time.ns_per_hour, .disable_keepalive = disable_keepalive, .disable_timeout = disable_timeout, + .disable_decompression = disable_decompression, .redirect_type = redirect_type, .verbose = verbose, .proxy = proxy, |