WASM: Fix System.Net.Primitives and tests#39748
Conversation
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 ```
|
Tagging subscribers to this area: @dotnet/ncl |
|
The perf job failures are due to #38138 |
| 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")); |
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
The part I don't understand is why that would impact cookies. We don't do any networking here AFAIK, right?
There was a problem hiding this comment.
@wfurt we don't do networking but we still read the domain name (which on netcore on Unix generally means the machine name) here:
runtime/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs
Lines 139 to 145 in ea82629
That is later on used for this check:
runtime/src/libraries/System.Net.Primitives/src/System/Net/Cookie.cs
Lines 430 to 434 in ea82629
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?
There was a problem hiding this comment.
thanks for explanation. This is not my primary are and I'll ask around.
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
localhostas theEnvironment.MachineNameand that changes the test values.Allows the tests to run on WebAssembly: