Repository navigation
Make HostMatcherPolicy DFA edges case-insensitive - #68670
Merged
Merged
Conversation
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes a host-routing correctness issue by making HostMatcherPolicy’s DFA edge identity (equality, hashing, and ordering) case-insensitive, aligning it with runtime host matching behavior (ordinal-ignore-case). This prevents semantically equivalent host constraints that differ only by casing from being split into separate DFA branches, which could otherwise drop valid fallback endpoints before later matcher policies run.
Changes:
- Updated
HostMatcherPolicy.EdgeKeycomparison, equality, and hashing to useOrdinalIgnoreCasefor host values while keeping port matching exact. - Added unit coverage ensuring
GetEdgesgroups equivalent host strings case-insensitively, avoids duplicate endpoints for equivalent host entries, and does not group different ports. - Added an integration test that verifies equivalent hosts with different casing preserve candidate endpoints for downstream matcher policies (via a content-encoding policy interaction).
Show a summary per file
| File | Description |
|---|---|
| src/Http/Routing/src/Matching/HostMatcherPolicy.cs | Makes EdgeKey ordering/equality/hashing case-insensitive for hosts to ensure DFA edge identity matches runtime host semantics. |
| src/Http/Routing/test/UnitTests/Matching/HostMatcherPolicyTest.cs | Adds focused unit tests validating case-insensitive host edge grouping and correct port differentiation. |
| src/Http/Routing/test/UnitTests/Matching/HostMatcherPolicyIntegrationTestBase.cs | Adds an end-to-end regression test ensuring equivalent-cased hosts don’t lose fallback candidates needed by later matcher policies. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
javiercn
approved these changes
Aug 20, 2026
Member
|
/backport to release/11.0-rc1 |
Contributor
|
Started backporting to |
11 tasks
wtgodbe
pushed a commit
that referenced
this pull request
Aug 21, 2026
Co-authored-by: Stephen Halter <[email protected]> Co-authored-by: Copilot App <[email protected]>
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.
Host matching is ordinal-ignore-case at request time, but
HostMatcherPolicy.EdgeKeypreviously used case-sensitive equality, hashing, and ordering. Equivalent host metadata could therefore be placed in separate DFA branches, removing valid fallback endpoints before later matcher policies ran.This aligns edge identity with runtime matching while keeping ports exact and preserving the original host spelling. Regression coverage includes exact and wildcard hosts, fixed and wildcard ports, Unicode casing, duplicate suppression, endpoint ordering, and downstream policy selection through both static DFA and dynamic endpoint-selector paths.
Fixes: #68349