-
-
Notifications
You must be signed in to change notification settings - Fork 26
Allow custom HTTP headers #477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,7 +30,7 @@ public HeaderEntry( | |||||
| /// </summary> | ||||||
| public abstract class HttpHeaders | ||||||
| { | ||||||
| internal WebHeaderCollection _headerStore = new WebHeaderCollection(true); | ||||||
| internal WebHeaderCollection _headerStore = new WebHeaderCollection(false); | ||||||
|
||||||
| internal WebHeaderCollection _headerStore = new WebHeaderCollection(false); | |
| internal WebHeaderCollection _headerStore = new WebHeaderCollection(true); |
Copilot
AI
Mar 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line changes header-validation behavior globally for HttpRequestHeaders, HttpResponseHeaders, and HttpContentHeaders, but there are no unit tests asserting the new expected behavior. Please add tests that (1) verify previously-blocked standard headers (e.g., Accept) can now be added, and (2) define the intended behavior for managed headers like Content-Length (either still rejected or validated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching the backing store to
new WebHeaderCollection(false)disables the restricted-header checks (seeWebHeaderCollection.ThrowOnRestrictedHeader()), which changes behavior for known headers likeAccept,Connection,Host,Content-Length, etc., not just customX-*headers. GivenHeaderInfoTabletreats unknown headers as non-restricted, custom headers were already allowed before this change; please either update the PR title/description to reflect the broader behavior change, or narrow the change to only what’s needed for the reported issue.