From 2d3dedde43be978d919e4f32570a4d472784ccf9 Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Thu, 9 Feb 2017 21:46:53 +0000 Subject: [PATCH 1/3] update istio and BUILD --- WORKSPACE | 2 +- test/grpc/BUILD | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 37dfd50ce..a2798b7f0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -26,7 +26,7 @@ # # A Bazel (http://bazel.io) workspace for the Google Cloud Endpoints runtime. -ISTIO_PROXY = "76355366e4adc6d4002d69d5aafa57e1606338ee" +ISTIO_PROXY = "6e372fc510de08da504c2dd21060c09255c1aee7" git_repository( name = "nginx", diff --git a/test/grpc/BUILD b/test/grpc/BUILD index d71b2ec69..db8eb2f41 100644 --- a/test/grpc/BUILD +++ b/test/grpc/BUILD @@ -93,6 +93,7 @@ cc_library( deps = [ ":grpc-test_proto", "//external:api_manager_utils", + "//external:grpc++", ], ) @@ -121,7 +122,10 @@ cc_binary( name = "grpc-test-server", testonly = 1, srcs = ["grpc-test-server.cc"], - deps = [":grpc-test_proto"], + deps = [ + ":grpc-test_proto", + "//external:grpc++", + ], ) load( From b5b531ab2ef9e0da157b8a993e5be01a396b01ed Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Thu, 9 Feb 2017 16:38:23 -0800 Subject: [PATCH 2/3] Fix proxy_flow to align grpc 1.1.1 --- src/grpc/proxy_flow.cc | 9 ++++++--- src/nginx/t/grpc_api_key.t | 4 ++-- src/nginx/t/grpc_interop_metadata.t | 1 + src/nginx/t/grpc_streaming.t | 4 ++-- test/transcoding/BUILD | 6 +++++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/grpc/proxy_flow.cc b/src/grpc/proxy_flow.cc index 009f37491..0561bee22 100644 --- a/src/grpc/proxy_flow.cc +++ b/src/grpc/proxy_flow.cc @@ -31,6 +31,7 @@ #include "grpc/support/alloc.h" extern "C" { +#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/security/util/b64.h" } @@ -130,6 +131,8 @@ namespace { Status ProcessDownstreamHeaders( const std::multimap &headers, ::grpc::ClientContext *context) { + static grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + for (const auto &it : headers) { // GRPC runtime libraries use "-bin" suffix to detect binary headers and // properly apply base64 encoding & decoding as headers are sent and @@ -140,8 +143,8 @@ Status ProcessDownstreamHeaders( continue; } ::grpc::Slice value_slice( - grpc_base64_decode_with_len(it.second.c_str(), it.second.length(), - false), + grpc_base64_decode_with_len(&exec_ctx, it.second.c_str(), + it.second.length(), false), ::grpc::Slice::STEAL_REF); std::string binary_value( reinterpret_cast(value_slice.begin()), @@ -168,7 +171,7 @@ Status ProcessUpstreamHeaders( continue; } - // grpc_base64_encode may have added padding. If not needed, remove them. + // grpc_base64_encode may have adde//github.com/cloudendpoints/espd padding. If not needed, remove them. size_t len = strlen(b64_value); while (len > 0 && b64_value[len - 1] == '=') { len--; diff --git a/src/nginx/t/grpc_api_key.t b/src/nginx/t/grpc_api_key.t index 7c25cfe7f..7a2a31c82 100644 --- a/src/nginx/t/grpc_api_key.t +++ b/src/nginx/t/grpc_api_key.t @@ -135,8 +135,8 @@ my $expected_report_body = ServiceControl::gen_report_body({ 'http_method' => 'POST', 'log_message' => 'Method: test.grpc.Test.Echo', 'response_code' => '200', - 'request_size' => ($^O eq 'darwin' ? 313 : 315), - 'request_bytes' => ($^O eq 'darwin' ? 313 : 315), + 'request_size' => ($^O eq 'darwin' ? 305 : 307), + 'request_bytes' => ($^O eq 'darwin' ? 305 : 307), 'streaming_request_message_counts' => 1, 'streaming_response_message_counts' => 1, }); diff --git a/src/nginx/t/grpc_interop_metadata.t b/src/nginx/t/grpc_interop_metadata.t index 8d8b57114..88c4f2731 100644 --- a/src/nginx/t/grpc_interop_metadata.t +++ b/src/nginx/t/grpc_interop_metadata.t @@ -89,6 +89,7 @@ my @test_cases = ( ); foreach my $case (@test_cases) { + <>; my $result = &ApiManager::run_grpc_interop_test($t, $Http2NginxPort, $case, '--api_key', 'api-key'); is($result, 0, "${case} test completed as expected."); diff --git a/src/nginx/t/grpc_streaming.t b/src/nginx/t/grpc_streaming.t index 77336b09f..fcf3c0004 100644 --- a/src/nginx/t/grpc_streaming.t +++ b/src/nginx/t/grpc_streaming.t @@ -138,8 +138,8 @@ my $expected_report_body = ServiceControl::gen_report_body({ 'http_method' => 'POST', 'log_message' => 'Method: test.grpc.Test.EchoStream', 'response_code' => '200', - 'request_size' => ($^O eq 'darwin' ? 499 : 501), - 'request_bytes' => ($^O eq 'darwin' ? 499 : 501), + 'request_size' => ($^O eq 'darwin' ? 491 : 493), + 'request_bytes' => ($^O eq 'darwin' ? 491 : 493), 'streaming_request_message_counts' => 10, 'streaming_response_message_counts' => 10, }); diff --git a/test/transcoding/BUILD b/test/transcoding/BUILD index a24998fe0..dfc50e2d1 100644 --- a/test/transcoding/BUILD +++ b/test/transcoding/BUILD @@ -45,7 +45,10 @@ cc_binary( name = "bookstore-server", testonly = 1, srcs = ["bookstore-server.cc"], - deps = [":bookstore"], + deps = [ + ":bookstore", + "//external:grpc++", + ], ) cc_binary( @@ -57,6 +60,7 @@ cc_binary( ":bookstore", "//external:protobuf", "//external:gflags", + "//external:grpc++", ], ) From 412f8312c7fd05bcadf1a5122ff9c7ff5cd002ae Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Mon, 13 Feb 2017 14:48:44 -0800 Subject: [PATCH 3/3] remove incidentally added comment --- src/grpc/proxy_flow.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grpc/proxy_flow.cc b/src/grpc/proxy_flow.cc index 0561bee22..811a13cb9 100644 --- a/src/grpc/proxy_flow.cc +++ b/src/grpc/proxy_flow.cc @@ -171,7 +171,7 @@ Status ProcessUpstreamHeaders( continue; } - // grpc_base64_encode may have adde//github.com/cloudendpoints/espd padding. If not needed, remove them. + // grpc_base64_encode may have added padding. If not needed, remove them. size_t len = strlen(b64_value); while (len > 0 && b64_value[len - 1] == '=') { len--;