Skip to content

Commit bdd5930

Browse files
committed
disable unsupported HTTP scenarios
1 parent 79c854b commit bdd5930

10 files changed

Lines changed: 54 additions & 1 deletion

src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public HttpClientHandler_Authentication_Test(ITestOutputHelper output) : base(ou
4545

4646
[Theory]
4747
[MemberData(nameof(Authentication_SocketsHttpHandler_TestData))]
48+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support authentication")]
4849
public async Task SocketsHttpHandler_Authentication_Succeeds(string authenticateHeader, bool result)
4950
{
5051
await HttpClientHandler_Authentication_Succeeds(authenticateHeader, result);
@@ -106,6 +107,7 @@ public static IEnumerable<object[]> Authentication_SocketsHttpHandler_TestData()
106107

107108
[Theory]
108109
[MemberData(nameof(Authentication_TestData))]
110+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support authentication")]
109111
public async Task HttpClientHandler_Authentication_Succeeds(string authenticateHeader, bool result)
110112
{
111113
if (PlatformDetection.IsWindowsNanoServer)
@@ -132,6 +134,7 @@ await TestHelper.WhenAllCompletedOrAnyFailedWithTimeout(TestHelper.PassingTestTi
132134
[InlineData("WWW-Authenticate: Basic realm=\"hello\"\r\nWWW-Authenticate: Basic realm=\"hello\"\r\n")]
133135
[InlineData("WWW-Authenticate: Digest realm=\"hello\", nonce=\"hello\", algorithm=MD5\r\nWWW-Authenticate: Digest realm=\"hello\", nonce=\"hello\", algorithm=MD5\r\n")]
134136
[InlineData("WWW-Authenticate: Digest realm=\"hello1\", nonce=\"hello\", algorithm=MD5\r\nWWW-Authenticate: Digest realm=\"hello\", nonce=\"hello\", algorithm=MD5\r\n")]
137+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support authentication")]
135138
public async Task HttpClientHandler_MultipleAuthenticateHeaders_WithSameAuth_Succeeds(string authenticateHeader)
136139
{
137140
if (IsWinHttpHandler)
@@ -145,6 +148,7 @@ public async Task HttpClientHandler_MultipleAuthenticateHeaders_WithSameAuth_Suc
145148
[Theory]
146149
[InlineData("WWW-Authenticate: Basic realm=\"hello\"\r\nWWW-Authenticate: Digest realm=\"hello\", nonce=\"hello\", algorithm=MD5\r\n")]
147150
[InlineData("WWW-Authenticate: Digest realm=\"hello\", nonce=\"hello\", algorithm=MD5\r\nWWW-Authenticate: Basic realm=\"hello\"\r\n")]
151+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support authentication")]
148152
public async Task HttpClientHandler_MultipleAuthenticateHeaders_Succeeds(string authenticateHeader)
149153
{
150154
if (PlatformDetection.IsWindowsNanoServer)
@@ -164,6 +168,7 @@ await LoopbackServer.CreateServerAsync(async (server, url) =>
164168
[Theory]
165169
[InlineData("WWW-Authenticate: Basic realm=\"hello\"\r\nWWW-Authenticate: NTLM\r\n", "Basic", "Negotiate")]
166170
[InlineData("WWW-Authenticate: Basic realm=\"hello\"\r\nWWW-Authenticate: Digest realm=\"hello\", nonce=\"hello\", algorithm=MD5\r\nWWW-Authenticate: NTLM\r\n", "Digest", "Negotiate")]
171+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support authentication")]
167172
public async Task HttpClientHandler_MultipleAuthenticateHeaders_PicksSupported(string authenticateHeader, string supportedAuth, string unsupportedAuth)
168173
{
169174
if (PlatformDetection.IsWindowsNanoServer)
@@ -189,6 +194,7 @@ await LoopbackServer.CreateServerAsync(async (server, url) =>
189194
[Theory]
190195
[InlineData("WWW-Authenticate: Basic realm=\"hello\"\r\n")]
191196
[InlineData("WWW-Authenticate: Digest realm=\"hello\", nonce=\"testnonce\"\r\n")]
197+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support authentication")]
192198
public async Task HttpClientHandler_IncorrectCredentials_Fails(string authenticateHeader)
193199
{
194200
var options = new LoopbackServer.Options { Domain = Domain, Username = Username, Password = Password };
@@ -226,6 +232,7 @@ public static IEnumerable<object[]> Authentication_TestData()
226232
[InlineData("NTLM")]
227233
[InlineData("Kerberos")]
228234
[InlineData("Negotiate")]
235+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support PreAuthenticate")]
229236
public async Task PreAuthenticate_NoPreviousAuthenticatedRequests_NoCredentialsSent(string? credCacheScheme)
230237
{
231238
const int NumRequests = 3;
@@ -268,6 +275,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>
268275
[Theory]
269276
[InlineData(null, "WWW-Authenticate: Basic realm=\"hello\"\r\n")]
270277
[InlineData("Basic", "WWW-Authenticate: Basic realm=\"hello\"\r\n")]
278+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support PreAuthenticate")]
271279
public async Task PreAuthenticate_FirstRequestNoHeaderAndAuthenticates_SecondRequestPreauthenticates(string? credCacheScheme, string authResponse)
272280
{
273281
await LoopbackServer.CreateClientAndServerAsync(async uri =>
@@ -360,6 +368,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>
360368
[InlineData((HttpStatusCode)508)] // LoopDetected
361369
[InlineData((HttpStatusCode)510)] // NotExtended
362370
[InlineData((HttpStatusCode)511)] // NetworkAuthenticationRequired
371+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support PreAuthenticate")]
363372
public async Task PreAuthenticate_FirstRequestNoHeader_SecondRequestVariousStatusCodes_ThirdRequestPreauthenticates(HttpStatusCode statusCode)
364373
{
365374
const string AuthResponse = "WWW-Authenticate: Basic realm=\"hello\"\r\n";
@@ -403,6 +412,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>
403412
[InlineData("/something/hello.html", "/world.html", false)]
404413
[InlineData("/something/hello.html", "/another/", false)]
405414
[InlineData("/something/hello.html", "/another/hello.html", false)]
415+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support PreAuthenticate")]
406416
public async Task PreAuthenticate_AuthenticatedUrl_ThenTryDifferentUrl_SendsAuthHeaderOnlyIfPrefixMatches(
407417
string originalRelativeUri, string secondRelativeUri, bool expectedAuthHeader)
408418
{
@@ -442,6 +452,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>
442452
}
443453

444454
[Fact]
455+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support PreAuthenticate")]
445456
public async Task PreAuthenticate_SuccessfulBasicButThenFails_DoesntLoopInfinitely()
446457
{
447458
await LoopbackServer.CreateClientAndServerAsync(async uri =>
@@ -480,6 +491,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>
480491
}
481492

482493
[Fact]
494+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support PreAuthenticate")]
483495
public async Task PreAuthenticate_SuccessfulBasic_ThenDigestChallenged()
484496
{
485497
if (IsWinHttpHandler)

src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public abstract class HttpClientHandler_Proxy_Test : HttpClientHandlerTestBase
2727
public HttpClientHandler_Proxy_Test(ITestOutputHelper output) : base(output) { }
2828

2929
[Fact]
30+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support proxy")]
3031
public async Task Dispose_HandlerWithProxy_ProxyNotDisposed()
3132
{
3233
if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value)
@@ -655,6 +656,7 @@ await LoopbackServer.CreateClientAndServerAsync(async proxyUri =>
655656
[Theory]
656657
[InlineData(true)]
657658
[InlineData(false)]
659+
[SkipOnPlatform(TestPlatforms.Wasi, "WASI HttpHandler does not support proxy")]
658660
public async Task ProxyTunnelRequest_UserAgentHeaderAdded(bool addUserAgentHeader)
659661
{
660662
if (IsWinHttpHandler)

src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTestBase.SocketsHttpHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected static HttpClientHandler CreateHttpClientHandler(Version useVersion =
5353
HttpClientHandler handler = (PlatformDetection.SupportsAlpn && useVersion != HttpVersion.Version30) ? new HttpClientHandler() : new VersionHttpClientHandler(useVersion);
5454

5555
// Browser doesn't support ServerCertificateCustomValidationCallback
56-
if (allowAllCertificates && PlatformDetection.IsNotBrowser)
56+
if (allowAllCertificates && PlatformDetection.IsNotBrowser && PlatformDetection.IsNotWasi)
5757
{
5858
handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates;
5959
}

src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ await server.AcceptConnectionAsync(async connection =>
8989

9090
[Collection(nameof(HttpClientMiniStress))]
9191
[SkipOnPlatform(TestPlatforms.Browser, "System.Net.Security is not supported on Browser")]
92+
[SkipOnPlatform(TestPlatforms.Wasi, "System.Net.Security is not supported on Wasi")]
9293
public abstract class HttpClientMiniStress : HttpClientHandlerTestBase
9394
{
9495
public HttpClientMiniStress(ITestOutputHelper output) : base(output) { }

src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,7 @@ public void Send_SingleThread_Succeeds(HttpCompletionOption completionOption)
10161016
[InlineData(HttpCompletionOption.ResponseHeadersRead)]
10171017
[SkipOnPlatform(TestPlatforms.Browser, "Synchronous Send is not supported on Browser")]
10181018
[SkipOnPlatform(TestPlatforms.Android, "Synchronous Send is not supported on Android")]
1019+
[SkipOnPlatform(TestPlatforms.Wasi, "Synchronous Send is not supported on Wasi")]
10191020
public async Task Send_SingleThread_Loopback_Succeeds(HttpCompletionOption completionOption)
10201021
{
10211022
string content = "Test content";
@@ -1071,6 +1072,7 @@ await server.AcceptConnectionAsync(async connection =>
10711072
[OuterLoop]
10721073
[SkipOnPlatform(TestPlatforms.Browser, "Synchronous Send is not supported on Browser")]
10731074
[SkipOnPlatform(TestPlatforms.Android, "Synchronous Send is not supported on Android")]
1075+
[SkipOnPlatform(TestPlatforms.Wasi, "Synchronous Send is not supported on Wasi")]
10741076
public async Task Send_CancelledRequestContent_Throws()
10751077
{
10761078
CancellationTokenSource cts = new CancellationTokenSource();
@@ -1162,6 +1164,7 @@ await server.AcceptConnectionAsync(async connection =>
11621164
[OuterLoop]
11631165
[SkipOnPlatform(TestPlatforms.Browser, "Synchronous Send is not supported on Browser")]
11641166
[SkipOnPlatform(TestPlatforms.Android, "Synchronous Send is not supported on Android")]
1167+
[SkipOnPlatform(TestPlatforms.Wasi, "Synchronous Send is not supported on Wasi")]
11651168
public async Task Send_CancelledResponseContent_Throws()
11661169
{
11671170
string content = "Test content";
@@ -1214,6 +1217,7 @@ await IgnoreExceptions(async () =>
12141217
[OuterLoop]
12151218
[SkipOnPlatform(TestPlatforms.Browser, "Synchronous Send is not supported on Browser")]
12161219
[SkipOnPlatform(TestPlatforms.Android, "Synchronous Send is not supported on Android")]
1220+
[SkipOnPlatform(TestPlatforms.Wasi, "Synchronous Send is not supported on Wasi")]
12171221
public async Task Send_TimeoutResponseContent_Throws()
12181222
{
12191223
const string Content = "Test content";
@@ -1272,6 +1276,7 @@ public static IEnumerable<object[]> VersionSelectionMemberData()
12721276
[Theory]
12731277
[MemberData(nameof(VersionSelectionMemberData))]
12741278
[SkipOnPlatform(TestPlatforms.Browser, "Version is ignored on Browser")]
1279+
[SkipOnPlatform(TestPlatforms.Wasi, "Version is ignored on Wasi")]
12751280
public async Task SendAsync_CorrectVersionSelected_LoopbackServer(Version requestVersion, HttpVersionPolicy versionPolicy, Version serverVersion, bool useSsl, object expectedResult)
12761281
{
12771282
await HttpAgnosticLoopbackServer.CreateClientAndServerAsync(
@@ -1322,6 +1327,7 @@ await HttpAgnosticLoopbackServer.CreateClientAndServerAsync(
13221327
[OuterLoop("Uses external servers")]
13231328
[MemberData(nameof(VersionSelectionMemberData))]
13241329
[SkipOnPlatform(TestPlatforms.Browser, "Version is ignored on Browser")]
1330+
[SkipOnPlatform(TestPlatforms.Wasi, "Version is ignored on Wasi")]
13251331
public async Task SendAsync_CorrectVersionSelected_ExternalServer(Version requestVersion, HttpVersionPolicy versionPolicy, Version serverVersion, bool useSsl, object expectedResult)
13261332
{
13271333
RemoteServer remoteServer = null;

src/libraries/System.Net.Http/tests/FunctionalTests/HttpContentTest.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public async Task ReadAsStreamAsync_FirstGetFromUnbufferedContentThenGetFromBuff
299299
}
300300

301301
[SkipOnPlatform(TestPlatforms.Browser, "Browser doesn't support Synchronous reads")]
302+
[SkipOnPlatform(TestPlatforms.Wasi, "Wasi doesn't support Synchronous reads")]
302303
[Theory]
303304
[InlineData(true)]
304305
[InlineData(false)]
@@ -534,6 +535,7 @@ await LoopbackServer.CreateClientAndServerAsync(
534535
}
535536

536537
[Fact]
538+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
537539
public async Task LoadIntoBufferAsync_Unbuffered_CanBeCanceled_AlreadyCanceledCts()
538540
{
539541
await LoopbackServer.CreateClientAndServerAsync(
@@ -819,6 +821,7 @@ await LoopbackServer.CreateClientAndServerAsync(
819821

820822
[Fact]
821823
[ActiveIssue("https://github.com/dotnet/runtime/issues/86317", typeof(PlatformDetection), nameof(PlatformDetection.IsNodeJS))]
824+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
822825
public async Task ReadAsStringAsync_Unbuffered_CanBeCanceled_AlreadyCanceledCts()
823826
{
824827
await LoopbackServer.CreateClientAndServerAsync(
@@ -900,6 +903,7 @@ await LoopbackServer.CreateClientAndServerAsync(
900903

901904
[Fact]
902905
[ActiveIssue("https://github.com/dotnet/runtime/issues/86317", typeof(PlatformDetection), nameof(PlatformDetection.IsNodeJS))]
906+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
903907
public async Task ReadAsByteArrayAsync_Unbuffered_CanBeCanceled_AlreadyCanceledCts()
904908
{
905909
await LoopbackServer.CreateClientAndServerAsync(

src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ public HttpMetricsTest(ITestOutputHelper output) : base(output)
289289
}
290290

291291
[Fact]
292+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
292293
public Task ActiveRequests_Success_Recorded()
293294
{
294295
return LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
@@ -346,6 +347,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
346347
}
347348

348349
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNodeJSOrFirefox))]
350+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
349351
[InlineData("GET", HttpStatusCode.OK)]
350352
[InlineData("PUT", HttpStatusCode.Created)]
351353
public Task RequestDuration_Success_Recorded(string method, HttpStatusCode statusCode)
@@ -449,6 +451,7 @@ await RemoteExecutor.Invoke(static testClass =>
449451
}
450452

451453
[Fact]
454+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
452455
public Task RequestDuration_CustomTags_Recorded()
453456
{
454457
return LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
@@ -475,6 +478,7 @@ public Task RequestDuration_CustomTags_Recorded()
475478
}
476479

477480
[Fact]
481+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
478482
public Task RequestDuration_MultipleCallbacksPerRequest_AllCalledInOrder()
479483
{
480484
return LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
@@ -591,6 +595,7 @@ public enum ResponseContentType
591595
}
592596

593597
[Theory]
598+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
594599
[InlineData(HttpCompletionOption.ResponseContentRead, ResponseContentType.Empty)]
595600
[InlineData(HttpCompletionOption.ResponseContentRead, ResponseContentType.ContentLength)]
596601
[InlineData(HttpCompletionOption.ResponseContentRead, ResponseContentType.TransferEncodingChunked)]
@@ -714,6 +719,7 @@ public Task ActiveRequests_Redirect_RecordedForEachHttpSpan(int credentialsMode)
714719

715720
[Theory]
716721
[PlatformSpecific(~TestPlatforms.Browser)] // BrowserHttpHandler supports only a limited set of methods.
722+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
717723
[MemberData(nameof(MethodData))]
718724
public async Task RequestMetrics_EmitNormalizedMethodTags(string method, string expectedMethodTag)
719725
{
@@ -818,6 +824,7 @@ await server.AcceptConnectionAsync(async connection =>
818824
}
819825

820826
[Fact]
827+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
821828
public async Task RequestDuration_RequestCancelled_ErrorReasonIsExceptionType()
822829
{
823830
TaskCompletionSource clientCompleted = new(TaskCreationOptions.RunContinuationsAsynchronously);
@@ -862,6 +869,7 @@ await server.AcceptConnectionAsync(async connection =>
862869
}
863870

864871
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))]
872+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
865873
public async Task RequestDuration_ConnectionError_LogsExpectedErrorReason()
866874
{
867875
if (UseVersion.Major == 3)
@@ -1036,6 +1044,7 @@ public HttpMetricsTest_Http11(ITestOutputHelper output) : base(output)
10361044
}
10371045

10381046
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNodeJSOrFirefox))]
1047+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
10391048
public async Task RequestDuration_EnrichmentHandler_ContentLengthError_Recorded()
10401049
{
10411050
await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
@@ -1066,6 +1075,7 @@ await Assert.ThrowsAsync<HttpRequestException>(async () =>
10661075
}
10671076

10681077
[Theory]
1078+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
10691079
[InlineData(400)]
10701080
[InlineData(404)]
10711081
[InlineData(599)]
@@ -1090,6 +1100,7 @@ public Task RequestDuration_ErrorStatus_ErrorTypeRecorded(int statusCode)
10901100

10911101
[Fact]
10921102
[SkipOnPlatform(TestPlatforms.Browser, "Browser is relaxed about validating HTTP headers")]
1103+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
10931104
public async Task RequestDuration_ConnectionClosedWhileReceivingHeaders_Recorded()
10941105
{
10951106
using CancellationTokenSource cancelServerCts = new CancellationTokenSource();
@@ -1122,6 +1133,7 @@ await IgnoreExceptions(async () =>
11221133
}
11231134

11241135
[Fact]
1136+
[ActiveIssue("https://github.com/dotnet/runtime/issues/98957", TestPlatforms.Wasi)]
11251137
public Task DurationHistograms_HaveBucketSizeHints()
11261138
{
11271139
return LoopbackServerFactory.CreateClientAndServerAsync(async uri =>

src/libraries/System.Net.Http/tests/FunctionalTests/ResponseStreamZeroByteReadTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public static IEnumerable<object[]> ZeroByteRead_IssuesZeroByteReadOnUnderlyingS
8181
[Theory]
8282
[MemberData(nameof(ZeroByteRead_IssuesZeroByteReadOnUnderlyingStream_MemberData))]
8383
[SkipOnPlatform(TestPlatforms.Browser, "ConnectCallback is not supported on Browser")]
84+
[SkipOnPlatform(TestPlatforms.Wasi, "ConnectCallback is not supported on Wasi")]
8485
public async Task ZeroByteRead_IssuesZeroByteReadOnUnderlyingStream(StreamConformanceTests.ReadWriteMode readMode, bool useSsl)
8586
{
8687
(Stream httpConnection, Stream server) = ConnectedStreams.CreateBidirectional(4096, int.MaxValue);

0 commit comments

Comments
 (0)