-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[wasi] wasi:http + WasiHttpHandler #103752
Merged
Merged
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e4e09ed
- rebase
pavelsavara 6a5b4ac
more
pavelsavara 09934af
fix
pavelsavara 05ed759
fix provisioning
pavelsavara da07824
fix WBT
pavelsavara a293990
Merge branch 'main' into wasip2-2
pavelsavara 716bedf
Merge branch 'main' into wasip2-2
pavelsavara eeab643
fix samples and WBT
pavelsavara 9dbfaf2
Merge branch 'main' into wasip2-2
pavelsavara 3358a40
fix WBT
pavelsavara 930fc56
feedback
pavelsavara 06d0b8d
Merge branch 'main' into wasip2-2
pavelsavara c684605
lib testing
pavelsavara ad3872a
Merge branch 'main' into wasip2-2
pavelsavara 644e41d
feedback, cleanup
pavelsavara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
src/libraries/System.Net.Http/src/System/Net/Http/WasiHttpHandler/WasiHttp.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// Generated by `wit-bindgen` 0.27.0. DO NOT EDIT! | ||
// <auto-generated /> | ||
#nullable enable | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Collections; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace WasiHttpWorld { | ||
|
||
internal interface IWasiHttpWorld { | ||
} | ||
|
||
internal readonly struct None {} | ||
|
||
[StructLayout(LayoutKind.Sequential)] | ||
internal readonly struct Result<Ok, Err> | ||
{ | ||
internal readonly byte Tag; | ||
private readonly object value; | ||
|
||
private Result(byte tag, object value) | ||
{ | ||
Tag = tag; | ||
this.value = value; | ||
} | ||
|
||
internal static Result<Ok, Err> ok(Ok ok) | ||
{ | ||
return new Result<Ok, Err>(OK, ok!); | ||
} | ||
|
||
internal static Result<Ok, Err> err(Err err) | ||
{ | ||
return new Result<Ok, Err>(ERR, err!); | ||
} | ||
|
||
internal bool IsOk => Tag == OK; | ||
internal bool IsErr => Tag == ERR; | ||
|
||
internal Ok AsOk | ||
{ | ||
get | ||
{ | ||
if (Tag == OK) | ||
return (Ok)value; | ||
else | ||
throw new ArgumentException("expected OK, got " + Tag); | ||
} | ||
} | ||
|
||
internal Err AsErr | ||
{ | ||
get | ||
{ | ||
if (Tag == ERR) | ||
return (Err)value; | ||
else | ||
throw new ArgumentException("expected ERR, got " + Tag); | ||
} | ||
} | ||
|
||
internal const byte OK = 0; | ||
internal const byte ERR = 1; | ||
} | ||
|
||
internal class Option<T> { | ||
private static Option<T> none = new (); | ||
|
||
private Option() | ||
{ | ||
HasValue = false; | ||
} | ||
|
||
internal Option(T v) | ||
{ | ||
HasValue = true; | ||
Value = v; | ||
} | ||
|
||
internal static Option<T> None => none; | ||
|
||
[MemberNotNullWhen(true, nameof(Value))] | ||
internal bool HasValue { get; } | ||
|
||
internal T? Value { get; } | ||
} | ||
|
||
internal static class InteropString | ||
{ | ||
internal static IntPtr FromString(string input, out int length) | ||
{ | ||
var utf8Bytes = Encoding.UTF8.GetBytes(input); | ||
length = utf8Bytes.Length; | ||
var gcHandle = GCHandle.Alloc(utf8Bytes, GCHandleType.Pinned); | ||
return gcHandle.AddrOfPinnedObject(); | ||
} | ||
} | ||
|
||
internal class WitException: Exception { | ||
internal object Value { get; } | ||
internal uint NestingLevel { get; } | ||
|
||
internal WitException(object v, uint level) | ||
{ | ||
Value = v; | ||
NestingLevel = level; | ||
} | ||
} | ||
|
||
namespace exports { | ||
internal static class WasiHttpWorld | ||
{ | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please move this to the ItemGroup below which has all the
Reference
items