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

WASM: Fix System.Net.Primitives and tests #39748

Merged
merged 1 commit into from
Jul 23, 2020

Conversation

akoeplinger
Copy link
Member

Add HostInformationPal and InterfaceInfoPal implementations for Browser.

In CookiePortTest.cs use example.com instead of localhost for the tests since Browser uses localhost as the Environment.MachineName and that changes the test values.

Allows the tests to run on WebAssembly:

System.Net.Primitives.Pal.Tests: Tests run: 60, Errors: 0, Failures: 0, Skipped: 0. Time: 0.15872s
System.Net.Primitives.Functional.Tests: Tests run: 2620, Errors: 0, Failures: 0, Skipped: 1. Time: 3.145804s

Add HostInformationPal and InterfaceInfoPal implementations for Browser.

In CookiePortTest.cs use example.com instead of localhost for the tests since Browser uses `localhost` as the `Environment.MachineName` and that changes the test values.

Allows the tests to run on WebAssembly:
```
System.Net.Primitives.Pal.Tests: Tests run: 60, Errors: 0, Failures: 0, Skipped: 0. Time: 0.15872s
System.Net.Primitives.Functional.Tests: Tests run: 2620, Errors: 0, Failures: 0, Skipped: 1. Time: 3.145804s
```
@ghost
Copy link

ghost commented Jul 21, 2020

Tagging subscribers to this area: @dotnet/ncl
Notify danmosemsft if you want to be subscribed.

@akoeplinger
Copy link
Member Author

The perf job failures are due to #38138

@akoeplinger akoeplinger requested a review from a team July 22, 2020 14:53
Assert.Equal(1, cookies.Count);
}

[Fact]
public void Port_SpaceDelimiter_PortSet()
{
CookieCollection cookies = _cc.GetCookies(new Uri("http://localhost:110/path"));
CookieCollection cookies = _cc.GetCookies(new Uri("http://example.com:110/path"));
Copy link
Member

Choose a reason for hiding this comment

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

why this needs to be changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

@wfurt See the PR description:

In CookiePortTest.cs use example.com instead of localhost for the tests since Browser uses localhost as the Environment.MachineName and that changes the test values.

Copy link
Member

Choose a reason for hiding this comment

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

The part I don't understand is why that would impact cookies. We don't do any networking here AFAIK, right?

Copy link
Member Author

@akoeplinger akoeplinger Jul 22, 2020

Choose a reason for hiding this comment

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

@wfurt we don't do networking but we still read the domain name (which on netcore on Unix generally means the machine name) here:

private static string CreateFqdnMyDomain()
{
string domain = HostInformation.DomainName;
return domain != null && domain.Length > 1 ?
'.' + domain :
string.Empty;
}

That is later on used for this check:

// First quick check is for pushing a cookie into the local domain.
if (isLocalDomain && string.Equals(localDomain, domain, StringComparison.OrdinalIgnoreCase))
{
valid = true;
}

Since localDomain and domain are both localhost we're going into that branch, which doesn't happen when the machine/domain name is set to any other value.

The result is that instead of getting this cookie once in the tests I'm getting it twice which fails the test:

Cookie:
    name = value1
    Domain: localhost
    Path: /path
    Port: "80 110,1050, 1090 ,1100"
    Secure: False
    When issued: 07/22/2020 17:46:32
    Expires: 01/01/0001 00:00:00 (expired? False)
    Don't save: False
    Comment:
    Uri for comments:
    Version: RFC 2109

Do you think it could be a product bug?

Copy link
Member

Choose a reason for hiding this comment

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

thanks for explanation. This is not my primary are and I'll ask around.

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

LGTM

@akoeplinger akoeplinger merged commit 7de187a into dotnet:master Jul 23, 2020
@akoeplinger akoeplinger deleted the wasm-system.net.primitives branch July 23, 2020 14:43
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
Add HostInformationPal and InterfaceInfoPal implementations for Browser.

In CookiePortTest.cs use example.com instead of localhost for the tests since Browser uses `localhost` as the `Environment.MachineName` and that changes the test values.

Allows the tests to run on WebAssembly:
```
System.Net.Primitives.Pal.Tests: Tests run: 60, Errors: 0, Failures: 0, Skipped: 0. Time: 0.15872s
System.Net.Primitives.Functional.Tests: Tests run: 2620, Errors: 0, Failures: 0, Skipped: 1. Time: 3.145804s
```
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
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.

3 participants