From 55a475447afc0f2e2c38fb587faa2cc063fd02ce Mon Sep 17 00:00:00 2001 From: "Adam C. Foltzer" Date: Fri, 16 Feb 2024 16:20:21 -0800 Subject: [PATCH 1/3] Add `take-headers` to get owned headers from incoming messages Closes #102. See discussion in that issue for the motivation and design of this change. --- imports.md | 25 +++++++++++++++++++++++++ proxy.md | 25 +++++++++++++++++++++++++ wit/types.wit | 10 ++++++++++ 3 files changed, 60 insertions(+) diff --git a/imports.md b/imports.md index 5dff42a..bb320cc 100644 --- a/imports.md +++ b/imports.md @@ -971,6 +971,18 @@ the parent incoming-request is drop +

[method]incoming-request.take-headers: func

+

Gives the headers associated with this request as an owned resource. +Will only return success at most once, and subsequent calls will return +error.

+
Params
+ +
Return values
+

[method]incoming-request.consume: func

Gives the incoming-body associated with this request. Will only return success at most once, and subsequent calls will return error.

@@ -1240,6 +1252,7 @@ implementation determine how to respond with an HTTP error response.

[method]incoming-response.consume: func

Returns the incoming body. May be called at most once. Returns error if called additional times.

+

Deprecated in favor of into-parts.

Params
@@ -496,7 +496,7 @@ is ready for reading, before performing the splice.

-

Import interface wasi:http/types@0.2.0

+

Import interface wasi:http/types@0.2.1-draft

This interface defines all of the types and methods for implementing HTTP Requests and Responses, both incoming and outgoing, as well as their headers, trailers, and bodies.

@@ -1478,7 +1478,7 @@ represented as a u64.

-

Import interface wasi:http/outgoing-handler@0.2.0

+

Import interface wasi:http/outgoing-handler@0.2.1-draft

This interface defines a handler of outgoing HTTP Requests. It should be imported by components which wish to make HTTP Requests.


@@ -1556,7 +1556,7 @@ also known as Unix Time.
  • datetime
  • -

    Export interface wasi:http/incoming-handler@0.2.0

    +

    Export interface wasi:http/incoming-handler@0.2.1-draft


    Types

    type incoming-request

    diff --git a/wit/proxy.wit b/wit/proxy.wit index 26a975e..052ceb1 100644 --- a/wit/proxy.wit +++ b/wit/proxy.wit @@ -1,4 +1,4 @@ -package wasi:http@0.2.0; +package wasi:http@0.2.1-draft; /// The `wasi:http/imports` world imports all the APIs for HTTP proxies. /// It is intended to be `include`d in other worlds.