Skip to content

Commit

Permalink
review: always process HTTP headers before HTTP body.
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
  • Loading branch information
PiotrSikora committed Nov 12, 2020
1 parent 38eba4d commit 684a217
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,8 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "WebAssembly for Proxies (C++ host implementation)",
project_desc = "WebAssembly for Proxies (C++ host implementation)",
project_url = "https://github.com/proxy-wasm/proxy-wasm-cpp-host",
version = "4741d2f1cd5eb250f66d0518238c333353259d56",
sha256 = "30fc4becfcc5a95ac875fc5a0658a91aa7ddedd763b52d7810c13ed35d9d81aa",
version = "15827110ac35fdac9abdb6b05d04ee7ee2044dae",
sha256 = "77a2671205eb0973bee375a1bee4099edef991350433981f6e3508780318117d",
strip_prefix = "proxy-wasm-cpp-host-{version}",
urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-host/archive/{version}.tar.gz"],
use_category = ["dataplane_ext"],
Expand All @@ -882,7 +882,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
"envoy.filters.network.wasm",
"envoy.stat_sinks.wasm",
],
release_date = "2020-11-10",
release_date = "2020-11-12",
cpe = "N/A",
),
emscripten_toolchain = dict(
Expand Down
30 changes: 15 additions & 15 deletions test/extensions/filters/http/wasm/wasm_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ TEST_P(WasmHttpFilterTest, HeadersStopAndContinue) {
EXPECT_CALL(filter(), log_(spdlog::level::info, Eq(absl::string_view("header path /"))));
EXPECT_CALL(filter(), log_(spdlog::level::warn, Eq(absl::string_view("onDone 2"))));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}, {"server", "envoy-wasm-pause"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, true));
root_context_->onTick(0);
filter().clearRouteCache();
Expand Down Expand Up @@ -616,7 +616,7 @@ TEST_P(WasmHttpFilterTest, AsyncCall) {
callbacks->onSuccess(request, std::move(response_message));
return proxy_wasm::WasmResult::Ok;
}));
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

EXPECT_NE(callbacks, nullptr);
Expand Down Expand Up @@ -665,7 +665,7 @@ TEST_P(WasmHttpFilterTest, StopAndResumeViaAsyncCall) {
EXPECT_EQ(proxy_wasm::current_context_, nullptr);
}));

EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

EXPECT_NE(callbacks, nullptr);
Expand Down Expand Up @@ -730,7 +730,7 @@ TEST_P(WasmHttpFilterTest, AsyncCallFailure) {
} else {
EXPECT_CALL(rootContext(), log_(spdlog::level::info, Eq("async_call failed")));
}
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

EXPECT_NE(callbacks, nullptr);
Expand Down Expand Up @@ -761,7 +761,7 @@ TEST_P(WasmHttpFilterTest, AsyncCallAfterDestroyed) {
}));

EXPECT_CALL(filter(), log_(spdlog::level::info, Eq("onRequestHeaders")));
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

EXPECT_CALL(request, cancel()).WillOnce([&]() { callbacks = nullptr; });
Expand Down Expand Up @@ -821,7 +821,7 @@ TEST_P(WasmHttpFilterTest, GrpcCall) {
}));
EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("response")));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

ProtobufWkt::Value value;
Expand Down Expand Up @@ -905,7 +905,7 @@ TEST_P(WasmHttpFilterTest, GrpcCallFailure) {
}));
EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("failure bad")));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

// Test some additional error paths.
Expand Down Expand Up @@ -966,7 +966,7 @@ TEST_P(WasmHttpFilterTest, GrpcCallCancel) {
return std::move(client_factory);
}));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

rootContext().onQueueReady(0);
Expand Down Expand Up @@ -1010,7 +1010,7 @@ TEST_P(WasmHttpFilterTest, GrpcCallClose) {
return std::move(client_factory);
}));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

rootContext().onQueueReady(1);
Expand Down Expand Up @@ -1055,7 +1055,7 @@ TEST_P(WasmHttpFilterTest, GrpcCallAfterDestroyed) {
}));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};

EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

EXPECT_CALL(request, cancel()).WillOnce([&]() { callbacks = nullptr; });
Expand Down Expand Up @@ -1119,7 +1119,7 @@ TEST_P(WasmHttpFilterTest, GrpcStream) {
EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("response response")));
EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("close done")));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

ProtobufWkt::Value value;
Expand Down Expand Up @@ -1150,7 +1150,7 @@ TEST_P(WasmHttpFilterTest, GrpcStreamCloseLocal) {
EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("response close")));
EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("close ok")));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

ProtobufWkt::Value value;
Expand Down Expand Up @@ -1180,7 +1180,7 @@ TEST_P(WasmHttpFilterTest, GrpcStreamCloseRemote) {
EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("response response")));
EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("close close")));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

ProtobufWkt::Value value;
Expand All @@ -1207,7 +1207,7 @@ TEST_P(WasmHttpFilterTest, GrpcStreamCancel) {
setupGrpcStreamTest(callbacks);

Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

ProtobufWkt::Value value;
Expand Down Expand Up @@ -1235,7 +1235,7 @@ TEST_P(WasmHttpFilterTest, GrpcStreamOpenAtShutdown) {

EXPECT_CALL(rootContext(), log_(spdlog::level::debug, Eq("response response")));
Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, false));

ProtobufWkt::Value value;
Expand Down

0 comments on commit 684a217

Please sign in to comment.