Skip to content
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

feat(proxy-wasm) implement response body buffering #381

Merged
merged 3 commits into from
Dec 2, 2023

Commits on Dec 2, 2023

  1. chore(util) always invoke the Proxy-Wasm SDK scripts

    This is a fix for CI, in which the SDK directories may exist but the
    examples are not built and/or copied to `t/`. In any case, better making
    the scripts idempotent than not invoking them at all and risking an
    inconsistent state.
    thibaultcha committed Dec 2, 2023
    Configuration menu
    Copy the full SHA
    c815acb View commit details
    Browse the repository at this point in the history
  2. feat(proxy-wasm) implement response body buffering

    First, this commit fixes `on_response_body` execution of requests when
    they issue subrequests that produce a body (see 004-on_http_phases.t).
    This unlocks testing of response body buffering via subrequests
    producing chunked responses (`ngx_chain_t` buffers).
    
    Response body buffering itself is implemented as part of
    ngx_http_wasm_filter_module, so as to be usable from other components
    than just proxy-wasm. Response body buffering is enabled via
    `rctx->resp_buffering` which is enabled when `ngx_wasm_ops_resume`
    returns `NGX_AGAIN`, which for filters translates to returning `PAUSE`
    from `on_http_response_body`.
    
    If and when the response body buffers are full, then the next
    `on_http_response_body` call will have `eof=false`, and more invocations
    can be expected, as the body *must* be proxied in chunks.
    
    If the response body fit in the buffers, then the next
    `on_http_response_body` call will have `eof=true` as one would expected.
    
    We catch "response body already requested" in ngx_proxy_wasm to produce
    a proxy-wasm error message, as this feature is currently only exposed
    through it.
    thibaultcha committed Dec 2, 2023
    Configuration menu
    Copy the full SHA
    7199954 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2f0486c View commit details
    Browse the repository at this point in the history