-
Notifications
You must be signed in to change notification settings - Fork 107
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
use case that is not working - http_dispatch_call in on_http_response_body and on_http_call_response_body want to update response body #156
Comments
ping. Anyone have some thoughts on this? |
The flow that works for me is something like this:
|
Thanks! Yes, that works for me too. But I need the initial on_http_response_body to retrieve some information used on the dispatch call and that is where I am stuck and it would seem that proxy is in a state that cannot change the body, since I got to on_http_response_body complete data |
Not sure I understand what the problem is. This flow works on my end:
Are you getting some error? |
I am issuing thee HTTP dispatch in the on_http_response_body (not in the on_http_request_body so how do I receive the response_body, then do dispatch, and from on_response_call_body modify the response_body going to requestor. Hopefully tha tshows thee difference. Two difference sequences in two different states. I will attach the envoy trace and see if that helps clarify but seems to be we can't buffeer on_http_response and then change it (or can we?) |
Just tried and it works with my codebase (uses GRPC instead of HTTP but should work the same). Version 0.1.4 of proxy-wasm.
And I can see the modified body being returned to a curl command. One other thing, have you removed the content-length header before modifying the body? |
Great news, let me try that. I thought I removed the content-length but
will make sure and post logs
…On Wed, Jun 22, 2022 at 7:28 AM Francisco Camenforte Torres < ***@***.***> wrote:
Just tried and it works with my codebase (uses GRPC instead of HTTP but
should work the same). Version 0.1.4 of proxy-wasm.
1. on_http_response_body() -> wait until _end_of_stream = true, then
perform dispatch_grpc_call(), then return Action::Pause
2. on_grpc_call_response() -> perform set_http_response_body(), then
call resume_http_response()
And I can see the modified body being returned to a curl command.
One other thing, have you removed the content-length header before
modifying the body?
—
Reply to this email directly, view it on GitHub
<#156 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGMVR5TIHCMPV7I3TIJB6ADVQMPJ5ANCNFSM5YMANL2A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Jose Retelny
Google Cloud PSO - Application Engineer
***@***.***
phone:650-499-1516
|
Great to hear. I thought I remove content header on the response_header but will make suree |
Also make sure you are setting the start and size parameters correctly in set_http_response_body If I remember correctly, a (size < new body size) will perform a prepend operation on the body |
This is similar error, there is no content-length header, so set_request_headers fail [2022-06-22 22:52:17.219][516433][critical][wasm] [external/envoy/source/extensions/common/wasm/context.cc:1227] wasm log my_plugin my_root_id my_vm_id: panicked at 'unexpected status: 2', /home/jr/.cargo/registry/src/github.com-1ecc6299db9ec823/proxy-wasm-0.1.4/src/hostcalls.rs:211:23 |
error.log |
Yes, that's a different case than the body. When you're at or past the on_http_request/response_body callbacks, the HTTP headers have already been forwarded up or downstream. It's not allowed to buffer the headers along with the body. So no header modification is possible at that stage. I've been hit by the same problem, you can only modify headers when in the on_http_request/response_headers callback. I think this is related: proxy-wasm/proxy-wasm-cpp-host#143 |
Logic is working and using shared data to store intermediate results from http_dispatch_call to on_http_call_response_body, but when I try to replace the response_body. No method is working, generates a panic.
tried combinations of these
It there something I am missing. probably best is if you can help on the right calls to update the response body and then finish during the fn on_http_call_response(&mut self,
The text was updated successfully, but these errors were encountered: