Skip to content

Commit

Permalink
wasm: fix xds attribute support (envoyproxy#31620)
Browse files Browse the repository at this point in the history
Commit Message: wires xds attribute into wasm, follow-up to envoyproxy#31319
Additional Description: none
Risk Level: low
Testing: done
Docs Changes: none
Release Notes: none
  • Loading branch information
kyessenov authored Jan 10, 2024
1 parent 5caa8e3 commit c121ee4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions source/extensions/common/wasm/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ Context::findValue(absl::string_view name, Protobuf::Arena* arena, bool last) co
// In order to delegate to the StreamActivation method, we have to set the
// context properties to match the Wasm context properties in all callbacks
// (e.g. onLog or onEncodeHeaders) for the duration of the call.
if (root_local_info_) {
local_info_ = root_local_info_;
} else if (plugin_) {
local_info_ = &plugin()->localInfo();
}
activation_info_ = info;
activation_request_headers_ = request_headers_ ? request_headers_ : access_log_request_headers_;
activation_response_headers_ =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Context for TestStream {}
impl HttpContext for TestStream {
fn on_http_request_headers(&mut self, _: usize, _: bool) -> Action {
if self
.get_property(vec!["node", "metadata", "wasm_node_get_key"])
.get_property(vec!["xds", "node", "metadata", "wasm_node_get_key"])
.is_none()
{
debug!("missing node metadata");
Expand Down
2 changes: 1 addition & 1 deletion test/extensions/filters/http/wasm/test_data/test_cpp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ FilterHeadersStatus TestContext::onRequestHeaders(uint32_t, bool) {
}
} else if (test == "metadata") {
std::string value;
if (!getValue({"node", "metadata", "wasm_node_get_key"}, &value)) {
if (!getValue({"xds", "node", "metadata", "wasm_node_get_key"}, &value)) {
logDebug("missing node metadata");
}
auto r = setFilterStateStringValue("wasm_request_set_key", "wasm_request_set_value");
Expand Down

0 comments on commit c121ee4

Please sign in to comment.