diff --git a/imports.md b/imports.md index 5dff42a..85ec2d0 100644 --- a/imports.md +++ b/imports.md @@ -12,8 +12,8 @@ It is intended to be included in other worlds.

  • interface wasi:cli/stderr@0.2.0
  • interface wasi:cli/stdin@0.2.0
  • interface wasi:clocks/monotonic-clock@0.2.0
  • -
  • interface wasi:http/types@0.2.0
  • -
  • interface wasi:http/outgoing-handler@0.2.0
  • +
  • interface wasi:http/types@0.2.1-draft
  • +
  • interface wasi:http/outgoing-handler@0.2.1-draft
  • interface wasi:clocks/wall-clock@0.2.0
  • @@ -561,7 +561,7 @@ occured.

    -

    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.

    @@ -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.

    @@ -1248,6 +1260,18 @@ if called additional times.

    +

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

    +

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

    +
    Params
    + +
    Return values
    +

    [method]incoming-body.stream: func

    Returns the contents of the body, as a stream of bytes.

    Returns success on first call: the stream representing the contents @@ -1447,7 +1471,7 @@ but those will be reported by the incoming-body

  • option<result<result<own<incoming-response>, error-code>>>
  • -

    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.


    diff --git a/proxy.md b/proxy.md index b3945ad..1f20830 100644 --- a/proxy.md +++ b/proxy.md @@ -10,18 +10,18 @@ outgoing HTTP requests.

  • interface wasi:clocks/monotonic-clock@0.2.0
  • interface wasi:io/error@0.2.0
  • interface wasi:io/streams@0.2.0
  • -
  • interface wasi:http/types@0.2.0
  • +
  • interface wasi:http/types@0.2.1-draft
  • interface wasi:random/random@0.2.0
  • interface wasi:cli/stdout@0.2.0
  • interface wasi:cli/stderr@0.2.0
  • interface wasi:cli/stdin@0.2.0
  • -
  • interface wasi:http/outgoing-handler@0.2.0
  • +
  • interface wasi:http/outgoing-handler@0.2.1-draft
  • interface wasi:clocks/wall-clock@0.2.0
  • Exports:
  • @@ -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.

    @@ -906,6 +906,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.

    @@ -1183,6 +1195,18 @@ if called additional times.

    +

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

    +

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

    +
    Params
    + +
    Return values
    +

    [method]incoming-body.stream: func

    Returns the contents of the body, as a stream of bytes.

    Returns success on first call: the stream representing the contents @@ -1454,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.


    @@ -1532,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. diff --git a/wit/types.wit b/wit/types.wit index 755ac6a..f546c57 100644 --- a/wit/types.wit +++ b/wit/types.wit @@ -242,6 +242,11 @@ interface types { /// `incoming-request` before all children are dropped will trap. headers: func() -> headers; + /// Gives the `headers` associated with this request as an owned resource. + /// Will only return success at most once, and subsequent calls will return + /// error. + take-headers: func() -> result; + /// Gives the `incoming-body` associated with this request. Will only /// return success at most once, and subsequent calls will return error. consume: func() -> result; @@ -392,6 +397,11 @@ interface types { /// Returns the incoming body. May be called at most once. Returns error /// if called additional times. consume: func() -> result; + + /// Returns the `headers` associated with this response as an owned + /// resource. Will only return success at most once, and subsequent calls + /// will return error. + take-headers: func() -> result; } /// Represents an incoming HTTP Request or Response's Body.