Skip to content

Discussion: Preserving Empty HTTP Header Values vs. Dropping Them#133

Merged
RRQM merged 1 commit intoRRQM:masterfrom
walterlv:master
Apr 30, 2026
Merged

Discussion: Preserving Empty HTTP Header Values vs. Dropping Them#133
RRQM merged 1 commit intoRRQM:masterfrom
walterlv:master

Conversation

@walterlv
Copy link
Copy Markdown
Contributor

This PR changes the behavior of header parsing in HttpBase:

  • Before: headers with empty values (e.g. X-Test:) are dropped
  • After: headers with empty values are preserved as empty strings

Discussion

Product/Library Not sent Sent but empty
ASP.NET Core null ""
Node.js undefined ''
Go (net/http) "" ""
Nginx - Drops when forwarding upstream
Envoy - Preserves at the protocol level
HAProxy - Generally preserves, but configurable

Benefits:

  • Preserving empty headers makes them distinguishable from missing headers

Drawbacks:

  • If a server checks for the presence of a header without considering empty values, it may lead to unexpected behavior (e.g. treating X-Test: as valid when it should be considered missing)

So, a decision needs to be made here.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 28, 2026

👷 Deploy request for touchsocket pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 249f675

@RRQM RRQM merged commit 2b80969 into RRQM:master Apr 30, 2026
@RRQM
Copy link
Copy Markdown
Owner

RRQM commented Apr 30, 2026

非常感谢您的贡献!

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.

2 participants