Skip to content

Commit e17d74b

Browse files
pavelsavaralewing
andauthored
[WASI][Mono] Upgrade WASI SDK / wasmtime / WASIp2 to 0.2.8 and fix sockets for new wasi-libc (#128997)
Co-authored-by: Larry Ewing <lewing@microsoft.com>
1 parent bbd5fc2 commit e17d74b

87 files changed

Lines changed: 10031 additions & 9074 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eng/AcquireWasiSdk.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<Project>
99
<PropertyGroup>
10-
<_WasiSdkVersion>25.0</_WasiSdkVersion>
10+
<_WasiSdkVersion>33.0</_WasiSdkVersion>
1111
<_RuntimeLocalWasiSdkPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'wasi-sdk'))</_RuntimeLocalWasiSdkPath>
1212
</PropertyGroup>
1313

eng/native/gen-buildsys.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if /i "%__Arch%" == "wasm" (
7070
set "WASI_SDK_PATH=%__repoRoot%\artifacts\wasi-sdk"
7171
)
7272
set __CmakeGenerator=Ninja
73-
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1"
73+
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake"
7474
)
7575
) else (
7676
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0"

eng/native/gen-buildsys.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ if [[ "$host_arch" == "wasm" ]]; then
115115
exit 1
116116
fi
117117
fi
118-
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1")
118+
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake")
119119
else
120120
echo "target_os was not specified"
121121
exit 1

eng/testing/tests.wasi.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--wasi --engine-arg=tcp</_XHarnessArgs>
5151
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--wasi --engine-arg=udp</_XHarnessArgs>
5252
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--wasi --engine-arg=allow-ip-name-lookup</_XHarnessArgs>
53+
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--wasi --engine-arg=hostcall-fuel=4294967295</_XHarnessArgs>
5354
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--env --engine-arg=DOTNET_WASI_PRINT_EXIT_CODE=1</_XHarnessArgs>
5455
<_XHarnessArgs Condition="'$(WasmXHarnessArgsCli)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgsCli)</_XHarnessArgs>
5556

@@ -87,6 +88,13 @@
8788
<PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' != 'true'">
8889
<WasmBuildOnlyAfterPublish>true</WasmBuildOnlyAfterPublish>
8990

91+
<!-- Test projects are libraries (OutputType=Library), for which WasmGenerateAppBundle defaults to false.
92+
Unlike browser (where the WebAssembly SDK bundles via static web assets), wasi has no such SDK, so the
93+
in-tree WasiAppBuilder must run to populate the AppBundle. Force it on for local wasi test builds.
94+
Set unconditionally: WasmApp.Common.targets is imported earlier and already defaulted this to 'false',
95+
so a '== ''' guard would not take effect. A '/p:' override remains a global property and still wins. -->
96+
<WasmGenerateAppBundle>true</WasmGenerateAppBundle>
97+
9098
<!-- wasm's publish targets will trigger publish, so we shouldn't do that -->
9199
<PublishTestAsSelfContainedDependsOn />
92100
<WasmNestedPublishAppDependsOn>PrepareForWasiBuildApp;$(WasmNestedPublishAppDependsOn)</WasmNestedPublishAppDependsOn>

src/libraries/Common/src/Interop/Wasi/System.Native/Interop.SocketEvent.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ internal enum SocketEvents : int
2020
}
2121

2222
[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetWasiSocketDescriptor")]
23-
internal static unsafe partial Error GetWasiSocketDescriptor(IntPtr socket, IntPtr* entry);
23+
internal static unsafe partial Error GetWasiSocketDescriptor(IntPtr socket, IntPtr* entry, int* socketType);
24+
25+
[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_WasiSubscribeSocketPollable")]
26+
internal static partial int WasiSubscribeSocketPollable(int kind, int handle);
2427
}
2528
}

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/src/System.Net.Http.csproj

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -457,16 +457,18 @@
457457
<Compile Include="System\Net\Http\WasiHttpHandler\WasiOutputStream.cs" />
458458
<Compile Include="System\Net\Http\WasiHttpHandler\WasiInputStream.cs" />
459459
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttp.cs" />
460-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs" />
461-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.cs" />
462-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_0.OutgoingHandlerInterop.cs" />
463-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_0.TypesInterop.cs" />
464-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.ErrorInterop.cs" />
465-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.cs" />
466-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs" />
467-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.cs" />
468-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs" />
469-
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.StreamsInterop.cs" />
460+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.clocks.v0_2_8.IMonotonicClockImports.cs" />
461+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.clocks.v0_2_8.MonotonicClockImportsInterop.cs" />
462+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.http.v0_2_8.IOutgoingHandlerImports.cs" />
463+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.http.v0_2_8.ITypesImports.cs" />
464+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.http.v0_2_8.OutgoingHandlerImportsInterop.cs" />
465+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.http.v0_2_8.TypesImportsInterop.cs" />
466+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.io.v0_2_8.ErrorImportsInterop.cs" />
467+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.io.v0_2_8.IErrorImports.cs" />
468+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.io.v0_2_8.IPollImports.cs" />
469+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.io.v0_2_8.IStreamsImports.cs" />
470+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.io.v0_2_8.PollImportsInterop.cs" />
471+
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.Imports.wasi.io.v0_2_8.StreamsImportsInterop.cs" />
470472
</ItemGroup>
471473

472474
<ItemGroup>
Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
1+
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
22
// <auto-generated />
33
#nullable enable
4+
45
using System;
5-
using System.Runtime.CompilerServices;
6-
using System.Collections;
76
using System.Runtime.InteropServices;
8-
using System.Text;
9-
using System.Collections.Generic;
10-
using System.Diagnostics;
11-
using System.Diagnostics.CodeAnalysis;
7+
using System.Collections.Concurrent;
8+
using System.Threading;
9+
using System.Threading.Tasks;
1210

1311
namespace WasiHttpWorld {
1412

15-
internal interface IWasiHttpWorld {
13+
internal interface IWasiHttpWorldImports{
1614
}
1715

1816
internal readonly struct None {}
1917

20-
[StructLayout(LayoutKind.Sequential)]
21-
internal readonly struct Result<Ok, Err>
18+
[global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Sequential)]
19+
internal readonly struct Result<TOk, TErr>
2220
{
2321
internal readonly byte Tag;
2422
private readonly object value;
@@ -29,47 +27,54 @@ private Result(byte tag, object value)
2927
this.value = value;
3028
}
3129

32-
internal static Result<Ok, Err> ok(Ok ok)
30+
internal static Result<TOk, TErr> Ok(TOk ok)
3331
{
34-
return new Result<Ok, Err>(OK, ok!);
32+
return new Result<TOk, TErr>(Tags.Ok, ok!);
3533
}
3634

37-
internal static Result<Ok, Err> err(Err err)
35+
internal static Result<TOk, TErr> Err(TErr err)
3836
{
39-
return new Result<Ok, Err>(ERR, err!);
37+
return new Result<TOk, TErr>(Tags.Err, err!);
4038
}
4139

42-
internal bool IsOk => Tag == OK;
43-
internal bool IsErr => Tag == ERR;
40+
internal bool IsOk => Tag == Tags.Ok;
41+
internal bool IsErr => Tag == Tags.Err;
4442

45-
internal Ok AsOk
43+
internal TOk AsOk
4644
{
4745
get
4846
{
49-
if (Tag == OK)
50-
return (Ok)value;
51-
else
52-
throw new ArgumentException("expected OK, got " + Tag);
47+
if (Tag == Tags.Ok)
48+
{
49+
return (TOk)value;
50+
}
51+
52+
throw new global::System.ArgumentException("expected k, got " + Tag);
5353
}
5454
}
5555

56-
internal Err AsErr
56+
internal TErr AsErr
5757
{
5858
get
5959
{
60-
if (Tag == ERR)
61-
return (Err)value;
62-
else
63-
throw new ArgumentException("expected ERR, got " + Tag);
60+
if (Tag == Tags.Err)
61+
{
62+
return (TErr)value;
63+
}
64+
65+
throw new global::System.ArgumentException("expected Err, got " + Tag);
6466
}
6567
}
6668

67-
internal const byte OK = 0;
68-
internal const byte ERR = 1;
69+
internal class Tags
70+
{
71+
internal const byte Ok = 0;
72+
internal const byte Err = 1;
73+
}
6974
}
7075

7176
internal class Option<T> {
72-
private static Option<T> none = new();
77+
private static Option<T> none = new ();
7378

7479
private Option()
7580
{
@@ -84,24 +89,13 @@ internal Option(T v)
8489

8590
internal static Option<T> None => none;
8691

87-
[MemberNotNullWhen(true, nameof(Value))]
92+
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute(true, nameof(Value))]
8893
internal bool HasValue { get; }
8994

9095
internal T? Value { get; }
9196
}
9297

93-
internal static class InteropString
94-
{
95-
internal static IntPtr FromString(string input, out int length)
96-
{
97-
var utf8Bytes = Encoding.UTF8.GetBytes(input);
98-
length = utf8Bytes.Length;
99-
var gcHandle = GCHandle.Alloc(utf8Bytes, GCHandleType.Pinned);
100-
return gcHandle.AddrOfPinnedObject();
101-
}
102-
}
103-
104-
internal class WitException: Exception {
98+
internal class WitException: global::System.Exception {
10599
internal object Value { get; }
106100
internal uint NestingLevel { get; }
107101

@@ -112,10 +106,25 @@ internal WitException(object v, uint level)
112106
}
113107
}
114108

115-
namespace exports {
116-
internal static class WasiHttpWorld
109+
internal class WitException<T>: WitException {
110+
internal T TypedValue { get { return (T)this.Value;} }
111+
112+
internal WitException(T v, uint level) : base(v!, level)
117113
{
118114
}
119115
}
120116

117+
internal static class MemoryHelper
118+
{
119+
internal static unsafe void* AlignStackPtr(void* stackAddress, uint alignment)
120+
{
121+
return (void*)(((nint)stackAddress) + ((int)alignment - 1) & -(int)alignment);
122+
}
123+
}
124+
125+
namespace Imports {
126+
internal partial class WasiHttpWorldImportsInterop : IWasiHttpWorldImports
127+
{}
128+
}
129+
121130
}

src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttpHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
using System.Threading;
1313
using System.Threading.Tasks;
1414
using WasiHttpWorld;
15-
using WasiHttpWorld.wit.imports.wasi.http.v0_2_0;
16-
using WasiHttpWorld.wit.imports.wasi.io.v0_2_0;
17-
using static WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes;
15+
using WasiHttpWorld.wit.Imports.wasi.http.v0_2_8;
16+
using WasiHttpWorld.wit.Imports.wasi.io.v0_2_8;
17+
using static WasiHttpWorld.wit.Imports.wasi.http.v0_2_8.ITypesImports;
1818

1919
namespace System.Net.Http
2020
{
@@ -48,7 +48,7 @@ public async Task<HttpResponseMessage> SendRequestAsync(HttpRequestMessage reque
4848
#pragma warning restore CA2025
4949
#pragma warning restore CS4014
5050

51-
future = OutgoingHandlerInterop.Handle(outgoingRequest, null);
51+
future = IOutgoingHandlerImports.Handle(outgoingRequest, null);
5252

5353
using var incomingResponse = await SendRequest(cancellationToken).ConfigureAwait(false);
5454

0 commit comments

Comments
 (0)