You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm writing an envoy plugin that replaces certain HTTP responses and I'm confused about using set_http_response_body(start, size, value); (in the plugin implementation) and expect_set_buffer_bytes (in the integration test)
A simple example code that replaces HTTP responses:
From my testing and debugging with an actual running Envoy instance, it looks like the size parameter has to be set EXACTLY to body_size argument, otherwise, there would be leftovers from the previous response (if the original response is larger than the replacement).
If I'm not mistaken, the data flow goes like this:
However, passing the original body size doesn't work with this tool. .expect_set_buffer_bytes(Some(BufferType::HttpResponseBody), Some(expected_body)) computes the size internally from expected_body and cannot be changed.
I did a dummy workaround in my fork (vojty@a0af2e9) that makes it work.
Is this a bug or am I missing something?
The text was updated successfully, but these errors were encountered:
From my testing and debugging with an actual running Envoy instance, it looks like the size parameter has to be set EXACTLY to body_size argument, otherwise, there would be leftovers from the previous response (if the original response is larger than the replacement).
That's correct, and this is done to allow users to perform prepend/append/inject/replace without excessive copies and multitude of APIs, but perhaps it's not a very intuitive interface. Feel free to file an issue in the Rust SDK.
However, passing the original body size doesn't work with this tool. .expect_set_buffer_bytes(Some(BufferType::HttpResponseBody), Some(expected_body)) computes the size internally from expected_body and cannot be changed. I did a dummy workaround in my fork (vojty@a0af2e9) that makes it work.
That's correct, and this is done to allow users to perform prepend/append/inject/replace without excessive copies and multitude of APIs, but perhaps it's not a very intuitive interface. Feel free to file an issue in the Rust SDK.
Thanks for clarifying this. It makes sense but it's not clear. Maybe extending examples or adding short documentation in the SDK repository would be enough. I'll file an issue there
Hello,
I'm writing an envoy plugin that replaces certain HTTP responses and I'm confused about using
set_http_response_body(start, size, value);
(in the plugin implementation) andexpect_set_buffer_bytes
(in the integration test)A simple example code that replaces HTTP responses:
From my testing and debugging with an actual running Envoy instance, it looks like the
size
parameter has to be set EXACTLY tobody_size
argument, otherwise, there would be leftovers from the previous response (if the original response is larger than the replacement).If I'm not mistaken, the data flow goes like this:
so the buffer is drained up to
size
argument.However, passing the original body size doesn't work with this tool.
.expect_set_buffer_bytes(Some(BufferType::HttpResponseBody), Some(expected_body))
computes the size internally fromexpected_body
and cannot be changed.I did a dummy workaround in my fork (vojty@a0af2e9) that makes it work.
Is this a bug or am I missing something?
The text was updated successfully, but these errors were encountered: