This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Fix Uri.Host for IPv6 Link-local address #29769
Merged
+29
−1
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a3a8429
wip
MarcoRossignoli e6319a2
wip
MarcoRossignoli baa30aa
wip
MarcoRossignoli a2454a0
nit: spaces
MarcoRossignoli d6d3b7d
nit: spaces
MarcoRossignoli 7a6270c
address PR feedback
MarcoRossignoli 5d017be
address PR feedback
MarcoRossignoli 5f0a0df
address PR feedback
MarcoRossignoli a17309c
address PR feedback
MarcoRossignoli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,6 +234,22 @@ private void ParseBadIPv4Address(string badIpv4String) | |
|
||
#region IPv6 | ||
|
||
[Theory] | ||
[InlineData("fe80::e077:c9a3:eeba:b8e9", "%18", true)] | ||
[InlineData("Fe80::e077:c9a3:eeba:b8e9", "%18", true)] | ||
[InlineData("fE80::e077:c9a3:eeba:b8e9", "%18", true)] | ||
[InlineData("FE80::e077:c9a3:eeba:b8e9", "%18", true)] | ||
[InlineData("FE80::e077:c9a3:eeba:b8e9", "%eth10", true)] | ||
[InlineData("fe81::e077:c9a3:eeba:b8e9", "%18", false)] | ||
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] | ||
public void UriIPv6Host_LinkLocalAddress(string address, string zoneIndex, bool isValidLinkLocalAddress) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test name should be 3 parts, so it should probably be named like this: "Host_IPv6LinkLocalAddress_HasScopeId"
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, you should separate out the valid and invalid cases into separate tests. The invalid one could be named, "Host_NonIPv6LinkLocalAddress_NoScopeId" |
||
{ | ||
string scopedLiteralIpv6 = "[" + address + zoneIndex + "]"; | ||
string literalIpV6Uri = "http://" + scopedLiteralIpv6; | ||
var uri = new Uri(literalIpV6Uri); | ||
Assert.Equal(isValidLinkLocalAddress ? scopedLiteralIpv6 : "[" + address + "]", uri.Host, ignoreCase: true); | ||
} | ||
|
||
[Fact] | ||
public void UriIPv6Host_CanonicalCollonHex_Success() | ||
{ | ||
|
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.
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.
@davidsh do you consider porting on netfx?
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.
I will mark it as "consider". But those things have longer lead times for review and it might not qualify due to strict app-compat guidelines.