Skip to content

Conversation

@mcollina
Copy link
Member

@mcollina mcollina commented Feb 2, 2026

Summary

  • Fix WrapHandler to use Latin1 encoding when converting header strings to Buffers
  • Previously used Buffer.from(val) which defaults to UTF-8, causing header values with non-ASCII bytes to be incorrectly encoded
  • Affects onRequestUpgrade, onResponseStart, and onResponseEnd methods

Fixes #4797

Test plan

  • Verified both repro cases from the issue now work correctly
  • All existing unit tests pass (1221 tests)
  • Lint passes

WrapHandler was converting header strings to Buffers using Buffer.from()
without specifying an encoding, which defaults to UTF-8. HTTP headers
must use Latin1 (ISO-8859-1) encoding instead.

Fixes: #4797
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.24%. Comparing base (352c691) to head (3d21fa5).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4798      +/-   ##
==========================================
- Coverage   93.25%   93.24%   -0.02%     
==========================================
  Files         109      109              
  Lines       34024    34100      +76     
==========================================
+ Hits        31729    31796      +67     
- Misses       2295     2304       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WrapHandler translates headers using utf-8 instead of latin1

2 participants