Repository navigation
Proxy: don't corrupt non-UTF-8 bodies when scrubbing - #1265
Merged
Merged
Conversation
Response scrubbing decoded text/* bodies as UTF-8 and re-encoded them, so any invalid byte became U+FFFD (Go checksum tiles served as text/plain came back corrupted). Bodies are now handled as latin1 byte strings on both the response and request side. Also keeps headers intact when nothing was scrubbed (HEAD content-length was rewritten to 0) and never rewrites 206 partial bodies. Fixes #1263
Contributor
|
The changes in this PR will be included in the next version bump.
|
Contributor
📦 Bundle size
dist/ only; native binaries are versioned separately and not counted here. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
varlock-website | 86a9029 | Commit Preview URL Branch Preview URL |
Oct 30 2026, 10:11 PM |
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: Reviewed the byte-handling changes, response metadata behavior, documentation, and regression coverage; all 127 targeted proxy tests passed after building workspace dependencies.
- Byte-exact rewriting: Buffered and streamed response scrubbing and request-body substitution match UTF-8 value bytes without corrupting unrelated non-UTF-8 bytes.
- Response semantics: Unchanged buffered bodies retain their metadata, HEAD responses preserve
content-length, and 206 bodies bypass rewriting while headers remain scrubbed. - Coverage and limitations: Regression tests cover binary responses, split secrets, Unicode request substitution, HEAD, and partial content; the guide documents byte matching and partial-response passthrough.
gpt-6.1-sol | 𝕏
varlock
@varlock/astro-integration
@varlock/cloudflare-integration
@varlock/nuxt-integration
@varlock/vite-integration
@varlock/native-helper-darwin
@varlock/native-helper-linux-arm64
@varlock/native-helper-linux-x64
@varlock/native-helper-win32-x64
commit: |
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.



Fixes #1263.
Response scrubbing decoded text/* bodies as UTF-8 and re-encoded them, so every invalid byte became U+FFFD. Go's checksum database serves binary tiles as
text/plain, sogo getthrough a strict proxy failed withlen=226, want 128.content-lengthrewritten to 0 and lost itsetag.Content-Range); only their headers are scrubbed.