diff options
author | 2022-04-03 22:22:22 -0700 | |
---|---|---|
committer | 2022-04-03 22:22:22 -0700 | |
commit | cd28c3ca83aa33d43f29b71990eff6399ffe5f06 (patch) | |
tree | b1fb6cb355517b1590adac587696281df9746564 /src | |
parent | 25533b9e08995c4f36927a1adea855966dfcaa79 (diff) | |
download | bun-cd28c3ca83aa33d43f29b71990eff6399ffe5f06.tar.gz bun-cd28c3ca83aa33d43f29b71990eff6399ffe5f06.tar.zst bun-cd28c3ca83aa33d43f29b71990eff6399ffe5f06.zip |
Omit the `Content-Encoding` header when it was auto decompressed
Diffstat (limited to 'src')
-rw-r--r-- | src/http_client_async.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig index fae3bde31..5210fe39f 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -1018,6 +1018,12 @@ pub fn processResponse(this: *HTTPClient, comptime report_progress: bool, compti if (extremely_verbose) this.gzip_elapsed = gzip_timer.read(); + // if it compressed with this header, it is no longer + if (content_encoding_i < response.headers.len) { + var mutable_headers = std.ArrayListUnmanaged(picohttp.Header){ .items = response.headers, .capacity = response.headers.len }; + _ = mutable_headers.swapRemove(content_encoding_i); + response.headers = mutable_headers.items; + } }, else => {}, } @@ -1108,6 +1114,12 @@ pub fn processResponse(this: *HTTPClient, comptime report_progress: bool, compti if (extremely_verbose) this.gzip_elapsed = gzip_timer.read(); + // if it compressed with this header, it is no longer + if (content_encoding_i < response.headers.len) { + var mutable_headers = std.ArrayListUnmanaged(picohttp.Header){ .items = response.headers, .capacity = response.headers.len }; + _ = mutable_headers.swapRemove(content_encoding_i); + response.headers = mutable_headers.items; + } }, else => {}, } |