Add more tests for IPv6 Uri delimiters#120942
Merged
MihaZupan merged 3 commits intodotnet:mainfrom Nov 4, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances IPv6 URI parsing by adding backslash (\) as an allowed delimiter after IPv6 addresses and expands test coverage for various URI schemes with IPv6 hosts.
Key Changes:
- Adds
\to the list of valid delimiters that can follow an IPv6 address in URIs - Expands test coverage to validate IPv6 parsing across different URI schemes (http, file, custom file-based, and custom http-based)
- Tests both file-based schemes (which allow backslash delimiters) and non-file schemes (which reject them)
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libraries/System.Private.Uri/src/System/Uri.cs | Adds backslash to the valid delimiter pattern after IPv6 addresses |
| src/libraries/System.Private.Uri/tests/FunctionalTests/UriIpHostTest.cs | Expands test coverage with parameterized tests across multiple schemes and validates backslash handling |
src/libraries/System.Private.Uri/tests/FunctionalTests/UriIpHostTest.cs
Outdated
Show resolved
Hide resolved
Contributor
|
Tagging subscribers to this area: @dotnet/ncl |
stephentoub
approved these changes
Nov 4, 2025
Member
Author
|
/ba-g Android timing out |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Follow-up to #120908
Adds
\to the list of allowed delimiters.File-based schemes allow it, and other schemes have other existing logic to reject it.
I'm not sure that anyone is actually using such URIs in practice (UNC has limitations around IPv6), but this lowers the risk of us breaking some odd existing scenario.
For implicit files (file uris that don't start with
file:), we also disallow?or#to match IPv4/host logic.