Skip to content
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

Add parsing of zero port for unknown Uri scheme #40986

Merged
merged 3 commits into from
Aug 18, 2020

Conversation

CarnaViire
Copy link
Member

Used Miha's suggestion from #37865 (comment)

Fixes #37865

@ghost
Copy link

ghost commented Aug 18, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

[Fact]
public static void ZeroPortIsParsedForBothKnownAndUnknownSchemes()
{
Uri.TryCreate("http://example.com:0", UriKind.Absolute, out var uri);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't the test be rather parametrized instead of copying similar block 3 times in a row?

Copy link
Member

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last comment, otherwise LGTM. Thanks!

Assert.Equal(-1, uri.Port);
Assert.True(uri.IsDefaultPort);
Assert.Equal("rtsp://example.com/", uri.ToString());
yield return new object[] { "http://example.com:0", 0, false, "http://example.com:0/" };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is toString same as the uriString except the trailing slash? Do we need the extra parameter?

@CarnaViire CarnaViire merged commit 154e971 into dotnet:master Aug 18, 2020
@CarnaViire CarnaViire deleted the issue-37865 branch August 18, 2020 18:49
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
@karelz karelz added this to the 6.0.0 milestone Jan 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port number 0 does not parse correctly when using an unknown scheme
4 participants