-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
4 times, most recently
from
August 11, 2023 05:24
73885b8
to
73317c7
Compare
Pull Request Test Coverage Report for Build 5985850296
💛 - Coveralls |
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
from
August 12, 2023 00:44
73317c7
to
8536819
Compare
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
from
August 25, 2023 02:32
8536819
to
845480a
Compare
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
7 times, most recently
from
August 26, 2023 16:30
d5d6767
to
f3e45e7
Compare
thibaultcha
commented
Aug 31, 2023
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
from
September 29, 2023 01:27
f3e45e7
to
ee69bbb
Compare
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
from
October 6, 2023 17:25
ee69bbb
to
5d41e0f
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #381 +/- ##
===================================================
+ Coverage 90.06765% 90.12546% +0.05781%
===================================================
Files 46 46
Lines 9756 9884 +128
===================================================
+ Hits 8787 8908 +121
- Misses 969 976 +7
|
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
from
November 8, 2023 17:43
5d41e0f
to
d43853a
Compare
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
2 times, most recently
from
November 30, 2023 22:47
7946f70
to
371c932
Compare
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
from
December 1, 2023 02:27
371c932
to
3b22acf
Compare
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
3 times, most recently
from
December 1, 2023 17:25
396a1ca
to
2da4081
Compare
thibaultcha
force-pushed
the
feat/response-body-buffering
branch
4 times, most recently
from
December 2, 2023 03:15
6a5ec16
to
bd5342b
Compare
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.
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
force-pushed
the
feat/response-body-buffering
branch
from
December 2, 2023 17:36
bd5342b
to
2f0486c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First this 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 whenngx_wasm_ops_resume
returnsNGX_AGAIN
, which for filters translates to returningPAUSE
fromon_http_response_body
.If and when the response body buffers are full, then the next
on_http_response_body
call will haveeof=false
, and more invocations can be expected, as the body must be proxied in chunks.If the response body fits in the buffers, then the next
on_http_response_body
call will haveeof=true
as one would expect.We catch "response body buffering already requested" in ngx_proxy_wasm to produce a proxy-wasm error message, as this feature is currently only exposed through it.
gzip tests- out of scope (dev env binary work)changelog- out of scope