diff --git a/src/libraries/Common/src/System/Net/NetworkInformation/HostInformationPal.Browser.cs b/src/libraries/Common/src/System/Net/NetworkInformation/HostInformationPal.Browser.cs new file mode 100644 index 00000000000000..01c30fda1644ad --- /dev/null +++ b/src/libraries/Common/src/System/Net/NetworkInformation/HostInformationPal.Browser.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Net.NetworkInformation +{ + internal static class HostInformationPal + { + public static string GetHostName() + { + return Environment.MachineName; + } + + public static string GetDomainName() + { + return Environment.UserDomainName; + } + } +} diff --git a/src/libraries/Common/src/System/Net/NetworkInformation/InterfaceInfoPal.Browser.cs b/src/libraries/Common/src/System/Net/NetworkInformation/InterfaceInfoPal.Browser.cs new file mode 100644 index 00000000000000..d5d50a2aa33670 --- /dev/null +++ b/src/libraries/Common/src/System/Net/NetworkInformation/InterfaceInfoPal.Browser.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Net.NetworkInformation +{ + internal static class InterfaceInfoPal + { + public static uint InterfaceNameToIndex(string interfaceName) + { + // zero means "unknown" + return 0; + } + } +} diff --git a/src/libraries/System.Net.Primitives/src/System.Net.Primitives.csproj b/src/libraries/System.Net.Primitives/src/System.Net.Primitives.csproj index 8c5c2d9924eaee..cfc1e85797bb87 100644 --- a/src/libraries/System.Net.Primitives/src/System.Net.Primitives.csproj +++ b/src/libraries/System.Net.Primitives/src/System.Net.Primitives.csproj @@ -117,14 +117,22 @@ - + + + + + + - - - + + + + diff --git a/src/libraries/System.Net.Primitives/tests/FunctionalTests/CookieTest/CookiePortTest.cs b/src/libraries/System.Net.Primitives/tests/FunctionalTests/CookieTest/CookiePortTest.cs index d7a3428507674f..5ed895d050d1f4 100644 --- a/src/libraries/System.Net.Primitives/tests/FunctionalTests/CookieTest/CookiePortTest.cs +++ b/src/libraries/System.Net.Primitives/tests/FunctionalTests/CookieTest/CookiePortTest.cs @@ -13,65 +13,65 @@ public class CookiePortTest public CookiePortTest() { _cc = new CookieContainer(); - _cookie = new Cookie("name", "value1", "/path", "localhost"); + _cookie = new Cookie("name", "value1", "/path", "example.com"); // use both space and comma as delimiter _cookie.Port = "\"80 110,1050, 1090 ,1100\""; - _cc.Add(new Uri("http://localhost/path"), _cookie); + _cc.Add(new Uri("http://example.com/path"), _cookie); } [Fact] public void Port_SetMultiplePorts_Port1Set() { - CookieCollection cookies = _cc.GetCookies(new Uri("http://localhost:80/path")); + CookieCollection cookies = _cc.GetCookies(new Uri("http://example.com:80/path")); 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")); Assert.Equal(1, cookies.Count); } [Fact] public void Port_CommaDelimiter_PortSet() { - CookieCollection cookies = _cc.GetCookies(new Uri("http://localhost:1050/path")); + CookieCollection cookies = _cc.GetCookies(new Uri("http://example.com:1050/path")); Assert.Equal(1, cookies.Count); } [Fact] public void Port_CommaSpaceDelimiter_PortSet() { - CookieCollection cookies = _cc.GetCookies(new Uri("http://localhost:1090/path")); + CookieCollection cookies = _cc.GetCookies(new Uri("http://example.com:1090/path")); Assert.Equal(1, cookies.Count); } [Fact] public void Port_SpaceCommaDelimiter_PortSet() { - CookieCollection cookies = _cc.GetCookies(new Uri("http://localhost:1100/path")); + CookieCollection cookies = _cc.GetCookies(new Uri("http://example.com:1100/path")); Assert.Equal(1, cookies.Count); } [Fact] public void Port_SetMultiplePorts_NoPortMatch() { - CookieCollection cookies = _cc.GetCookies(new Uri("http://localhost:1000/path")); + CookieCollection cookies = _cc.GetCookies(new Uri("http://example.com:1000/path")); Assert.Equal(0, cookies.Count); } [Fact] public void Port_SetMultiplePorts_NoPathMatch() { - CookieCollection cookies = _cc.GetCookies(new Uri("http://localhost:1050")); + CookieCollection cookies = _cc.GetCookies(new Uri("http://example.com:1050")); Assert.Equal(0, cookies.Count); } [Fact] public void Port_NoPortSpecified_ReturnsCookies() { - CookieCollection cookies = _cc.GetCookies(new Uri("http://localhost/path")); + CookieCollection cookies = _cc.GetCookies(new Uri("http://example.com/path")); Assert.Equal(1, cookies.Count); } } diff --git a/src/libraries/System.Net.Primitives/tests/FunctionalTests/SocketAddressTest.cs b/src/libraries/System.Net.Primitives/tests/FunctionalTests/SocketAddressTest.cs index a4ce20f12fbd92..af2a89c4807a50 100644 --- a/src/libraries/System.Net.Primitives/tests/FunctionalTests/SocketAddressTest.cs +++ b/src/libraries/System.Net.Primitives/tests/FunctionalTests/SocketAddressTest.cs @@ -98,7 +98,7 @@ public static void ToString_LegacyUnknownFamily_Success(AddressFamily family) [Theory] [InlineData(AddressFamily.Packet)] [InlineData(AddressFamily.ControllerAreaNetwork)] - [PlatformSpecific(~TestPlatforms.Linux)] + [PlatformSpecific(~(TestPlatforms.Linux | TestPlatforms.Browser))] public static void ToString_UnsupportedFamily_Throws(AddressFamily family) { Assert.Throws(() => new SocketAddress(family)); diff --git a/src/libraries/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj b/src/libraries/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj index 38a9e23817f92b..212d2de6287eb3 100644 --- a/src/libraries/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj +++ b/src/libraries/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj @@ -85,8 +85,6 @@ - - - - - + + + + Link="Common\System\Net\NetworkInformation\InterfaceInfoPal.Unix.cs" /> + + + + + Link="Common\Interop\Unix\System.Native\Interop.InterfaceNameToIndex.cs" /> + + + + \ No newline at end of file diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 626c4ea4992f8d..eb67053b5b88bd 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -32,8 +32,6 @@ - -