Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static bool OpenSslPresentOnSystem
{
get
{
if (IsWindows || IsAndroid || UsesMobileAppleCrypto || IsBrowser)
if (IsWindows || IsAndroid || UsesMobileAppleCrypto || IsBrowser || IsWasi)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,20 @@ public async Task<HttpResponseMessage> SendRequestAsync(HttpRequestMessage reque
// we will leave scope of this method
// we need to pass the ownership of the request and this wrapper to the response (via response content stream)
// unless we know that we are not streaming anymore
incomingStream = new WasiInputStream(this, incomingResponse.Consume());// passing self ownership, passing body ownership
incomingStream = new WasiInputStream(this, incomingResponse.Consume(), response);// passing self ownership, passing body ownership
response.Content = new StreamContent(incomingStream); // passing incomingStream ownership to SendAsync() caller
WasiHttpInterop.ConvertResponseHeaders(incomingResponse, response);

return response;
}
catch (WitException e)
{
Dispose();
throw new HttpRequestException(WasiHttpInterop.ErrorCodeToString((ErrorCode)e.Value), e);
}
catch (Exception)
{
Dispose();
throw;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ public static void ConvertResponseHeaders(IncomingResponse incomingResponse, Htt
}
}

public static HttpResponseHeaders ConvertTrailingResponseHeaders(Fields headers)
{
var result = new HttpResponseHeaders();
foreach ((var key, var value) in headers.Entries())
{
result.Add(key, Encoding.UTF8.GetString(value));
}
return result;
}

private static bool IsContentHeader(string headerName)
{
return HeaderDescriptor.TryGet(headerName, out HeaderDescriptor descriptor) && (descriptor.HeaderType & HttpHeaderType.Content) != 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable

Expand Down Expand Up @@ -605,23 +605,18 @@ internal Fields(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]fields"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~Fields() {
Dispose(false);
}

internal static class ConstructorWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[constructor]fields"), WasmImportLinkage]
Expand Down Expand Up @@ -1071,23 +1066,18 @@ internal IncomingRequest(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]incoming-request"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~IncomingRequest() {
Dispose(false);
}

internal static class MethodWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-request.method"), WasmImportLinkage]
Expand Down Expand Up @@ -1385,23 +1375,18 @@ internal OutgoingRequest(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]outgoing-request"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~OutgoingRequest() {
Dispose(false);
}

internal static class ConstructorWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[constructor]outgoing-request"), WasmImportLinkage]
Expand Down Expand Up @@ -2069,23 +2054,18 @@ internal RequestOptions(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]request-options"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~RequestOptions() {
Dispose(false);
}

internal static class ConstructorWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[constructor]request-options"), WasmImportLinkage]
Expand Down Expand Up @@ -2401,23 +2381,18 @@ internal ResponseOutparam(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]response-outparam"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~ResponseOutparam() {
Dispose(false);
}

internal static class SetWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[static]response-outparam.set"), WasmImportLinkage]
Expand Down Expand Up @@ -3409,23 +3384,18 @@ internal IncomingResponse(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]incoming-response"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~IncomingResponse() {
Dispose(false);
}

internal static class StatusWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-response.status"), WasmImportLinkage]
Expand Down Expand Up @@ -3528,23 +3498,18 @@ internal IncomingBody(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]incoming-body"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~IncomingBody() {
Dispose(false);
}

internal static class StreamWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]incoming-body.stream"), WasmImportLinkage]
Expand Down Expand Up @@ -3629,23 +3594,18 @@ internal FutureTrailers(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]future-trailers"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~FutureTrailers() {
Dispose(false);
}

internal static class SubscribeWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]future-trailers.subscribe"), WasmImportLinkage]
Expand Down Expand Up @@ -4353,23 +4313,18 @@ internal OutgoingResponse(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]outgoing-response"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~OutgoingResponse() {
Dispose(false);
}

internal static class ConstructorWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[constructor]outgoing-response"), WasmImportLinkage]
Expand Down Expand Up @@ -4535,23 +4490,18 @@ internal OutgoingBody(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]outgoing-body"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~OutgoingBody() {
Dispose(false);
}

internal static class WriteWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]outgoing-body.write"), WasmImportLinkage]
Expand Down Expand Up @@ -5263,23 +5213,18 @@ internal FutureIncomingResponse(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:http/types@0.2.1", EntryPoint = "[resource-drop]future-incoming-response"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~FutureIncomingResponse() {
Dispose(false);
}

internal static class SubscribeWasmInterop
{
[DllImport("wasi:http/types@0.2.1", EntryPoint = "[method]future-incoming-response.subscribe"), WasmImportLinkage]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable

Expand Down Expand Up @@ -46,23 +46,18 @@ internal Error(THandle handle) {

public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}

[DllImport("wasi:io/error@0.2.1", EntryPoint = "[resource-drop]error"), WasmImportLinkage]
private static extern void wasmImportResourceDrop(int p0);

protected virtual void Dispose(bool disposing) {
if (Handle != 0) {
if (disposing && Handle != 0) {
wasmImportResourceDrop(Handle);
Handle = 0;
}
}

~Error() {
Dispose(false);
}

internal static class ToDebugStringWasmInterop
{
[DllImport("wasi:io/error@0.2.1", EntryPoint = "[method]error.to-debug-string"), WasmImportLinkage]
Expand Down
Loading
Loading