Repository navigation
fix(net): preserve byte ranges in gzip-wrapped file responses - #5612
Open
shizukunacho wants to merge 1 commit into
Open
shizukunacho wants to merge 1 commit into
shizukunacho wants to merge 1 commit into
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Validation: Static review only. Tests were not run under the read-only review restrictions. Reviewed by gpt-6.1-sol · Input: 33 · Output: 2.7K · Cached: 268.9K |
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY
HTTPGzipWrappercompresseshttp.FileServerresponses even when the request containsRange. The file server has already calculatedContent-RangeandContent-Lengthfor the requested file bytes, so compressing the body makes those headers incorrect. This affects thestatic_fileplugin, which uses this wrapper.With a 16-byte file (
0123456789abcdef),Accept-Encoding: gzipandRange: bytes=0-9, the current code returns only the 10-byte gzip header instead of the requested bytes. A multipart range request also fails withunexpected EOF.Pass requests with a
Rangeheader directly to the underlying handler, preserving its byte ranges and length. Full-file requests still support gzip. The regression test uses a real HTTP server and checks single-range and multipart contents, plus compressed and uncompressed full responses. Both range cases fail before the change and pass afterward.Validation on Windows/amd64 with Go 1.26.11:
go test ./pkg/util/net ./pkg/plugin/client -count=1go vet ./pkg/util/net ./pkg/plugin/clientgofmtandgit diff --checkThe full end-to-end suite was not run locally.