diff --git a/BUILD b/BUILD index 4ad2ede29..3b436a65f 100644 --- a/BUILD +++ b/BUILD @@ -58,7 +58,7 @@ cc_test( deps = [ ":include14", "@com_google_absl//absl/base", - "@com_google_absl//absl/strings:strings", + "@com_google_absl//absl/strings", "@com_google_absl//absl/types:optional", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", @@ -72,7 +72,7 @@ cc_test( deps = [ ":include14", "@com_google_absl//absl/base", - "@com_google_absl//absl/strings:strings", + "@com_google_absl//absl/strings", "@com_google_absl//absl/types:optional", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", diff --git a/context_test.cc b/context_test.cc index 14cd13771..73d83c5e5 100644 --- a/context_test.cc +++ b/context_test.cc @@ -1,3 +1,17 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "include/proxy-wasm/context.h" #include "gtest/gtest.h" diff --git a/include/proxy-wasm/context.h b/include/proxy-wasm/context.h index a975d95b1..2c9640fc8 100644 --- a/include/proxy-wasm/context.h +++ b/include/proxy-wasm/context.h @@ -92,11 +92,13 @@ class ContextBase { WasmBase *wasm() const { return wasm_; } uint32_t id() const { return id_; } - bool isVmContext() { return id_ == 0; } - bool isRootContext() { return root_context_id_ == 0; } + bool isVmContext() const { return id_ == 0; } + bool isRootContext() const { return root_context_id_ == 0; } ContextBase *root_context() { return root_context_; } - string_view root_id() const { return plugin_->root_id_; } - string_view log_prefix() const { return plugin_->log_prefix(); } + string_view root_id() const { return isRootContext() ? root_id_ : plugin_->root_id_; } + string_view log_prefix() const { + return isRootContext() ? root_log_prefix_ : plugin_->log_prefix(); + } WasmVm *wasmVm() const; // Called before deleting the context. diff --git a/src/base64.cc b/src/base64.cc index 0bcf04cb6..8e65962e9 100644 --- a/src/base64.cc +++ b/src/base64.cc @@ -1,4 +1,19 @@ -// Public Domain: https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64 +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Original source Public Domain: +// https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64 #include "base64.h" const static char encodeLookup[] = diff --git a/src/base64.h b/src/base64.h index 878b9c612..1340ed768 100644 --- a/src/base64.h +++ b/src/base64.h @@ -1,4 +1,20 @@ -// Public Domain: https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64 +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Original source Public Domain: +// https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64 + #pragma once #include diff --git a/wasm_vm_test.cc b/wasm_vm_test.cc index 317a96b07..8fef6dc5a 100644 --- a/wasm_vm_test.cc +++ b/wasm_vm_test.cc @@ -1,3 +1,17 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "include/proxy-wasm/wasm_vm.h" #include "gtest/gtest.h"