Skip to content

fix(proxy): handle forwarded request headers beyond stack buffer#137

Open
binarylogic wants to merge 2 commits intomasterfrom
fix/proxy-header-overflow-resilience
Open

fix(proxy): handle forwarded request headers beyond stack buffer#137
binarylogic wants to merge 2 commits intomasterfrom
fix/proxy-header-overflow-resilience

Conversation

@binarylogic
Copy link
Copy Markdown

Summary

Make request header forwarding resilient when header count exceeds the fixed stack buffer.

Why

Forwarding previously used a fixed [64]std.http.Header buffer and could fail with TooManyHeaders. This caused avoidable request failures for high-header inputs.

Changes

  • Count forwardable headers first.
  • Use stack buffer when count fits.
  • Allocate a dynamic header slice in request arena when count exceeds stack capacity.

Validation

  • zig build test

dynamic: bool,
};

fn selectHeaderTarget(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't do this right now so we can avoid any extra allocation in this path, do you think we'll be seeing a lot of cases with more than 64 headers?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants