Skip to content

Commit

Permalink
Update istio/proxy for GRPC v1.1.1 (#89)
Browse files Browse the repository at this point in the history
* Fix proxy_flow to align grpc 1.1.1
  • Loading branch information
lizan committed Feb 14, 2017
1 parent 9617591 commit 8d42ba1
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions src/grpc/proxy_flow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down Expand Up @@ -130,6 +131,8 @@ namespace {
Status ProcessDownstreamHeaders(
const std::multimap<std::string, std::string> &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
Expand All @@ -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<const char *>(value_slice.begin()),
Expand Down
4 changes: 2 additions & 2 deletions src/nginx/t/grpc_api_key.t
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
1 change: 1 addition & 0 deletions src/nginx/t/grpc_interop_metadata.t
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
4 changes: 2 additions & 2 deletions src/nginx/t/grpc_streaming.t
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
6 changes: 5 additions & 1 deletion test/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ cc_library(
deps = [
":grpc-test_proto",
"//external:api_manager_utils",
"//external:grpc++",
],
)

Expand Down Expand Up @@ -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(
Expand Down
6 changes: 5 additions & 1 deletion test/transcoding/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ cc_binary(
name = "bookstore-server",
testonly = 1,
srcs = ["bookstore-server.cc"],
deps = [":bookstore"],
deps = [
":bookstore",
"//external:grpc++",
],
)

cc_binary(
Expand All @@ -57,6 +60,7 @@ cc_binary(
":bookstore",
"//external:protobuf",
"//external:gflags",
"//external:grpc++",
],
)

Expand Down

0 comments on commit 8d42ba1

Please sign in to comment.