Skip to content

re support the StopIteration status #417

Open
@wbpcode

Description

@wbpcode
Contributor

We converted all StopIteration to StopAll at #95.

It make the wasm filter couldn't work in some typically scenarios, for example, custom auth may require to parse body to complete the authentication, but return Continue when calling onRequestHeaders will proxy headers to uptream before we complete the authentication, return StopAll will prohibit the wasm to access body.

Activity

mpwarres

mpwarres commented on Sep 19, 2024

@mpwarres
Contributor

#143 discusses the same (or similar) issue, suggest deduping and reviving the discussion there, unless there is a different aspect to this issue. @wbpcode WDYT?

wbpcode

wbpcode commented on Sep 19, 2024

@wbpcode
ContributorAuthor

yea, it's the same issue. This is a very important feature for a bunch of filters.

Without it, we even cannot set the content length correctly after mutate the body. It's weird.

PiotrSikora

PiotrSikora commented on Oct 19, 2024

@PiotrSikora
Member

Without it, we even cannot set the content length correctly after mutate the body. It's weird.

You don't need to set Content-Length header. If you plan to mutate body, then you should remove Content-Length header and either set Content-Encoding: chunked yourself or it will be automatically applied by Envoy.

wbpcode

wbpcode commented on Oct 20, 2024

@wbpcode
ContributorAuthor

Without it, we even cannot set the content length correctly after mutate the body. It's weird.

You don't need to set Content-Length header. If you plan to mutate body, then you should remove Content-Length header and either set Content-Encoding: chunked yourself or it will be automatically applied by Envoy.

It just an example, more usual cases are do something based on the body and change the request headers. Or just need to do some verification based on body and need to stop iteration of header filter chain.

PiotrSikora

PiotrSikora commented on Oct 20, 2024

@PiotrSikora
Member

It just an example, more usual cases are do something based on the body and change the request headers. Or just need to do some verification based on body and need to stop iteration of header filter chain.

Agreed. And as you know we're adding support for better control over that in ABI v0.3 (proxy-wasm/spec#63) to address other use cases.

However, I wanted to point out that your example is an anti-pattern and you should never buffer the request/response body in order to set Content-Length header, even when you have StopIternation or similar mechanism.

wbpcode

wbpcode commented on Oct 20, 2024

@wbpcode
ContributorAuthor

It just an example, more usual cases are do something based on the body and change the request headers. Or just need to do some verification based on body and need to stop iteration of header filter chain.

Agreed. And as you know we're adding support for better control over that in ABI v0.3 (proxy-wasm/spec#63) to address other use cases.

However, I wanted to point out that your example is an anti-pattern and you should never buffer the request/response body in order to set Content-Length header, even when you have StopIternation or similar mechanism.

Yeah, basically we will remove the content length directly to force Envoy to used the chunked way in practices. I will update the description to avoid misdirecting others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mpwarres@PiotrSikora@wbpcode

        Issue actions

          re support the StopIteration status · Issue #417 · proxy-wasm/proxy-wasm-cpp-host