From c7c0d69d8b411f1c5102bfd186aa2f6992c2e59c Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Sat, 10 Mar 2018 17:27:15 -0800 Subject: [PATCH 01/25] Secure channels: use the right authority --- BUILD | 18 ++- CMakeLists.txt | 34 +---- Makefile | 42 +----- build.yaml | 13 +- config.m4 | 1 + config.w32 | 1 + gRPC-C++.podspec | 2 + gRPC-Core.podspec | 3 + grpc.gemspec | 2 + grpc.gyp | 4 + package.xml | 2 + .../client_channel/client_channel_plugin.cc | 4 +- .../client_channel/lb_policy/grpclb/grpclb.cc | 11 +- .../chttp2/client/insecure/channel_create.cc | 36 ++++- .../client/secure/secure_channel_create.cc | 25 +++- .../lib/channel/client_authority_filter.cc | 117 +++++++++++++++ .../lib/channel/client_authority_filter.h | 34 +++++ .../credentials/ssl/ssl_credentials.cc | 2 +- .../security_connector/security_connector.cc | 10 +- src/core/lib/surface/channel.cc | 80 +++++----- src/core/lib/surface/init.cc | 8 + src/python/grpcio/grpc_core_dependencies.py | 1 + .../channel/minimal_stack_is_minimal_test.cc | 26 ++-- test/core/end2end/tests/default_host.cc | 9 +- test/core/surface/BUILD | 12 -- .../core/surface/invalid_channel_args_test.cc | 137 ------------------ tools/doxygen/Doxyfile.c++.internal | 1 + tools/doxygen/Doxyfile.core.internal | 2 + .../generated/sources_and_headers.json | 20 +-- tools/run_tests/generated/tests.json | 24 --- 30 files changed, 331 insertions(+), 350 deletions(-) create mode 100644 src/core/lib/channel/client_authority_filter.cc create mode 100644 src/core/lib/channel/client_authority_filter.h delete mode 100644 test/core/surface/invalid_channel_args_test.cc diff --git a/BUILD b/BUILD index 9c99f95fcdf..49f45f8218b 100644 --- a/BUILD +++ b/BUILD @@ -676,6 +676,7 @@ grpc_cc_library( "src/core/lib/channel/channel_args.cc", "src/core/lib/channel/channel_stack.cc", "src/core/lib/channel/channel_stack_builder.cc", + "src/core/lib/channel/client_authority_filter.cc", "src/core/lib/channel/connected_channel.cc", "src/core/lib/channel/handshaker.cc", "src/core/lib/channel/handshaker_factory.cc", @@ -811,6 +812,7 @@ grpc_cc_library( "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", + "src/core/lib/channel/client_authority_filter.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/handshaker.h", @@ -1313,6 +1315,7 @@ grpc_cc_library( srcs = [ "src/core/lib/http/httpcli_security_connector.cc", "src/core/lib/security/context/security_context.cc", + "src/core/lib/security/credentials/alts/alts_credentials.cc", "src/core/lib/security/credentials/composite/composite_credentials.cc", "src/core/lib/security/credentials/credentials.cc", "src/core/lib/security/credentials/credentials_metadata.cc", @@ -1326,7 +1329,6 @@ grpc_cc_library( "src/core/lib/security/credentials/oauth2/oauth2_credentials.cc", "src/core/lib/security/credentials/plugin/plugin_credentials.cc", "src/core/lib/security/credentials/ssl/ssl_credentials.cc", - "src/core/lib/security/credentials/alts/alts_credentials.cc", "src/core/lib/security/security_connector/alts_security_connector.cc", "src/core/lib/security/security_connector/security_connector.cc", "src/core/lib/security/transport/client_auth_filter.cc", @@ -1340,6 +1342,7 @@ grpc_cc_library( ], hdrs = [ "src/core/lib/security/context/security_context.h", + "src/core/lib/security/credentials/alts/alts_credentials.h", "src/core/lib/security/credentials/composite/composite_credentials.h", "src/core/lib/security/credentials/credentials.h", "src/core/lib/security/credentials/fake/fake_credentials.h", @@ -1351,7 +1354,6 @@ grpc_cc_library( "src/core/lib/security/credentials/oauth2/oauth2_credentials.h", "src/core/lib/security/credentials/plugin/plugin_credentials.h", "src/core/lib/security/credentials/ssl/ssl_credentials.h", - "src/core/lib/security/credentials/alts/alts_credentials.h", "src/core/lib/security/security_connector/alts_security_connector.h", "src/core/lib/security/security_connector/security_connector.h", "src/core/lib/security/transport/auth_filters.h", @@ -1614,8 +1616,8 @@ grpc_cc_library( "src/core/tsi/alts/frame_protector/frame_handler.h", "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h", "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h", - "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h", "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h", + "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h", "src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h", "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h", "src/core/tsi/transport_security_grpc.h", @@ -1675,31 +1677,31 @@ grpc_cc_library( ], language = "c++", deps = [ - "alts_proto", - "gpr", - "grpc_base", + "alts_proto", + "gpr", + "grpc_base", ], ) grpc_cc_library( name = "tsi", srcs = [ - "src/core/tsi/alts_transport_security.cc", "src/core/tsi/alts/handshaker/alts_handshaker_client.cc", "src/core/tsi/alts/handshaker/alts_tsi_event.cc", "src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc", "src/core/tsi/alts/handshaker/alts_tsi_utils.cc", + "src/core/tsi/alts_transport_security.cc", "src/core/tsi/fake_transport_security.cc", "src/core/tsi/ssl_transport_security.cc", "src/core/tsi/transport_security_grpc.cc", ], hdrs = [ - "src/core/tsi/alts_transport_security.h", "src/core/tsi/alts/handshaker/alts_handshaker_client.h", "src/core/tsi/alts/handshaker/alts_tsi_event.h", "src/core/tsi/alts/handshaker/alts_tsi_handshaker.h", "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h", "src/core/tsi/alts/handshaker/alts_tsi_utils.h", + "src/core/tsi/alts_transport_security.h", "src/core/tsi/fake_transport_security.h", "src/core/tsi/ssl_transport_security.h", "src/core/tsi/ssl_types.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dfbdcb85a0..d3e84c77513 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,7 +289,6 @@ add_dependencies(buildtests_c grpc_completion_queue_test) add_dependencies(buildtests_c grpc_completion_queue_threading_test) add_dependencies(buildtests_c grpc_credentials_test) add_dependencies(buildtests_c grpc_fetch_oauth2) -add_dependencies(buildtests_c grpc_invalid_channel_args_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_c grpc_json_token_test) endif() @@ -856,6 +855,7 @@ add_library(grpc src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc + src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -1231,6 +1231,7 @@ add_library(grpc_cronet src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc + src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -1597,6 +1598,7 @@ add_library(grpc_test_util src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc + src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -1886,6 +1888,7 @@ add_library(grpc_test_util_unsecure src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc + src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -2155,6 +2158,7 @@ add_library(grpc_unsecure src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc + src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -2958,6 +2962,7 @@ add_library(grpc++_cronet src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc + src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -6811,33 +6816,6 @@ target_link_libraries(grpc_fetch_oauth2 gpr ) -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - -add_executable(grpc_invalid_channel_args_test - test/core/surface/invalid_channel_args_test.cc -) - - -target_include_directories(grpc_invalid_channel_args_test - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} -) - -target_link_libraries(grpc_invalid_channel_args_test - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc_test_util - grpc - gpr_test_util - gpr -) - endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) diff --git a/Makefile b/Makefile index a298fafd6bd..02e1215459a 100644 --- a/Makefile +++ b/Makefile @@ -1013,7 +1013,6 @@ grpc_completion_queue_threading_test: $(BINDIR)/$(CONFIG)/grpc_completion_queue_ grpc_create_jwt: $(BINDIR)/$(CONFIG)/grpc_create_jwt grpc_credentials_test: $(BINDIR)/$(CONFIG)/grpc_credentials_test grpc_fetch_oauth2: $(BINDIR)/$(CONFIG)/grpc_fetch_oauth2 -grpc_invalid_channel_args_test: $(BINDIR)/$(CONFIG)/grpc_invalid_channel_args_test grpc_json_token_test: $(BINDIR)/$(CONFIG)/grpc_json_token_test grpc_jwt_verifier_test: $(BINDIR)/$(CONFIG)/grpc_jwt_verifier_test grpc_print_google_default_creds_token: $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token @@ -1448,7 +1447,6 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/grpc_completion_queue_threading_test \ $(BINDIR)/$(CONFIG)/grpc_credentials_test \ $(BINDIR)/$(CONFIG)/grpc_fetch_oauth2 \ - $(BINDIR)/$(CONFIG)/grpc_invalid_channel_args_test \ $(BINDIR)/$(CONFIG)/grpc_json_token_test \ $(BINDIR)/$(CONFIG)/grpc_jwt_verifier_test \ $(BINDIR)/$(CONFIG)/grpc_security_connector_test \ @@ -1977,8 +1975,6 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/grpc_completion_queue_threading_test || ( echo test grpc_completion_queue_threading_test failed ; exit 1 ) $(E) "[RUN] Testing grpc_credentials_test" $(Q) $(BINDIR)/$(CONFIG)/grpc_credentials_test || ( echo test grpc_credentials_test failed ; exit 1 ) - $(E) "[RUN] Testing grpc_invalid_channel_args_test" - $(Q) $(BINDIR)/$(CONFIG)/grpc_invalid_channel_args_test || ( echo test grpc_invalid_channel_args_test failed ; exit 1 ) $(E) "[RUN] Testing grpc_json_token_test" $(Q) $(BINDIR)/$(CONFIG)/grpc_json_token_test || ( echo test grpc_json_token_test failed ; exit 1 ) $(E) "[RUN] Testing grpc_jwt_verifier_test" @@ -3164,6 +3160,7 @@ LIBGRPC_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -3541,6 +3538,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -3908,6 +3906,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -4190,6 +4189,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -4439,6 +4439,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -5241,6 +5242,7 @@ LIBGRPC++_CRONET_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -11798,38 +11800,6 @@ endif endif -GRPC_INVALID_CHANNEL_ARGS_TEST_SRC = \ - test/core/surface/invalid_channel_args_test.cc \ - -GRPC_INVALID_CHANNEL_ARGS_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_INVALID_CHANNEL_ARGS_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/grpc_invalid_channel_args_test: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/grpc_invalid_channel_args_test: $(GRPC_INVALID_CHANNEL_ARGS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GRPC_INVALID_CHANNEL_ARGS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/grpc_invalid_channel_args_test - -endif - -$(OBJDIR)/$(CONFIG)/test/core/surface/invalid_channel_args_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - -deps_grpc_invalid_channel_args_test: $(GRPC_INVALID_CHANNEL_ARGS_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(GRPC_INVALID_CHANNEL_ARGS_TEST_OBJS:.o=.dep) -endif -endif - - GRPC_JSON_TOKEN_TEST_SRC = \ test/core/security/json_token_test.cc \ diff --git a/build.yaml b/build.yaml index e2bb8bfa9ff..eab2897706a 100644 --- a/build.yaml +++ b/build.yaml @@ -232,6 +232,7 @@ filegroups: - src/core/lib/channel/channel_args.cc - src/core/lib/channel/channel_stack.cc - src/core/lib/channel/channel_stack_builder.cc + - src/core/lib/channel/client_authority_filter.cc - src/core/lib/channel/connected_channel.cc - src/core/lib/channel/handshaker.cc - src/core/lib/channel/handshaker_factory.cc @@ -388,6 +389,7 @@ filegroups: - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_stack.h - src/core/lib/channel/channel_stack_builder.h + - src/core/lib/channel/client_authority_filter.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - src/core/lib/channel/handshaker.h @@ -2576,17 +2578,6 @@ targets: - grpc - gpr_test_util - gpr -- name: grpc_invalid_channel_args_test - build: test - language: c - src: - - test/core/surface/invalid_channel_args_test.cc - deps: - - grpc_test_util - - grpc - - gpr_test_util - - gpr - uses_polling: false - name: grpc_json_token_test build: test language: c diff --git a/config.m4 b/config.m4 index 7270051b0b0..3b061e565e6 100644 --- a/config.m4 +++ b/config.m4 @@ -84,6 +84,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ diff --git a/config.w32 b/config.w32 index d73acc11186..1b89419c57a 100644 --- a/config.w32 +++ b/config.w32 @@ -61,6 +61,7 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\channel\\channel_args.cc " + "src\\core\\lib\\channel\\channel_stack.cc " + "src\\core\\lib\\channel\\channel_stack_builder.cc " + + "src\\core\\lib\\channel\\client_authority_filter.cc " + "src\\core\\lib\\channel\\connected_channel.cc " + "src\\core\\lib\\channel\\handshaker.cc " + "src\\core\\lib\\channel\\handshaker_factory.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 65a5dc66b4c..6334ac433d3 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -343,6 +343,7 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', + 'src/core/lib/channel/client_authority_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', @@ -522,6 +523,7 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', + 'src/core/lib/channel/client_authority_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 7f61719cb16..5827b397ffb 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -354,6 +354,7 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', + 'src/core/lib/channel/client_authority_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', @@ -498,6 +499,7 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -908,6 +910,7 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', + 'src/core/lib/channel/client_authority_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', diff --git a/grpc.gemspec b/grpc.gemspec index 89a3812376e..06520c1f952 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -284,6 +284,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/channel_args.h ) s.files += %w( src/core/lib/channel/channel_stack.h ) s.files += %w( src/core/lib/channel/channel_stack_builder.h ) + s.files += %w( src/core/lib/channel/client_authority_filter.h ) s.files += %w( src/core/lib/channel/connected_channel.h ) s.files += %w( src/core/lib/channel/context.h ) s.files += %w( src/core/lib/channel/handshaker.h ) @@ -428,6 +429,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/channel_args.cc ) s.files += %w( src/core/lib/channel/channel_stack.cc ) s.files += %w( src/core/lib/channel/channel_stack_builder.cc ) + s.files += %w( src/core/lib/channel/client_authority_filter.cc ) s.files += %w( src/core/lib/channel/connected_channel.cc ) s.files += %w( src/core/lib/channel/handshaker.cc ) s.files += %w( src/core/lib/channel/handshaker_factory.cc ) diff --git a/grpc.gyp b/grpc.gyp index 0b60efe978a..a398e4f4606 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -236,6 +236,7 @@ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -568,6 +569,7 @@ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -785,6 +787,7 @@ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -981,6 +984,7 @@ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', diff --git a/package.xml b/package.xml index fc7ba68e8ba..0abcb89738b 100644 --- a/package.xml +++ b/package.xml @@ -291,6 +291,7 @@ + @@ -435,6 +436,7 @@ + diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.cc b/src/core/ext/filters/client_channel/client_channel_plugin.cc index 3c3a97532ff..ed3ebd26968 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.cc +++ b/src/core/ext/filters/client_channel/client_channel_plugin.cc @@ -39,6 +39,8 @@ static bool append_filter(grpc_channel_stack_builder* builder, void* arg) { builder, static_cast(arg), nullptr, nullptr); } +// Only used for direct channels, as they don't create subchannels, which is +// where default authority is handled for regular channels. static bool set_default_host_if_unset(grpc_channel_stack_builder* builder, void* unused) { const grpc_channel_args* args = @@ -69,7 +71,7 @@ void grpc_client_channel_init(void) { grpc_proxy_mapper_registry_init(); grpc_register_http_proxy_mapper(); grpc_subchannel_index_init(); - grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MIN, + grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MIN, set_default_host_if_unset, nullptr); grpc_channel_init_register_stage( GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter, diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index cb39e4224e3..49918e11b70 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -504,9 +504,7 @@ GrpcLb::BalancerCallState::BalancerCallState( // the polling entities from client_channel. GPR_ASSERT(grpclb_policy()->server_name_ != nullptr); GPR_ASSERT(grpclb_policy()->server_name_[0] != '\0'); - grpc_slice host = - grpc_slice_from_copied_string(grpclb_policy()->server_name_); - grpc_millis deadline = + const grpc_millis deadline = grpclb_policy()->lb_call_timeout_ms_ == 0 ? GRPC_MILLIS_INF_FUTURE : ExecCtx::Get()->Now() + grpclb_policy()->lb_call_timeout_ms_; @@ -514,8 +512,7 @@ GrpcLb::BalancerCallState::BalancerCallState( grpclb_policy()->lb_channel_, nullptr, GRPC_PROPAGATE_DEFAULTS, grpclb_policy_->interested_parties(), GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD, - &host, deadline, nullptr); - grpc_slice_unref_internal(host); + nullptr, deadline, nullptr); // Init the LB call request payload. grpc_grpclb_request* request = grpc_grpclb_request_create(grpclb_policy()->server_name_); @@ -982,6 +979,10 @@ grpc_channel_args* BuildBalancerChannelArgs( // with the one from the grpclb policy, used to propagate updates to // the LB channel. GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR, + // The LB channel should use the authority indicated by the target + // authority table (see \a grpc_lb_policy_grpclb_modify_lb_channel_args), + // as opposed to the authority from the parent channel. + GRPC_ARG_DEFAULT_AUTHORITY, }; // Channel args to add. const grpc_arg args_to_add[] = { diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index 60800365b81..8424cc5bc64 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -38,11 +38,41 @@ static void client_channel_factory_ref( static void client_channel_factory_unref( grpc_client_channel_factory* cc_factory) {} +static grpc_channel_args* add_default_authority_if_not_present( + const grpc_channel_args* args) { + const bool has_default_authority = + grpc_channel_args_find(args, GRPC_ARG_DEFAULT_AUTHORITY) != nullptr; + grpc_arg new_args[1]; + size_t num_new_args = 0; + grpc_core::UniquePtr default_authority; + if (!has_default_authority) { + const grpc_arg* server_uri_arg = + grpc_channel_args_find(args, GRPC_ARG_SERVER_URI); + const char* server_uri_str = grpc_channel_arg_get_string(server_uri_arg); + GPR_ASSERT(server_uri_str != nullptr); + default_authority = + grpc_core::ResolverRegistry::GetDefaultAuthority(server_uri_str); + GPR_ASSERT(default_authority != nullptr); + new_args[num_new_args++] = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_DEFAULT_AUTHORITY), default_authority.get()); + } + return grpc_channel_args_copy_and_add(args, new_args, num_new_args); +} + static grpc_subchannel* client_channel_factory_create_subchannel( grpc_client_channel_factory* cc_factory, const grpc_subchannel_args* args) { + grpc_subchannel_args* final_sc_args = + static_cast(gpr_malloc(sizeof(*final_sc_args))); + memcpy(final_sc_args, args, sizeof(*args)); + final_sc_args->args = add_default_authority_if_not_present(args->args); + grpc_connector* connector = grpc_chttp2_connector_create(); - grpc_subchannel* s = grpc_subchannel_create(connector, args); + grpc_subchannel* s = grpc_subchannel_create(connector, final_sc_args); grpc_connector_unref(connector); + + grpc_channel_args_destroy( + const_cast(final_sc_args->args)); + gpr_free(final_sc_args); return s; } @@ -56,8 +86,8 @@ static grpc_channel* client_channel_factory_create_channel( // Add channel arg containing the server URI. grpc_core::UniquePtr canonical_target = grpc_core::ResolverRegistry::AddDefaultPrefixIfNeeded(target); - grpc_arg arg = grpc_channel_arg_string_create((char*)GRPC_ARG_SERVER_URI, - canonical_target.get()); + grpc_arg arg = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_SERVER_URI), canonical_target.get()); const char* to_remove[] = {GRPC_ARG_SERVER_URI}; grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc index a82009ff69d..5ce73a95d76 100644 --- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc @@ -71,9 +71,6 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args( grpc_uri* server_uri = grpc_uri_parse(server_uri_str, true /* supress errors */); GPR_ASSERT(server_uri != nullptr); - const char* server_uri_path; - server_uri_path = - server_uri->path[0] == '/' ? server_uri->path + 1 : server_uri->path; const grpc_core::TargetAuthorityTable* target_authority_table = grpc_core::FindTargetAuthorityTableInArgs(args->args); grpc_core::UniquePtr authority; @@ -98,33 +95,49 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args( // authority table was present or because the target was not present // in the table), fall back to using the original server URI. if (authority == nullptr) { - authority.reset(gpr_strdup(server_uri_path)); + authority = + grpc_core::ResolverRegistry::GetDefaultAuthority(server_uri_str); } + grpc_arg args_to_add[2]; + size_t num_args_to_add = 0; + if (grpc_channel_args_find(args->args, GRPC_ARG_DEFAULT_AUTHORITY) == + nullptr) { + // If the channel args don't already contain GRPC_ARG_DEFAULT_AUTHORITY, add + // the arg, setting it to the value just obtained. + args_to_add[num_args_to_add++] = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_DEFAULT_AUTHORITY), authority.get()); + } + grpc_channel_args* args_with_authority = + grpc_channel_args_copy_and_add(args->args, args_to_add, num_args_to_add); grpc_uri_destroy(server_uri); grpc_channel_security_connector* subchannel_security_connector = nullptr; // Create the security connector using the credentials and target name. grpc_channel_args* new_args_from_connector = nullptr; const grpc_security_status security_status = grpc_channel_credentials_create_security_connector( - channel_credentials, authority.get(), args->args, + channel_credentials, authority.get(), args_with_authority, &subchannel_security_connector, &new_args_from_connector); if (security_status != GRPC_SECURITY_OK) { gpr_log(GPR_ERROR, "Failed to create secure subchannel for secure name '%s'", authority.get()); + grpc_channel_args_destroy(args_with_authority); return nullptr; } grpc_arg new_security_connector_arg = grpc_security_connector_to_arg(&subchannel_security_connector->base); grpc_channel_args* new_args = grpc_channel_args_copy_and_add( - new_args_from_connector != nullptr ? new_args_from_connector : args->args, + new_args_from_connector != nullptr ? new_args_from_connector + : args_with_authority, &new_security_connector_arg, 1); + GRPC_SECURITY_CONNECTOR_UNREF(&subchannel_security_connector->base, "lb_channel_create"); if (new_args_from_connector != nullptr) { grpc_channel_args_destroy(new_args_from_connector); } + grpc_channel_args_destroy(args_with_authority); grpc_subchannel_args* final_sc_args = static_cast(gpr_malloc(sizeof(*final_sc_args))); memcpy(final_sc_args, args, sizeof(*args)); diff --git a/src/core/lib/channel/client_authority_filter.cc b/src/core/lib/channel/client_authority_filter.cc new file mode 100644 index 00000000000..57c5d29a930 --- /dev/null +++ b/src/core/lib/channel/client_authority_filter.cc @@ -0,0 +1,117 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * 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 +#include + +#include +#include +#include + +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/channel/client_authority_filter.h" +#include "src/core/lib/gpr/string.h" +#include "src/core/lib/slice/slice_internal.h" +#include "src/core/lib/slice/slice_string_helpers.h" +#include "src/core/lib/surface/call.h" +#include "src/core/lib/surface/channel_init.h" +#include "src/core/lib/surface/channel_stack_type.h" +#include "src/core/lib/transport/static_metadata.h" + +namespace { + +struct call_data { + grpc_linked_mdelem authority_storage; + grpc_call_combiner* call_combiner; +}; + +struct channel_data { + grpc_slice default_authority; +}; + +void authority_start_transport_stream_op_batch( + grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); + // Handle send_initial_metadata. + auto* initial_metadata = + batch->payload->send_initial_metadata.send_initial_metadata; + // If the initial metadata doesn't already contain :authority, add it. + if (batch->send_initial_metadata && + initial_metadata->idx.named.authority == nullptr) { + grpc_error* error = grpc_metadata_batch_add_head( + initial_metadata, &calld->authority_storage, + grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY, + grpc_slice_ref(chand->default_authority))); + if (error != GRPC_ERROR_NONE) { + grpc_transport_stream_op_batch_finish_with_failure(batch, error, + calld->call_combiner); + return; + } + } + // Pass control down the stack. + grpc_call_next_op(elem, batch); +} + +/* Constructor for call_data */ +grpc_error* init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { + call_data* calld = static_cast(elem->call_data); + calld->call_combiner = args->call_combiner; + return GRPC_ERROR_NONE; +} + +/* Destructor for call_data */ +void destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) {} + +/* Constructor for channel_data */ +grpc_error* init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { + channel_data* chand = static_cast(elem->channel_data); + const grpc_arg* default_authority_arg = + grpc_channel_args_find(args->channel_args, GRPC_ARG_DEFAULT_AUTHORITY); + GPR_ASSERT(default_authority_arg != nullptr); + chand->default_authority = grpc_slice_from_copied_string( + grpc_channel_arg_get_string(default_authority_arg)); + GPR_ASSERT(!args->is_last); + return GRPC_ERROR_NONE; +} + +/* Destructor for channel data */ +void destroy_channel_elem(grpc_channel_element* elem) { + channel_data* chand = static_cast(elem->channel_data); + grpc_slice_unref(chand->default_authority); +} +} // namespace + +const grpc_channel_filter grpc_client_authority_filter = { + authority_start_transport_stream_op_batch, + grpc_channel_next_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset_or_pollset_set, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_channel_next_get_info, + "authority"}; diff --git a/src/core/lib/channel/client_authority_filter.h b/src/core/lib/channel/client_authority_filter.h new file mode 100644 index 00000000000..ba996dc8231 --- /dev/null +++ b/src/core/lib/channel/client_authority_filter.h @@ -0,0 +1,34 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * 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. + * + */ + +#ifndef GRPC_CORE_LIB_CHANNEL_CLIENT_AUTHORITY_FILTER_H +#define GRPC_CORE_LIB_CHANNEL_CLIENT_AUTHORITY_FILTER_H + +#include + +#include + +#include "src/core/lib/channel/channel_stack.h" + +/// Filter responsible for setting the authority header, if not already set. It +/// uses the value of the GRPC_ARG_DEFAULT_AUTHORITY channel arg if the initial +/// metadata doesn't already contain an authority value. + +extern const grpc_channel_filter grpc_client_authority_filter; + +#endif /* GRPC_CORE_LIB_CHANNEL_CLIENT_AUTHORITY_FILTER_H */ diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.cc b/src/core/lib/security/credentials/ssl/ssl_credentials.cc index 252b25bc0a4..295f13c3b73 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.cc +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.cc @@ -58,7 +58,7 @@ static grpc_security_status ssl_create_security_connector( const char* overridden_target_name = nullptr; for (size_t i = 0; args && i < args->num_args; i++) { grpc_arg* arg = &args->args[i]; - if (strcmp(arg->key, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG) == 0 && + if (strcmp(arg->key, GRPC_ARG_DEFAULT_AUTHORITY) == 0 && arg->type == GRPC_ARG_STRING) { overridden_target_name = arg->value.string; break; diff --git a/src/core/lib/security/security_connector/security_connector.cc b/src/core/lib/security/security_connector/security_connector.cc index 3cc151bec73..7b90b190751 100644 --- a/src/core/lib/security/security_connector/security_connector.cc +++ b/src/core/lib/security/security_connector/security_connector.cc @@ -465,12 +465,10 @@ static bool fake_channel_check_call_host(grpc_channel_security_connector* sc, grpc_error** error) { grpc_fake_channel_security_connector* c = reinterpret_cast(sc); - if (c->is_lb_channel) { - // TODO(dgq): verify that the host (ie, authority header) matches that of - // the LB, as opposed to that of the backends. - } else { - // TODO(dgq): verify that the host (ie, authority header) matches that of - // the backend, not the LB's. + if (c->is_lb_channel && strcmp(host, c->target) != 0) { + gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s' for an LB call", + host, c->target); + abort(); } return true; } diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 03353d6beb7..48bc69509f6 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -32,6 +32,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/surface/api_trace.h" @@ -55,7 +56,6 @@ typedef struct registered_call { struct grpc_channel { int is_client; grpc_compression_options compression_options; - grpc_mdelem default_authority; gpr_atm call_size_estimate; @@ -108,40 +108,8 @@ grpc_channel* grpc_channel_create_with_builder( grpc_compression_options_init(&channel->compression_options); for (size_t i = 0; i < args->num_args; i++) { - if (0 == strcmp(args->args[i].key, GRPC_ARG_DEFAULT_AUTHORITY)) { - if (args->args[i].type != GRPC_ARG_STRING) { - gpr_log(GPR_ERROR, "%s ignored: it must be a string", - GRPC_ARG_DEFAULT_AUTHORITY); - } else { - if (!GRPC_MDISNULL(channel->default_authority)) { - /* setting this takes precedence over anything else */ - GRPC_MDELEM_UNREF(channel->default_authority); - } - channel->default_authority = grpc_mdelem_from_slices( - GRPC_MDSTR_AUTHORITY, - grpc_slice_intern( - grpc_slice_from_static_string(args->args[i].value.string))); - } - } else if (0 == - strcmp(args->args[i].key, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG)) { - if (args->args[i].type != GRPC_ARG_STRING) { - gpr_log(GPR_ERROR, "%s ignored: it must be a string", - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); - } else { - if (!GRPC_MDISNULL(channel->default_authority)) { - /* other ways of setting this (notably ssl) take precedence */ - gpr_log(GPR_ERROR, - "%s ignored: default host already set some other way", - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); - } else { - channel->default_authority = grpc_mdelem_from_slices( - GRPC_MDSTR_AUTHORITY, - grpc_slice_intern( - grpc_slice_from_static_string(args->args[i].value.string))); - } - } - } else if (0 == strcmp(args->args[i].key, - GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL)) { + if (0 == + strcmp(args->args[i].key, GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL)) { channel->compression_options.default_level.is_set = true; channel->compression_options.default_level.level = static_cast(grpc_channel_arg_get_integer( @@ -169,12 +137,49 @@ done: return channel; } +static grpc_core::UniquePtr get_default_authority( + const char* target, const grpc_channel_args* input_args, + grpc_channel_stack_type channel_stack_type) { + bool has_default_authority = false; + char* ssl_override = nullptr; + grpc_core::UniquePtr default_authority; + const size_t num_args = input_args != nullptr ? input_args->num_args : 0; + for (size_t i = 0; i < num_args; ++i) { + if (0 == strcmp(input_args->args[i].key, GRPC_ARG_DEFAULT_AUTHORITY)) { + has_default_authority = true; + } else if (0 == strcmp(input_args->args[i].key, + GRPC_SSL_TARGET_NAME_OVERRIDE_ARG)) { + ssl_override = input_args->args[i].value.string; + } + } + if (!has_default_authority && ssl_override != nullptr) { + default_authority.reset(gpr_strdup(ssl_override)); + } + return default_authority; +} + +static grpc_channel_args* build_channel_args( + const grpc_channel_args* input_args, char* default_authority) { + grpc_arg new_args[1]; + size_t num_new_args = 0; + if (default_authority != nullptr) { + new_args[num_new_args++] = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_DEFAULT_AUTHORITY), default_authority); + } + return grpc_channel_args_copy_and_add(input_args, new_args, num_new_args); +} + grpc_channel* grpc_channel_create(const char* target, const grpc_channel_args* input_args, grpc_channel_stack_type channel_stack_type, grpc_transport* optional_transport) { grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create(); - grpc_channel_stack_builder_set_channel_arguments(builder, input_args); + const grpc_core::UniquePtr default_authority = + get_default_authority(target, input_args, channel_stack_type); + grpc_channel_args* args = + build_channel_args(input_args, default_authority.get()); + grpc_channel_stack_builder_set_channel_arguments(builder, args); + grpc_channel_args_destroy(args); grpc_channel_stack_builder_set_target(builder, target); grpc_channel_stack_builder_set_transport(builder, optional_transport); if (!grpc_channel_init_create_stack(builder, channel_stack_type)) { @@ -246,8 +251,6 @@ static grpc_call* grpc_channel_create_call_internal( send_metadata[num_metadata++] = path_mdelem; if (!GRPC_MDISNULL(authority_mdelem)) { send_metadata[num_metadata++] = authority_mdelem; - } else if (!GRPC_MDISNULL(channel->default_authority)) { - send_metadata[num_metadata++] = GRPC_MDELEM_REF(channel->default_authority); } grpc_call_create_args args; @@ -377,7 +380,6 @@ static void destroy_channel(void* arg, grpc_error* error) { GRPC_MDELEM_UNREF(rc->authority); gpr_free(rc); } - GRPC_MDELEM_UNREF(channel->default_authority); gpr_mu_destroy(&channel->registered_call_mu); gpr_free(channel->target); gpr_free(channel); diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index ac9f9e6066f..10c65ce09f2 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -27,6 +27,7 @@ #include #include #include "src/core/lib/channel/channel_stack.h" +#include "src/core/lib/channel/client_authority_filter.h" #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/handshaker_registry.h" #include "src/core/lib/debug/stats.h" @@ -83,6 +84,13 @@ static bool prepend_filter(grpc_channel_stack_builder* builder, void* arg) { } static void register_builtin_channel_init() { + grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, + prepend_filter, + (void*)(&grpc_client_authority_filter)); + grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, + prepend_filter, + (void*)(&grpc_client_authority_filter)); + grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, grpc_add_connected_filter, nullptr); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 994443c651c..7bd1adf8fe3 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -60,6 +60,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc index f02c8180f20..e5953acedcf 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.cc +++ b/test/core/channel/minimal_stack_is_minimal_test.cc @@ -66,35 +66,37 @@ int main(int argc, char** argv) { minimal_stack_arg.key = const_cast(GRPC_ARG_MINIMAL_STACK); minimal_stack_arg.value.integer = 1; grpc_channel_args minimal_stack_args = {1, &minimal_stack_arg}; - errors += CHECK_STACK("unknown", &minimal_stack_args, - GRPC_CLIENT_DIRECT_CHANNEL, "connected", NULL); + errors += + CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_DIRECT_CHANNEL, + "authority", "connected", NULL); errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, - "connected", NULL); + "authority", "connected", NULL); errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_SERVER_CHANNEL, "server", "connected", NULL); errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_DIRECT_CHANNEL, - "http-client", "connected", NULL); + "authority", "http-client", "connected", NULL); errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, - "http-client", "connected", NULL); + "authority", "http-client", "connected", NULL); errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_SERVER_CHANNEL, "server", "http-server", "connected", NULL); errors += CHECK_STACK(nullptr, &minimal_stack_args, GRPC_CLIENT_CHANNEL, "client-channel", NULL); // tests with a default stack - errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, - "message_size", "deadline", "connected", NULL); - errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_SUBCHANNEL, + errors += + CHECK_STACK("unknown", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, "authority", + "message_size", "deadline", "connected", NULL); + errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_SUBCHANNEL, "authority", "message_size", "connected", NULL); errors += CHECK_STACK("unknown", nullptr, GRPC_SERVER_CHANNEL, "server", "message_size", "deadline", "connected", NULL); errors += CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, - "message_size", "deadline", "http-client", + "authority", "message_size", "deadline", "http-client", "message_compress", "connected", NULL); - errors += - CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_SUBCHANNEL, "message_size", - "http-client", "message_compress", "connected", NULL); + errors += CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_SUBCHANNEL, "authority", + "message_size", "http-client", "message_compress", + "connected", NULL); errors += CHECK_STACK("chttp2", nullptr, GRPC_SERVER_CHANNEL, "server", "message_size", "deadline", "http-server", "message_compress", "connected", NULL); diff --git a/test/core/end2end/tests/default_host.cc b/test/core/end2end/tests/default_host.cc index 3191f76688f..cda716a259d 100644 --- a/test/core/end2end/tests/default_host.cc +++ b/test/core/end2end/tests/default_host.cc @@ -191,7 +191,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, "localhost", 9)); + char* target = grpc_channel_get_target(f.client); + GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, target, 9)); + gpr_free(target); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); @@ -216,10 +218,9 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { } void default_host(grpc_end2end_test_config config) { - if ((config.feature_mask & FEATURE_MASK_SUPPORTS_HOSTNAME_VERIFICATION) == 0) - return; - if ((config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) == 0) + if ((config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) != 0) { return; + } test_invoke_simple_request(config); } diff --git a/test/core/surface/BUILD b/test/core/surface/BUILD index e848dded137..77df1cc989c 100644 --- a/test/core/surface/BUILD +++ b/test/core/surface/BUILD @@ -90,18 +90,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "grpc_invalid_channel_args_test", - srcs = ["invalid_channel_args_test.cc"], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//test/core/util:gpr_test_util", - "//test/core/util:grpc_test_util", - ], -) - grpc_cc_test( name = "lame_client_test", srcs = ["lame_client_test.cc"], diff --git a/test/core/surface/invalid_channel_args_test.cc b/test/core/surface/invalid_channel_args_test.cc deleted file mode 100644 index 7c5f1f0352f..00000000000 --- a/test/core/surface/invalid_channel_args_test.cc +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * 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 - -#include -#include -#include -#include "test/core/util/test_config.h" - -static char* g_last_log_error_message = nullptr; -static const char* g_file_name = "channel.cc"; - -static int ends_with(const char* src, const char* suffix) { - size_t src_len = strlen(src); - size_t suffix_len = strlen(suffix); - if (src_len < suffix_len) { - return 0; - } - return strcmp(src + src_len - suffix_len, suffix) == 0; -} - -static void log_error_sink(gpr_log_func_args* args) { - if (args->severity == GPR_LOG_SEVERITY_ERROR && - ends_with(args->file, g_file_name)) { - g_last_log_error_message = gpr_strdup(args->message); - } -} - -static void verify_last_error(const char* message) { - if (message == nullptr) { - GPR_ASSERT(g_last_log_error_message == nullptr); - return; - } - GPR_ASSERT(strcmp(message, g_last_log_error_message) == 0); - gpr_free(g_last_log_error_message); - g_last_log_error_message = nullptr; -} - -static char* compose_error_string(const char* key, const char* message) { - char* ret; - gpr_asprintf(&ret, "%s%s", key, message); - return ret; -} - -static void one_test(grpc_channel_args* args, char* expected_error_message) { - grpc_channel* chan = - grpc_insecure_channel_create("nonexistant:54321", args, nullptr); - verify_last_error(expected_error_message); - gpr_free(expected_error_message); - grpc_channel_destroy(chan); -} - -static void test_no_error_message(void) { one_test(nullptr, nullptr); } - -static void test_default_authority_type(void) { - grpc_arg client_arg; - grpc_channel_args client_args; - char* expected_error_message; - - client_arg.type = GRPC_ARG_INTEGER; - client_arg.key = const_cast(GRPC_ARG_DEFAULT_AUTHORITY); - client_arg.value.integer = 0; - - client_args.num_args = 1; - client_args.args = &client_arg; - expected_error_message = compose_error_string( - GRPC_ARG_DEFAULT_AUTHORITY, " ignored: it must be a string"); - one_test(&client_args, expected_error_message); -} - -static void test_ssl_name_override_type(void) { - grpc_arg client_arg; - grpc_channel_args client_args; - char* expected_error_message; - - client_arg.type = GRPC_ARG_INTEGER; - client_arg.key = const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); - client_arg.value.integer = 0; - - client_args.num_args = 1; - client_args.args = &client_arg; - expected_error_message = compose_error_string( - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, " ignored: it must be a string"); - one_test(&client_args, expected_error_message); -} - -static void test_ssl_name_override_failed(void) { - grpc_arg client_arg[2]; - grpc_channel_args client_args; - char* expected_error_message; - - client_arg[0].type = GRPC_ARG_STRING; - client_arg[0].key = const_cast(GRPC_ARG_DEFAULT_AUTHORITY); - client_arg[0].value.string = const_cast("default"); - client_arg[1].type = GRPC_ARG_STRING; - client_arg[1].key = const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); - client_arg[1].value.string = const_cast("ssl"); - - client_args.num_args = 2; - client_args.args = client_arg; - expected_error_message = - compose_error_string(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - " ignored: default host already set some other way"); - one_test(&client_args, expected_error_message); -} - -int main(int argc, char** argv) { - grpc_test_init(argc, argv); - grpc_init(); - gpr_set_log_function(log_error_sink); - - test_no_error_message(); - test_default_authority_type(); - test_ssl_name_override_type(); - test_ssl_name_override_failed(); - - grpc_shutdown(); - - return 0; -} diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index ff5abc679d8..f1fb7d29fc2 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1007,6 +1007,7 @@ src/core/lib/backoff/backoff.h \ src/core/lib/channel/channel_args.h \ src/core/lib/channel/channel_stack.h \ src/core/lib/channel/channel_stack_builder.h \ +src/core/lib/channel/client_authority_filter.h \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ src/core/lib/channel/handshaker.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e7e9e04979e..1f19bac169f 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1034,6 +1034,8 @@ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack.h \ src/core/lib/channel/channel_stack_builder.cc \ src/core/lib/channel/channel_stack_builder.h \ +src/core/lib/channel/client_authority_filter.cc \ +src/core/lib/channel/client_authority_filter.h \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index f5a9eb828ed..fa34d963aab 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -1000,23 +1000,6 @@ "third_party": false, "type": "target" }, - { - "deps": [ - "gpr", - "gpr_test_util", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "grpc_invalid_channel_args_test", - "src": [ - "test/core/surface/invalid_channel_args_test.cc" - ], - "third_party": false, - "type": "target" - }, { "deps": [ "gpr", @@ -9005,6 +8988,7 @@ "src/core/lib/channel/channel_args.cc", "src/core/lib/channel/channel_stack.cc", "src/core/lib/channel/channel_stack_builder.cc", + "src/core/lib/channel/client_authority_filter.cc", "src/core/lib/channel/connected_channel.cc", "src/core/lib/channel/handshaker.cc", "src/core/lib/channel/handshaker_factory.cc", @@ -9162,6 +9146,7 @@ "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", + "src/core/lib/channel/client_authority_filter.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/handshaker.h", @@ -9306,6 +9291,7 @@ "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", + "src/core/lib/channel/client_authority_filter.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/handshaker.h", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 1406c4ac7ee..db2776ba759 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -1297,30 +1297,6 @@ ], "uses_polling": true }, - { - "args": [], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": false, - "language": "c", - "name": "grpc_invalid_channel_args_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "uses_polling": false - }, { "args": [], "benchmark": false, From 7b84b3d519b0fb678876af10c0bc2206020dbe91 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 12 Mar 2018 12:08:30 -0700 Subject: [PATCH 02/25] PR comments --- .../client_channel/client_channel_plugin.cc | 27 ------------------- .../client_channel/lb_policy/grpclb/grpclb.cc | 4 +++ .../chttp2/client/insecure/channel_create.cc | 2 -- .../lib/channel/client_authority_filter.cc | 2 +- .../lib/channel/client_authority_filter.h | 2 +- src/core/lib/surface/channel.cc | 6 +++++ 6 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.cc b/src/core/ext/filters/client_channel/client_channel_plugin.cc index ed3ebd26968..98d9d021107 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.cc +++ b/src/core/ext/filters/client_channel/client_channel_plugin.cc @@ -39,31 +39,6 @@ static bool append_filter(grpc_channel_stack_builder* builder, void* arg) { builder, static_cast(arg), nullptr, nullptr); } -// Only used for direct channels, as they don't create subchannels, which is -// where default authority is handled for regular channels. -static bool set_default_host_if_unset(grpc_channel_stack_builder* builder, - void* unused) { - const grpc_channel_args* args = - grpc_channel_stack_builder_get_channel_arguments(builder); - for (size_t i = 0; i < args->num_args; i++) { - if (0 == strcmp(args->args[i].key, GRPC_ARG_DEFAULT_AUTHORITY) || - 0 == strcmp(args->args[i].key, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG)) { - return true; - } - } - grpc_core::UniquePtr default_authority = - grpc_core::ResolverRegistry::GetDefaultAuthority( - grpc_channel_stack_builder_get_target(builder)); - if (default_authority.get() != nullptr) { - grpc_arg arg = grpc_channel_arg_string_create( - (char*)GRPC_ARG_DEFAULT_AUTHORITY, default_authority.get()); - grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1); - grpc_channel_stack_builder_set_channel_arguments(builder, new_args); - grpc_channel_args_destroy(new_args); - } - return true; -} - void grpc_client_channel_init(void) { grpc_core::LoadBalancingPolicyRegistry::Builder::InitRegistry(); grpc_core::ResolverRegistry::Builder::InitRegistry(); @@ -71,8 +46,6 @@ void grpc_client_channel_init(void) { grpc_proxy_mapper_registry_init(); grpc_register_http_proxy_mapper(); grpc_subchannel_index_init(); - grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MIN, - set_default_host_if_unset, nullptr); grpc_channel_init_register_stage( GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter, (void*)&grpc_client_channel_filter); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 49918e11b70..17ab0febb7f 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -983,6 +983,10 @@ grpc_channel_args* BuildBalancerChannelArgs( // authority table (see \a grpc_lb_policy_grpclb_modify_lb_channel_args), // as opposed to the authority from the parent channel. GRPC_ARG_DEFAULT_AUTHORITY, + // Just as for \a GRPC_ARG_DEFAULT_AUTHORITY, the LB channel should be + // treated as a stand-alone channel and not inherit this argument from the + // args of the parent channel. + GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, }; // Channel args to add. const grpc_arg args_to_add[] = { diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index 8424cc5bc64..9fb87c2164f 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -65,11 +65,9 @@ static grpc_subchannel* client_channel_factory_create_subchannel( static_cast(gpr_malloc(sizeof(*final_sc_args))); memcpy(final_sc_args, args, sizeof(*args)); final_sc_args->args = add_default_authority_if_not_present(args->args); - grpc_connector* connector = grpc_chttp2_connector_create(); grpc_subchannel* s = grpc_subchannel_create(connector, final_sc_args); grpc_connector_unref(connector); - grpc_channel_args_destroy( const_cast(final_sc_args->args)); gpr_free(final_sc_args); diff --git a/src/core/lib/channel/client_authority_filter.cc b/src/core/lib/channel/client_authority_filter.cc index 57c5d29a930..f684684be13 100644 --- a/src/core/lib/channel/client_authority_filter.cc +++ b/src/core/lib/channel/client_authority_filter.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2017 gRPC authors. + * Copyright 2018 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/core/lib/channel/client_authority_filter.h b/src/core/lib/channel/client_authority_filter.h index ba996dc8231..c101c359d22 100644 --- a/src/core/lib/channel/client_authority_filter.h +++ b/src/core/lib/channel/client_authority_filter.h @@ -1,6 +1,6 @@ /* * - * Copyright 2017 gRPC authors. + * Copyright 2018 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 48bc69509f6..93f3009dba2 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -155,6 +155,12 @@ static grpc_core::UniquePtr get_default_authority( if (!has_default_authority && ssl_override != nullptr) { default_authority.reset(gpr_strdup(ssl_override)); } + if (channel_stack_type == GRPC_CLIENT_DIRECT_CHANNEL && + default_authority == nullptr) { + // Set the default authority. This is handled by the subchannel stack for + // regular client channels. + default_authority.reset(gpr_strdup(target)); + } return default_authority; } From aa843f2bfc83b588a645d5edc9300b0e1d353f93 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 13 Mar 2018 08:36:16 -0700 Subject: [PATCH 03/25] Testing making the authority filter a plugin, for cronet --- BUILD | 16 +++++++++++++ CMakeLists.txt | 8 ++----- build.yaml | 12 ++++++++-- config.m4 | 2 +- config.w32 | 2 +- gRPC-C++.podspec | 3 +-- gRPC-Core.podspec | 6 ++--- grpc.gemspec | 4 ++-- grpc.gyp | 6 ++--- package.xml | 4 ++-- .../lib/channel/client_authority_filter.cc | 18 +++++++++++++++ src/core/lib/surface/init.cc | 7 ------ src/core/lib/surface/init_secure.cc | 4 ++-- .../plugin_registry/grpc_plugin_registry.cc | 4 ++++ .../grpc_unsecure_plugin_registry.cc | 4 ++++ src/python/grpcio/grpc_core_dependencies.py | 2 +- tools/doxygen/Doxyfile.c++.internal | 1 - .../generated/sources_and_headers.json | 23 ++++++++++++++++--- 18 files changed, 89 insertions(+), 37 deletions(-) diff --git a/BUILD b/BUILD index 49f45f8218b..75aebb2462c 100644 --- a/BUILD +++ b/BUILD @@ -966,6 +966,7 @@ grpc_cc_library( # standard plugins "census", "grpc_deadline_filter", + "grpc_client_authority_filter", "grpc_lb_policy_pick_first", "grpc_lb_policy_round_robin", "grpc_server_load_reporting", @@ -1036,6 +1037,7 @@ grpc_cc_library( deps = [ "gpr_base", "grpc_base", + "grpc_client_authority_filter", "grpc_deadline_filter", "inlined_vector", "orphanable", @@ -1072,6 +1074,20 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "grpc_client_authority_filter", + srcs = [ + "src/core/lib/channel/client_authority_filter.cc", + ], + hdrs = [ + "src/core/lib/channel/client_authority_filter.h", + ], + language = "c++", + deps = [ + "grpc_base", + ], +) + grpc_cc_library( name = "grpc_message_size_filter", srcs = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index d3e84c77513..1657f1ae7e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -855,7 +855,6 @@ add_library(grpc src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -1133,6 +1132,7 @@ add_library(grpc src/core/ext/census/grpc_context.cc src/core/ext/filters/max_age/max_age_filter.cc src/core/ext/filters/message_size/message_size_filter.cc + src/core/lib/channel/client_authority_filter.cc src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc src/core/ext/filters/workarounds/workaround_utils.cc src/core/plugin_registry/grpc_plugin_registry.cc @@ -1231,7 +1231,6 @@ add_library(grpc_cronet src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -1598,7 +1597,6 @@ add_library(grpc_test_util src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -1888,7 +1886,6 @@ add_library(grpc_test_util_unsecure src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -2158,7 +2155,6 @@ add_library(grpc_unsecure src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc @@ -2371,6 +2367,7 @@ add_library(grpc_unsecure src/core/ext/census/grpc_context.cc src/core/ext/filters/max_age/max_age_filter.cc src/core/ext/filters/message_size/message_size_filter.cc + src/core/lib/channel/client_authority_filter.cc src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc src/core/ext/filters/workarounds/workaround_utils.cc src/core/plugin_registry/grpc_unsecure_plugin_registry.cc @@ -2962,7 +2959,6 @@ add_library(grpc++_cronet src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_stack.cc src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/client_authority_filter.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/handshaker.cc src/core/lib/channel/handshaker_factory.cc diff --git a/build.yaml b/build.yaml index eab2897706a..20581ae00e5 100644 --- a/build.yaml +++ b/build.yaml @@ -232,7 +232,6 @@ filegroups: - src/core/lib/channel/channel_args.cc - src/core/lib/channel/channel_stack.cc - src/core/lib/channel/channel_stack_builder.cc - - src/core/lib/channel/client_authority_filter.cc - src/core/lib/channel/connected_channel.cc - src/core/lib/channel/handshaker.cc - src/core/lib/channel/handshaker_factory.cc @@ -389,7 +388,6 @@ filegroups: - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_stack.h - src/core/lib/channel/channel_stack_builder.h - - src/core/lib/channel/client_authority_filter.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - src/core/lib/channel/handshaker.h @@ -517,6 +515,14 @@ filegroups: uses: - grpc_codegen - grpc_trace_headers +- name: grpc_client_authority_filter + headers: + - src/core/lib/channel/client_authority_filter.h + src: + - src/core/lib/channel/client_authority_filter.cc + plugin: grpc_client_authority_filter + uses: + - grpc_base - name: grpc_client_channel headers: - src/core/ext/filters/client_channel/backup_poller.h @@ -1354,6 +1360,7 @@ libs: - grpc_max_age_filter - grpc_message_size_filter - grpc_deadline_filter + - grpc_client_authority_filter - grpc_workaround_cronet_compression_filter - grpc_server_backward_compatibility generate_plugin_registry: true @@ -1456,6 +1463,7 @@ libs: - grpc_max_age_filter - grpc_message_size_filter - grpc_deadline_filter + - grpc_client_authority_filter - grpc_workaround_cronet_compression_filter - grpc_server_backward_compatibility generate_plugin_registry: true diff --git a/config.m4 b/config.m4 index 3b061e565e6..9b48890d4cb 100644 --- a/config.m4 +++ b/config.m4 @@ -84,7 +84,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ - src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -362,6 +361,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/census/grpc_context.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \ src/core/ext/filters/workarounds/workaround_utils.cc \ src/core/plugin_registry/grpc_plugin_registry.cc \ diff --git a/config.w32 b/config.w32 index 1b89419c57a..b6b417e3de6 100644 --- a/config.w32 +++ b/config.w32 @@ -61,7 +61,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\channel\\channel_args.cc " + "src\\core\\lib\\channel\\channel_stack.cc " + "src\\core\\lib\\channel\\channel_stack_builder.cc " + - "src\\core\\lib\\channel\\client_authority_filter.cc " + "src\\core\\lib\\channel\\connected_channel.cc " + "src\\core\\lib\\channel\\handshaker.cc " + "src\\core\\lib\\channel\\handshaker_factory.cc " + @@ -339,6 +338,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\census\\grpc_context.cc " + "src\\core\\ext\\filters\\max_age\\max_age_filter.cc " + "src\\core\\ext\\filters\\message_size\\message_size_filter.cc " + + "src\\core\\lib\\channel\\client_authority_filter.cc " + "src\\core\\ext\\filters\\workarounds\\workaround_cronet_compression_filter.cc " + "src\\core\\ext\\filters\\workarounds\\workaround_utils.cc " + "src\\core\\plugin_registry\\grpc_plugin_registry.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 6334ac433d3..5e8ae3f9a6e 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -343,7 +343,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', - 'src/core/lib/channel/client_authority_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', @@ -480,6 +479,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/load_reporting/server_load_reporting_plugin.h', 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', + 'src/core/lib/channel/client_authority_filter.h', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', 'src/core/ext/filters/workarounds/workaround_utils.h' @@ -523,7 +523,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', - 'src/core/lib/channel/client_authority_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 5827b397ffb..242bc49bd31 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -354,7 +354,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', - 'src/core/lib/channel/client_authority_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', @@ -491,6 +490,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/load_reporting/server_load_reporting_plugin.h', 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', + 'src/core/lib/channel/client_authority_filter.h', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', 'src/core/ext/filters/workarounds/workaround_utils.h', 'src/core/lib/surface/init.cc', @@ -499,7 +499,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', - 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -774,6 +773,7 @@ Pod::Spec.new do |s| 'src/core/ext/census/grpc_context.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc', 'src/core/ext/filters/workarounds/workaround_utils.cc', 'src/core/plugin_registry/grpc_plugin_registry.cc' @@ -910,7 +910,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', - 'src/core/lib/channel/client_authority_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', @@ -1047,6 +1046,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/load_reporting/server_load_reporting_plugin.h', 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', + 'src/core/lib/channel/client_authority_filter.h', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', 'src/core/ext/filters/workarounds/workaround_utils.h' end diff --git a/grpc.gemspec b/grpc.gemspec index 06520c1f952..33ca745e699 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -284,7 +284,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/channel_args.h ) s.files += %w( src/core/lib/channel/channel_stack.h ) s.files += %w( src/core/lib/channel/channel_stack_builder.h ) - s.files += %w( src/core/lib/channel/client_authority_filter.h ) s.files += %w( src/core/lib/channel/connected_channel.h ) s.files += %w( src/core/lib/channel/context.h ) s.files += %w( src/core/lib/channel/handshaker.h ) @@ -421,6 +420,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/load_reporting/server_load_reporting_plugin.h ) s.files += %w( src/core/ext/filters/max_age/max_age_filter.h ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.h ) + s.files += %w( src/core/lib/channel/client_authority_filter.h ) s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h ) s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h ) s.files += %w( src/core/lib/surface/init.cc ) @@ -429,7 +429,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/channel_args.cc ) s.files += %w( src/core/lib/channel/channel_stack.cc ) s.files += %w( src/core/lib/channel/channel_stack_builder.cc ) - s.files += %w( src/core/lib/channel/client_authority_filter.cc ) s.files += %w( src/core/lib/channel/connected_channel.cc ) s.files += %w( src/core/lib/channel/handshaker.cc ) s.files += %w( src/core/lib/channel/handshaker_factory.cc ) @@ -707,6 +706,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/census/grpc_context.cc ) s.files += %w( src/core/ext/filters/max_age/max_age_filter.cc ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.cc ) + s.files += %w( src/core/lib/channel/client_authority_filter.cc ) s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc ) s.files += %w( src/core/ext/filters/workarounds/workaround_utils.cc ) s.files += %w( src/core/plugin_registry/grpc_plugin_registry.cc ) diff --git a/grpc.gyp b/grpc.gyp index a398e4f4606..04421bad57c 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -236,7 +236,6 @@ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', - 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -514,6 +513,7 @@ 'src/core/ext/census/grpc_context.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc', 'src/core/ext/filters/workarounds/workaround_utils.cc', 'src/core/plugin_registry/grpc_plugin_registry.cc', @@ -569,7 +569,6 @@ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', - 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -787,7 +786,6 @@ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', - 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -984,7 +982,6 @@ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', - 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -1197,6 +1194,7 @@ 'src/core/ext/census/grpc_context.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc', 'src/core/ext/filters/workarounds/workaround_utils.cc', 'src/core/plugin_registry/grpc_unsecure_plugin_registry.cc', diff --git a/package.xml b/package.xml index 0abcb89738b..a8a3c4f356b 100644 --- a/package.xml +++ b/package.xml @@ -291,7 +291,6 @@ - @@ -428,6 +427,7 @@ + @@ -436,7 +436,6 @@ - @@ -714,6 +713,7 @@ + diff --git a/src/core/lib/channel/client_authority_filter.cc b/src/core/lib/channel/client_authority_filter.cc index f684684be13..bf37f52e9c3 100644 --- a/src/core/lib/channel/client_authority_filter.cc +++ b/src/core/lib/channel/client_authority_filter.cc @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -115,3 +116,20 @@ const grpc_channel_filter grpc_client_authority_filter = { destroy_channel_elem, grpc_channel_next_get_info, "authority"}; + +static bool add_client_authority_filter(grpc_channel_stack_builder* builder, + void* arg) { + return grpc_channel_stack_builder_prepend_filter( + builder, static_cast(arg), nullptr, nullptr); +} + +void grpc_client_authority_filter_init(void) { + grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, + add_client_authority_filter, + (void*)&grpc_client_authority_filter); + grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, + add_client_authority_filter, + (void*)&grpc_client_authority_filter); +} + +void grpc_client_authority_filter_shutdown(void) {} diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index 10c65ce09f2..2d29c7d95ff 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -84,13 +84,6 @@ static bool prepend_filter(grpc_channel_stack_builder* builder, void* arg) { } static void register_builtin_channel_init() { - grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, - prepend_filter, - (void*)(&grpc_client_authority_filter)); - grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, - prepend_filter, - (void*)(&grpc_client_authority_filter)); - grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, grpc_add_connected_filter, nullptr); diff --git a/src/core/lib/surface/init_secure.cc b/src/core/lib/surface/init_secure.cc index 78e983e0cd4..9700f43a55d 100644 --- a/src/core/lib/surface/init_secure.cc +++ b/src/core/lib/surface/init_secure.cc @@ -67,9 +67,9 @@ static bool maybe_prepend_server_auth_filter( } void grpc_register_security_filters(void) { - grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, + grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX - 1, maybe_prepend_client_auth_filter, nullptr); - grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, + grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX - 1, maybe_prepend_client_auth_filter, nullptr); grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, maybe_prepend_server_auth_filter, nullptr); diff --git a/src/core/plugin_registry/grpc_plugin_registry.cc b/src/core/plugin_registry/grpc_plugin_registry.cc index 6f11e6bb5b9..e371310fa1a 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_plugin_registry.cc @@ -52,6 +52,8 @@ void grpc_max_age_filter_init(void); void grpc_max_age_filter_shutdown(void); void grpc_message_size_filter_init(void); void grpc_message_size_filter_shutdown(void); +void grpc_client_authority_filter_init(void); +void grpc_client_authority_filter_shutdown(void); void grpc_workaround_cronet_compression_filter_init(void); void grpc_workaround_cronet_compression_filter_shutdown(void); @@ -88,6 +90,8 @@ void grpc_register_built_in_plugins(void) { grpc_max_age_filter_shutdown); grpc_register_plugin(grpc_message_size_filter_init, grpc_message_size_filter_shutdown); + grpc_register_plugin(grpc_client_authority_filter_init, + grpc_client_authority_filter_shutdown); grpc_register_plugin(grpc_workaround_cronet_compression_filter_init, grpc_workaround_cronet_compression_filter_shutdown); } diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc index b08c5ce3ae9..283db5b4f4a 100644 --- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc @@ -50,6 +50,8 @@ void grpc_max_age_filter_init(void); void grpc_max_age_filter_shutdown(void); void grpc_message_size_filter_init(void); void grpc_message_size_filter_shutdown(void); +void grpc_client_authority_filter_init(void); +void grpc_client_authority_filter_shutdown(void); void grpc_workaround_cronet_compression_filter_init(void); void grpc_workaround_cronet_compression_filter_shutdown(void); @@ -84,6 +86,8 @@ void grpc_register_built_in_plugins(void) { grpc_max_age_filter_shutdown); grpc_register_plugin(grpc_message_size_filter_init, grpc_message_size_filter_shutdown); + grpc_register_plugin(grpc_client_authority_filter_init, + grpc_client_authority_filter_shutdown); grpc_register_plugin(grpc_workaround_cronet_compression_filter_init, grpc_workaround_cronet_compression_filter_shutdown); } diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 7bd1adf8fe3..bb426b070f5 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -60,7 +60,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', - 'src/core/lib/channel/client_authority_filter.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', @@ -338,6 +337,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/census/grpc_context.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', + 'src/core/lib/channel/client_authority_filter.cc', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc', 'src/core/ext/filters/workarounds/workaround_utils.cc', 'src/core/plugin_registry/grpc_plugin_registry.cc', diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index f1fb7d29fc2..ff5abc679d8 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1007,7 +1007,6 @@ src/core/lib/backoff/backoff.h \ src/core/lib/channel/channel_args.h \ src/core/lib/channel/channel_stack.h \ src/core/lib/channel/channel_stack_builder.h \ -src/core/lib/channel/client_authority_filter.h \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ src/core/lib/channel/handshaker.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index fa34d963aab..07edd14b043 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -6610,6 +6610,7 @@ "census", "gpr", "grpc_base", + "grpc_client_authority_filter", "grpc_deadline_filter", "grpc_lb_policy_grpclb_secure", "grpc_lb_policy_pick_first", @@ -6717,6 +6718,7 @@ "census", "gpr", "grpc_base", + "grpc_client_authority_filter", "grpc_deadline_filter", "grpc_lb_policy_grpclb", "grpc_lb_policy_pick_first", @@ -8988,7 +8990,6 @@ "src/core/lib/channel/channel_args.cc", "src/core/lib/channel/channel_stack.cc", "src/core/lib/channel/channel_stack_builder.cc", - "src/core/lib/channel/client_authority_filter.cc", "src/core/lib/channel/connected_channel.cc", "src/core/lib/channel/handshaker.cc", "src/core/lib/channel/handshaker_factory.cc", @@ -9146,7 +9147,6 @@ "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", - "src/core/lib/channel/client_authority_filter.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/handshaker.h", @@ -9291,7 +9291,6 @@ "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", - "src/core/lib/channel/client_authority_filter.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/handshaker.h", @@ -9418,6 +9417,24 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "gpr", + "grpc_base" + ], + "headers": [ + "src/core/lib/channel/client_authority_filter.h" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_client_authority_filter", + "src": [ + "src/core/lib/channel/client_authority_filter.cc", + "src/core/lib/channel/client_authority_filter.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "gpr", From 2f6fc700de0431878ade712051981a2609793553 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 14 Mar 2018 11:19:26 -0700 Subject: [PATCH 04/25] Abort if direct channel doesn't provide default authority ch arg --- Makefile | 8 ++------ src/core/lib/surface/channel.cc | 7 ++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 02e1215459a..93b3588de2e 100644 --- a/Makefile +++ b/Makefile @@ -3160,7 +3160,6 @@ LIBGRPC_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ - src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -3438,6 +3437,7 @@ LIBGRPC_SRC = \ src/core/ext/census/grpc_context.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \ src/core/ext/filters/workarounds/workaround_utils.cc \ src/core/plugin_registry/grpc_plugin_registry.cc \ @@ -3538,7 +3538,6 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ - src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -3906,7 +3905,6 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ - src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -4189,7 +4187,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ - src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -4439,7 +4436,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ - src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ @@ -4652,6 +4648,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/census/grpc_context.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ + src/core/lib/channel/client_authority_filter.cc \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \ src/core/ext/filters/workarounds/workaround_utils.cc \ src/core/plugin_registry/grpc_unsecure_plugin_registry.cc \ @@ -5242,7 +5239,6 @@ LIBGRPC++_CRONET_SRC = \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack_builder.cc \ - src/core/lib/channel/client_authority_filter.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/handshaker.cc \ src/core/lib/channel/handshaker_factory.cc \ diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 93f3009dba2..274dfe38bf8 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -157,9 +157,10 @@ static grpc_core::UniquePtr get_default_authority( } if (channel_stack_type == GRPC_CLIENT_DIRECT_CHANNEL && default_authority == nullptr) { - // Set the default authority. This is handled by the subchannel stack for - // regular client channels. - default_authority.reset(gpr_strdup(target)); + gpr_log(GPR_ERROR, + "Direct channels must specify a value for the " + "GRPC_ARG_DEFAULT_AUTHORITY channel arg."); + abort(); } return default_authority; } From 2040ae1ff41620b769f7ca9152b91010a54c3054 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 14 Mar 2018 11:23:18 -0700 Subject: [PATCH 05/25] Undo changes to ssl_credentials.cc --- src/core/lib/security/credentials/ssl/ssl_credentials.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.cc b/src/core/lib/security/credentials/ssl/ssl_credentials.cc index 295f13c3b73..252b25bc0a4 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.cc +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.cc @@ -58,7 +58,7 @@ static grpc_security_status ssl_create_security_connector( const char* overridden_target_name = nullptr; for (size_t i = 0; args && i < args->num_args; i++) { grpc_arg* arg = &args->args[i]; - if (strcmp(arg->key, GRPC_ARG_DEFAULT_AUTHORITY) == 0 && + if (strcmp(arg->key, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG) == 0 && arg->type == GRPC_ARG_STRING) { overridden_target_name = arg->value.string; break; From f73e76d59682faa44b382e83c9d36c9664d15c23 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 14 Mar 2018 12:50:48 -0700 Subject: [PATCH 06/25] Fix check in channel.cc and tweak direct channel tests --- src/core/lib/surface/channel.cc | 2 +- test/core/end2end/fixtures/h2_sockpair+trace.cc | 9 +++++++-- test/core/end2end/fixtures/h2_sockpair.cc | 8 +++++++- test/core/end2end/fixtures/h2_sockpair_1byte.cc | 8 +++++++- test/core/end2end/fuzzers/client_fuzzer.cc | 9 ++++++++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 274dfe38bf8..9d38fe9c71c 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -156,7 +156,7 @@ static grpc_core::UniquePtr get_default_authority( default_authority.reset(gpr_strdup(ssl_override)); } if (channel_stack_type == GRPC_CLIENT_DIRECT_CHANNEL && - default_authority == nullptr) { + !has_default_authority) { gpr_log(GPR_ERROR, "Direct channels must specify a value for the " "GRPC_ARG_DEFAULT_AUTHORITY channel arg."); diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.cc b/test/core/end2end/fixtures/h2_sockpair+trace.cc index d539ddae8f1..701113461f7 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.cc +++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc @@ -63,9 +63,14 @@ typedef struct { static void client_setup_transport(void* ts, grpc_transport* transport) { sp_client_setup* cs = static_cast(ts); - - cs->f->client = grpc_channel_create("socketpair-target", cs->client_args, + grpc_arg authority_arg = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_DEFAULT_AUTHORITY), + const_cast("test-authority")); + grpc_channel_args* args = + grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1); + cs->f->client = grpc_channel_create("socketpair-target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport); + grpc_channel_args_destroy(args); } static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( diff --git a/test/core/end2end/fixtures/h2_sockpair.cc b/test/core/end2end/fixtures/h2_sockpair.cc index 75f64024cd1..24a1d6dd32a 100644 --- a/test/core/end2end/fixtures/h2_sockpair.cc +++ b/test/core/end2end/fixtures/h2_sockpair.cc @@ -58,8 +58,14 @@ typedef struct { static void client_setup_transport(void* ts, grpc_transport* transport) { sp_client_setup* cs = static_cast(ts); - cs->f->client = grpc_channel_create("socketpair-target", cs->client_args, + grpc_arg authority_arg = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_DEFAULT_AUTHORITY), + const_cast("test-authority")); + grpc_channel_args* args = + grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1); + cs->f->client = grpc_channel_create("socketpair-target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport); + grpc_channel_args_destroy(args); } static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.cc b/test/core/end2end/fixtures/h2_sockpair_1byte.cc index 929631917d3..d812c226e99 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.cc +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc @@ -58,8 +58,14 @@ typedef struct { static void client_setup_transport(void* ts, grpc_transport* transport) { sp_client_setup* cs = static_cast(ts); - cs->f->client = grpc_channel_create("socketpair-target", cs->client_args, + grpc_arg authority_arg = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_DEFAULT_AUTHORITY), + const_cast("test-authority")); + grpc_channel_args* args = + grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1); + cs->f->client = grpc_channel_create("socketpair-target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport); + grpc_channel_args_destroy(args); } static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index 16acf8ef286..e21006bb673 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -20,6 +20,7 @@ #include #include +#include #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/iomgr/executor.h" @@ -58,8 +59,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_create_chttp2_transport(nullptr, mock_endpoint, true); grpc_chttp2_transport_start_reading(transport, nullptr, nullptr); + grpc_arg authority_arg = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_DEFAULT_AUTHORITY), + const_cast("test-authority")); + grpc_channel_args* args = + grpc_channel_args_copy_and_add(nullptr, &authority_arg, 1); grpc_channel* channel = grpc_channel_create( - "test-target", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, transport); + "test-target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport); + grpc_channel_args_destroy(args); grpc_slice host = grpc_slice_from_static_string("localhost"); grpc_call* call = grpc_channel_create_call( channel, nullptr, 0, cq, grpc_slice_from_static_string("/foo"), &host, From 961353ab6d1b48da74e307f805f45509c4a7de7f Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 15 Mar 2018 16:11:05 -0700 Subject: [PATCH 07/25] moved filter to ext --- BUILD | 6 ++---- CMakeLists.txt | 4 ++-- Makefile | 4 ++-- build.yaml | 4 ++-- config.m4 | 2 +- config.w32 | 2 +- gRPC-C++.podspec | 2 +- gRPC-Core.podspec | 6 +++--- grpc.gemspec | 4 ++-- grpc.gyp | 4 ++-- package.xml | 4 ++-- .../channel => ext/filters/http}/client_authority_filter.cc | 2 +- .../channel => ext/filters/http}/client_authority_filter.h | 6 +++--- src/core/lib/surface/init.cc | 1 - src/python/grpcio/grpc_core_dependencies.py | 2 +- tools/doxygen/Doxyfile.core.internal | 4 ++-- tools/run_tests/generated/sources_and_headers.json | 6 +++--- 17 files changed, 30 insertions(+), 33 deletions(-) rename src/core/{lib/channel => ext/filters/http}/client_authority_filter.cc (98%) rename src/core/{lib/channel => ext/filters/http}/client_authority_filter.h (84%) diff --git a/BUILD b/BUILD index 75aebb2462c..8a4349eb81d 100644 --- a/BUILD +++ b/BUILD @@ -676,7 +676,6 @@ grpc_cc_library( "src/core/lib/channel/channel_args.cc", "src/core/lib/channel/channel_stack.cc", "src/core/lib/channel/channel_stack_builder.cc", - "src/core/lib/channel/client_authority_filter.cc", "src/core/lib/channel/connected_channel.cc", "src/core/lib/channel/handshaker.cc", "src/core/lib/channel/handshaker_factory.cc", @@ -812,7 +811,6 @@ grpc_cc_library( "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", - "src/core/lib/channel/client_authority_filter.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/handshaker.h", @@ -1077,10 +1075,10 @@ grpc_cc_library( grpc_cc_library( name = "grpc_client_authority_filter", srcs = [ - "src/core/lib/channel/client_authority_filter.cc", + "src/core/ext/filters/http/client_authority_filter.cc", ], hdrs = [ - "src/core/lib/channel/client_authority_filter.h", + "src/core/ext/filters/http/client_authority_filter.h", ], language = "c++", deps = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index 1657f1ae7e9..836b36a7eb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1132,7 +1132,7 @@ add_library(grpc src/core/ext/census/grpc_context.cc src/core/ext/filters/max_age/max_age_filter.cc src/core/ext/filters/message_size/message_size_filter.cc - src/core/lib/channel/client_authority_filter.cc + src/core/ext/filters/http/client_authority_filter.cc src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc src/core/ext/filters/workarounds/workaround_utils.cc src/core/plugin_registry/grpc_plugin_registry.cc @@ -2367,7 +2367,7 @@ add_library(grpc_unsecure src/core/ext/census/grpc_context.cc src/core/ext/filters/max_age/max_age_filter.cc src/core/ext/filters/message_size/message_size_filter.cc - src/core/lib/channel/client_authority_filter.cc + src/core/ext/filters/http/client_authority_filter.cc src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc src/core/ext/filters/workarounds/workaround_utils.cc src/core/plugin_registry/grpc_unsecure_plugin_registry.cc diff --git a/Makefile b/Makefile index 93b3588de2e..df30405d8b6 100644 --- a/Makefile +++ b/Makefile @@ -3437,7 +3437,7 @@ LIBGRPC_SRC = \ src/core/ext/census/grpc_context.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ - src/core/lib/channel/client_authority_filter.cc \ + src/core/ext/filters/http/client_authority_filter.cc \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \ src/core/ext/filters/workarounds/workaround_utils.cc \ src/core/plugin_registry/grpc_plugin_registry.cc \ @@ -4648,7 +4648,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/census/grpc_context.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ - src/core/lib/channel/client_authority_filter.cc \ + src/core/ext/filters/http/client_authority_filter.cc \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \ src/core/ext/filters/workarounds/workaround_utils.cc \ src/core/plugin_registry/grpc_unsecure_plugin_registry.cc \ diff --git a/build.yaml b/build.yaml index 20581ae00e5..7a2d5cf8846 100644 --- a/build.yaml +++ b/build.yaml @@ -517,9 +517,9 @@ filegroups: - grpc_trace_headers - name: grpc_client_authority_filter headers: - - src/core/lib/channel/client_authority_filter.h + - src/core/ext/filters/http/client_authority_filter.h src: - - src/core/lib/channel/client_authority_filter.cc + - src/core/ext/filters/http/client_authority_filter.cc plugin: grpc_client_authority_filter uses: - grpc_base diff --git a/config.m4 b/config.m4 index 9b48890d4cb..756108ba3ab 100644 --- a/config.m4 +++ b/config.m4 @@ -361,7 +361,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/census/grpc_context.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ - src/core/lib/channel/client_authority_filter.cc \ + src/core/ext/filters/http/client_authority_filter.cc \ src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \ src/core/ext/filters/workarounds/workaround_utils.cc \ src/core/plugin_registry/grpc_plugin_registry.cc \ diff --git a/config.w32 b/config.w32 index b6b417e3de6..755dd080075 100644 --- a/config.w32 +++ b/config.w32 @@ -338,7 +338,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\census\\grpc_context.cc " + "src\\core\\ext\\filters\\max_age\\max_age_filter.cc " + "src\\core\\ext\\filters\\message_size\\message_size_filter.cc " + - "src\\core\\lib\\channel\\client_authority_filter.cc " + + "src\\core\\ext\\filters\\http\\client_authority_filter.cc " + "src\\core\\ext\\filters\\workarounds\\workaround_cronet_compression_filter.cc " + "src\\core\\ext\\filters\\workarounds\\workaround_utils.cc " + "src\\core\\plugin_registry\\grpc_plugin_registry.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 5e8ae3f9a6e..ae68984e653 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -479,7 +479,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/load_reporting/server_load_reporting_plugin.h', 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', - 'src/core/lib/channel/client_authority_filter.h', + 'src/core/ext/filters/http/client_authority_filter.h', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', 'src/core/ext/filters/workarounds/workaround_utils.h' diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 242bc49bd31..e469a99b67e 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -490,7 +490,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/load_reporting/server_load_reporting_plugin.h', 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', - 'src/core/lib/channel/client_authority_filter.h', + 'src/core/ext/filters/http/client_authority_filter.h', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', 'src/core/ext/filters/workarounds/workaround_utils.h', 'src/core/lib/surface/init.cc', @@ -773,7 +773,7 @@ Pod::Spec.new do |s| 'src/core/ext/census/grpc_context.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', - 'src/core/lib/channel/client_authority_filter.cc', + 'src/core/ext/filters/http/client_authority_filter.cc', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc', 'src/core/ext/filters/workarounds/workaround_utils.cc', 'src/core/plugin_registry/grpc_plugin_registry.cc' @@ -1046,7 +1046,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/load_reporting/server_load_reporting_plugin.h', 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', - 'src/core/lib/channel/client_authority_filter.h', + 'src/core/ext/filters/http/client_authority_filter.h', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h', 'src/core/ext/filters/workarounds/workaround_utils.h' end diff --git a/grpc.gemspec b/grpc.gemspec index 33ca745e699..c797b28d547 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -420,7 +420,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/load_reporting/server_load_reporting_plugin.h ) s.files += %w( src/core/ext/filters/max_age/max_age_filter.h ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.h ) - s.files += %w( src/core/lib/channel/client_authority_filter.h ) + s.files += %w( src/core/ext/filters/http/client_authority_filter.h ) s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h ) s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h ) s.files += %w( src/core/lib/surface/init.cc ) @@ -706,7 +706,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/census/grpc_context.cc ) s.files += %w( src/core/ext/filters/max_age/max_age_filter.cc ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.cc ) - s.files += %w( src/core/lib/channel/client_authority_filter.cc ) + s.files += %w( src/core/ext/filters/http/client_authority_filter.cc ) s.files += %w( src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc ) s.files += %w( src/core/ext/filters/workarounds/workaround_utils.cc ) s.files += %w( src/core/plugin_registry/grpc_plugin_registry.cc ) diff --git a/grpc.gyp b/grpc.gyp index 04421bad57c..9448183e690 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -513,7 +513,7 @@ 'src/core/ext/census/grpc_context.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', - 'src/core/lib/channel/client_authority_filter.cc', + 'src/core/ext/filters/http/client_authority_filter.cc', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc', 'src/core/ext/filters/workarounds/workaround_utils.cc', 'src/core/plugin_registry/grpc_plugin_registry.cc', @@ -1194,7 +1194,7 @@ 'src/core/ext/census/grpc_context.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', - 'src/core/lib/channel/client_authority_filter.cc', + 'src/core/ext/filters/http/client_authority_filter.cc', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc', 'src/core/ext/filters/workarounds/workaround_utils.cc', 'src/core/plugin_registry/grpc_unsecure_plugin_registry.cc', diff --git a/package.xml b/package.xml index a8a3c4f356b..79eeffbb0c7 100644 --- a/package.xml +++ b/package.xml @@ -427,7 +427,7 @@ - + @@ -713,7 +713,7 @@ - + diff --git a/src/core/lib/channel/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc similarity index 98% rename from src/core/lib/channel/client_authority_filter.cc rename to src/core/ext/filters/http/client_authority_filter.cc index bf37f52e9c3..5294cfdcc5e 100644 --- a/src/core/lib/channel/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -26,8 +26,8 @@ #include #include +#include "src/core/ext/filters/http/client_authority_filter.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/client_authority_filter.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" diff --git a/src/core/lib/channel/client_authority_filter.h b/src/core/ext/filters/http/client_authority_filter.h similarity index 84% rename from src/core/lib/channel/client_authority_filter.h rename to src/core/ext/filters/http/client_authority_filter.h index c101c359d22..5824e91ff21 100644 --- a/src/core/lib/channel/client_authority_filter.h +++ b/src/core/ext/filters/http/client_authority_filter.h @@ -16,8 +16,8 @@ * */ -#ifndef GRPC_CORE_LIB_CHANNEL_CLIENT_AUTHORITY_FILTER_H -#define GRPC_CORE_LIB_CHANNEL_CLIENT_AUTHORITY_FILTER_H +#ifndef GRPC_CORE_EXT_FILTERS_HTTP_CLIENT_AUTHORITY_FILTER_H +#define GRPC_CORE_EXT_FILTERS_HTTP_CLIENT_AUTHORITY_FILTER_H #include @@ -31,4 +31,4 @@ extern const grpc_channel_filter grpc_client_authority_filter; -#endif /* GRPC_CORE_LIB_CHANNEL_CLIENT_AUTHORITY_FILTER_H */ +#endif /* GRPC_CORE_EXT_FILTERS_HTTP_CLIENT_AUTHORITY_FILTER_H */ diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index 2d29c7d95ff..ac9f9e6066f 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -27,7 +27,6 @@ #include #include #include "src/core/lib/channel/channel_stack.h" -#include "src/core/lib/channel/client_authority_filter.h" #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/handshaker_registry.h" #include "src/core/lib/debug/stats.h" diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index bb426b070f5..5c9107cf2af 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -337,7 +337,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/census/grpc_context.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', - 'src/core/lib/channel/client_authority_filter.cc', + 'src/core/ext/filters/http/client_authority_filter.cc', 'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc', 'src/core/ext/filters/workarounds/workaround_utils.cc', 'src/core/plugin_registry/grpc_plugin_registry.cc', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 1f19bac169f..68e808675ed 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -941,6 +941,8 @@ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/filters/deadline/deadline_filter.h \ src/core/ext/filters/http/client/http_client_filter.cc \ src/core/ext/filters/http/client/http_client_filter.h \ +src/core/ext/filters/http/client_authority_filter.cc \ +src/core/ext/filters/http/client_authority_filter.h \ src/core/ext/filters/http/http_filters_plugin.cc \ src/core/ext/filters/http/message_compress/message_compress_filter.cc \ src/core/ext/filters/http/message_compress/message_compress_filter.h \ @@ -1034,8 +1036,6 @@ src/core/lib/channel/channel_stack.cc \ src/core/lib/channel/channel_stack.h \ src/core/lib/channel/channel_stack_builder.cc \ src/core/lib/channel/channel_stack_builder.h \ -src/core/lib/channel/client_authority_filter.cc \ -src/core/lib/channel/client_authority_filter.h \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 07edd14b043..e5a0d9a2470 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -9423,14 +9423,14 @@ "grpc_base" ], "headers": [ - "src/core/lib/channel/client_authority_filter.h" + "src/core/ext/filters/http/client_authority_filter.h" ], "is_filegroup": true, "language": "c", "name": "grpc_client_authority_filter", "src": [ - "src/core/lib/channel/client_authority_filter.cc", - "src/core/lib/channel/client_authority_filter.h" + "src/core/ext/filters/http/client_authority_filter.cc", + "src/core/ext/filters/http/client_authority_filter.h" ], "third_party": false, "type": "filegroup" From 31e957632fc59457b061f72e98951e293c8c0851 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 21 Mar 2018 13:18:22 -0700 Subject: [PATCH 08/25] Moved assertion for GRPC_ARG_DEFAULT_AUTHORITY into the authority filter --- src/core/ext/filters/http/client_authority_filter.cc | 8 +++++++- src/core/lib/surface/channel.cc | 7 ------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index 5294cfdcc5e..f2b3e0fe7be 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -90,7 +90,13 @@ grpc_error* init_channel_elem(grpc_channel_element* elem, channel_data* chand = static_cast(elem->channel_data); const grpc_arg* default_authority_arg = grpc_channel_args_find(args->channel_args, GRPC_ARG_DEFAULT_AUTHORITY); - GPR_ASSERT(default_authority_arg != nullptr); + if (default_authority_arg == nullptr) { + gpr_log( + GPR_ERROR, + "GRPC_ARG_DEFAULT_AUTHORITY channel arg. not found. Note that direct " + "channels must explicity specify a value for this argument."); + abort(); + } chand->default_authority = grpc_slice_from_copied_string( grpc_channel_arg_get_string(default_authority_arg)); GPR_ASSERT(!args->is_last); diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 9d38fe9c71c..48bc69509f6 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -155,13 +155,6 @@ static grpc_core::UniquePtr get_default_authority( if (!has_default_authority && ssl_override != nullptr) { default_authority.reset(gpr_strdup(ssl_override)); } - if (channel_stack_type == GRPC_CLIENT_DIRECT_CHANNEL && - !has_default_authority) { - gpr_log(GPR_ERROR, - "Direct channels must specify a value for the " - "GRPC_ARG_DEFAULT_AUTHORITY channel arg."); - abort(); - } return default_authority; } From 7d3025f694f7235c7ec3276738032816762194a9 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 21 Mar 2018 17:11:07 -0700 Subject: [PATCH 09/25] regenerated projects --- gRPC-Core.podspec | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 3b7ee03a5c6..137903249b1 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -1222,11 +1222,14 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', + 'src/core/lib/channel/channel_trace.h', + 'src/core/lib/channel/channel_trace_registry.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', 'src/core/lib/channel/handshaker_factory.h', 'src/core/lib/channel/handshaker_registry.h', + 'src/core/lib/channel/status_util.h', 'src/core/lib/compression/algorithm_metadata.h', 'src/core/lib/compression/compression_internal.h', 'src/core/lib/compression/message_compress.h', @@ -1394,7 +1397,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/resolver_factory.h', 'src/core/ext/filters/client_channel/resolver_registry.h', 'src/core/ext/filters/client_channel/retry_throttle.h', - 'src/core/ext/filters/client_channel/status_util.h', 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', @@ -1454,6 +1456,8 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', + 'src/core/tsi/ssl/session_cache/ssl_session.h', + 'src/core/tsi/ssl/session_cache/ssl_session_cache.h', 'src/core/tsi/ssl_transport_security.h', 'src/core/tsi/ssl_types.h', 'src/core/tsi/transport_security_grpc.h', @@ -1464,10 +1468,13 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', 'src/core/lib/channel/channel_stack_builder.cc', + 'src/core/lib/channel/channel_trace.cc', + 'src/core/lib/channel/channel_trace_registry.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/handshaker.cc', 'src/core/lib/channel/handshaker_factory.cc', 'src/core/lib/channel/handshaker_registry.cc', + 'src/core/lib/channel/status_util.cc', 'src/core/lib/compression/compression.cc', 'src/core/lib/compression/compression_internal.cc', 'src/core/lib/compression/message_compress.cc', @@ -1657,7 +1664,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/resolver.cc', 'src/core/ext/filters/client_channel/resolver_registry.cc', 'src/core/ext/filters/client_channel/retry_throttle.cc', - 'src/core/ext/filters/client_channel/status_util.cc', 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', @@ -1728,6 +1734,9 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', 'src/core/tsi/alts_transport_security.cc', 'src/core/tsi/fake_transport_security.cc', + 'src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc', + 'src/core/tsi/ssl/session_cache/ssl_session_cache.cc', + 'src/core/tsi/ssl/session_cache/ssl_session_openssl.cc', 'src/core/tsi/ssl_transport_security.cc', 'src/core/tsi/transport_security_grpc.cc', 'src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc', @@ -1763,11 +1772,14 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', + 'src/core/lib/channel/channel_trace.h', + 'src/core/lib/channel/channel_trace_registry.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/handshaker.h', 'src/core/lib/channel/handshaker_factory.h', 'src/core/lib/channel/handshaker_registry.h', + 'src/core/lib/channel/status_util.h', 'src/core/lib/compression/algorithm_metadata.h', 'src/core/lib/compression/compression_internal.h', 'src/core/lib/compression/message_compress.h', @@ -1935,7 +1947,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/resolver_factory.h', 'src/core/ext/filters/client_channel/resolver_registry.h', 'src/core/ext/filters/client_channel/retry_throttle.h', - 'src/core/ext/filters/client_channel/status_util.h', 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', @@ -1995,6 +2006,8 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', + 'src/core/tsi/ssl/session_cache/ssl_session.h', + 'src/core/tsi/ssl/session_cache/ssl_session_cache.h', 'src/core/tsi/ssl_transport_security.h', 'src/core/tsi/ssl_types.h', 'src/core/tsi/transport_security_grpc.h', From 0c29f6a7037110f63c00263a57f365c00fe3dbec Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 22 Mar 2018 10:51:02 -0700 Subject: [PATCH 10/25] Added comment --- src/core/lib/surface/init_secure.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/lib/surface/init_secure.cc b/src/core/lib/surface/init_secure.cc index 9700f43a55d..28c6f7b121f 100644 --- a/src/core/lib/surface/init_secure.cc +++ b/src/core/lib/surface/init_secure.cc @@ -67,6 +67,9 @@ static bool maybe_prepend_server_auth_filter( } void grpc_register_security_filters(void) { + // Register the auth client with a priority < INT_MAX to allow the authority + // filter -on which the auth filter depends- to be higher on the channel + // stack. grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX - 1, maybe_prepend_client_auth_filter, nullptr); grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX - 1, From 6070be4d9108f0bbeba82157c27baaf50b9104dd Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 22 Mar 2018 16:28:58 -0700 Subject: [PATCH 11/25] Set default authority arg --- test/cpp/end2end/end2end_test.cc | 2 +- test/cpp/end2end/shutdown_test.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 60238e930d7..5efea4a58dc 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -290,7 +290,7 @@ class End2endTest : public ::testing::TestWithParam { args.SetUserAgentPrefix(user_agent_prefix_); } args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test"); - + args.SetString(GRPC_ARG_DEFAULT_AUTHORITY, "test-authority"); if (!GetParam().inproc) { channel_ = CreateCustomChannel(server_address_.str(), channel_creds, args); diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index a53de691bcd..dd916da5c4e 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -86,6 +86,7 @@ class ShutdownTest : public ::testing::TestWithParam { ChannelArguments args; auto channel_creds = GetCredentialsProvider()->GetChannelCredentials(GetParam(), &args); + args.SetString(GRPC_ARG_DEFAULT_AUTHORITY, "test-authority"); channel_ = CreateCustomChannel(target, channel_creds, args); stub_ = grpc::testing::EchoTestService::NewStub(channel_); } From 4b31e36a198c9d232f250e5152016a8c05b4fadc Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 22 Mar 2018 19:24:45 -0700 Subject: [PATCH 12/25] Fixed tests call host --- .../security_connector/security_connector.cc | 30 +++++++++- test/core/end2end/tests/bad_ping.cc | 10 +--- test/core/end2end/tests/binary_metadata.cc | 10 +--- test/core/end2end/tests/call_creds.cc | 18 ++---- .../core/end2end/tests/cancel_after_accept.cc | 8 +-- .../end2end/tests/cancel_after_client_done.cc | 8 +-- .../core/end2end/tests/cancel_after_invoke.cc | 8 +-- .../end2end/tests/cancel_after_round_trip.cc | 8 +-- .../end2end/tests/cancel_before_invoke.cc | 8 +-- test/core/end2end/tests/cancel_in_a_vacuum.cc | 8 +-- test/core/end2end/tests/cancel_with_status.cc | 8 +-- test/core/end2end/tests/compressed_payload.cc | 20 ++----- .../core/end2end/tests/disappearing_server.cc | 10 +--- test/core/end2end/tests/empty_batch.cc | 8 +-- .../end2end/tests/filter_call_init_fails.cc | 32 ++++------ .../core/end2end/tests/filter_causes_close.cc | 8 +-- test/core/end2end/tests/filter_latency.cc | 7 +-- test/core/end2end/tests/filter_status_code.cc | 7 +-- .../end2end/tests/graceful_server_shutdown.cc | 10 +--- test/core/end2end/tests/high_initial_seqno.cc | 10 +--- test/core/end2end/tests/hpack_size.cc | 10 +--- test/core/end2end/tests/idempotent_request.cc | 10 +--- .../end2end/tests/invoke_large_request.cc | 10 +--- test/core/end2end/tests/keepalive_timeout.cc | 10 +--- test/core/end2end/tests/large_metadata.cc | 10 +--- .../core/end2end/tests/load_reporting_hook.cc | 8 +-- .../end2end/tests/max_concurrent_streams.cc | 58 +++++++------------ test/core/end2end/tests/max_connection_age.cc | 20 ++----- .../core/end2end/tests/max_connection_idle.cc | 10 +--- test/core/end2end/tests/max_message_length.cc | 23 +++----- test/core/end2end/tests/negative_deadline.cc | 8 +-- .../end2end/tests/network_status_change.cc | 10 +--- test/core/end2end/tests/no_logging.cc | 10 +--- test/core/end2end/tests/payload.cc | 10 +--- .../core/end2end/tests/ping_pong_streaming.cc | 8 +-- test/core/end2end/tests/proxy_auth.cc | 10 +--- test/core/end2end/tests/registered_call.cc | 10 +--- test/core/end2end/tests/request_with_flags.cc | 8 +-- .../end2end/tests/request_with_payload.cc | 10 +--- .../end2end/tests/resource_quota_server.cc | 9 ++- test/core/end2end/tests/retry.cc | 10 +--- test/core/end2end/tests/retry_cancellation.cc | 8 +-- test/core/end2end/tests/retry_disabled.cc | 10 +--- ...ry_exceeds_buffer_size_in_initial_batch.cc | 10 +--- ...exceeds_buffer_size_in_subsequent_batch.cc | 10 +--- .../tests/retry_non_retriable_status.cc | 10 +--- .../tests/retry_recv_initial_metadata.cc | 10 +--- test/core/end2end/tests/retry_recv_message.cc | 10 +--- .../tests/retry_server_pushback_delay.cc | 10 +--- .../tests/retry_server_pushback_disabled.cc | 10 +--- test/core/end2end/tests/retry_streaming.cc | 10 +--- .../tests/retry_streaming_after_commit.cc | 10 +--- ...reaming_succeeds_before_replay_finished.cc | 10 +--- test/core/end2end/tests/retry_throttled.cc | 10 +--- .../end2end/tests/retry_too_many_attempts.cc | 10 +--- .../end2end/tests/server_finishes_request.cc | 10 +--- .../end2end/tests/shutdown_finishes_calls.cc | 10 +--- .../end2end/tests/simple_cacheable_request.cc | 10 +--- .../end2end/tests/simple_delayed_request.cc | 10 +--- test/core/end2end/tests/simple_metadata.cc | 10 +--- test/core/end2end/tests/simple_request.cc | 10 +--- .../stream_compression_compressed_payload.cc | 20 ++----- .../tests/stream_compression_payload.cc | 10 +--- .../stream_compression_ping_pong_streaming.cc | 8 +-- .../end2end/tests/streaming_error_response.cc | 10 +--- test/core/end2end/tests/trailing_metadata.cc | 10 +--- .../tests/workaround_cronet_compression.cc | 10 +--- test/core/end2end/tests/write_buffering.cc | 10 +--- .../end2end/tests/write_buffering_at_end.cc | 10 +--- 69 files changed, 275 insertions(+), 519 deletions(-) diff --git a/src/core/lib/security/security_connector/security_connector.cc b/src/core/lib/security/security_connector/security_connector.cc index 32ac8033ea4..8040ec99c44 100644 --- a/src/core/lib/security/security_connector/security_connector.cc +++ b/src/core/lib/security/security_connector/security_connector.cc @@ -306,6 +306,7 @@ typedef struct { char* target; char* expected_targets; bool is_lb_channel; + char* ssl_target_name_override; } grpc_fake_channel_security_connector; static void fake_channel_destroy(grpc_security_connector* sc) { @@ -314,6 +315,7 @@ static void fake_channel_destroy(grpc_security_connector* sc) { grpc_call_credentials_unref(c->base.request_metadata_creds); gpr_free(c->target); gpr_free(c->expected_targets); + gpr_free(c->ssl_target_name_override); gpr_free(c); } @@ -465,11 +467,27 @@ static bool fake_channel_check_call_host(grpc_channel_security_connector* sc, grpc_error** error) { grpc_fake_channel_security_connector* c = reinterpret_cast(sc); - if (c->is_lb_channel && strcmp(host, c->target) != 0) { - gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s' for an LB call", - host, c->target); + char* authority_hostname = nullptr; + char* authority_ignored_port = nullptr; + char* target_hostname = nullptr; + char* target_ignored_port = nullptr; + gpr_split_host_port(host, &authority_hostname, &authority_ignored_port); + gpr_split_host_port(c->target, &target_hostname, &target_ignored_port); + if (c->ssl_target_name_override != nullptr) { + abort(); + if (strcmp(authority_hostname, target_hostname) != 0) { + gpr_log(GPR_ERROR, "Authority (host) '%s' != SSL Target override '%s'", + host, c->ssl_target_name_override); + } + } + if (strcmp(authority_hostname, target_hostname) != 0) { + gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s'", host, c->target); abort(); } + gpr_free(authority_hostname); + gpr_free(authority_ignored_port); + gpr_free(target_hostname); + gpr_free(target_ignored_port); return true; } @@ -522,6 +540,12 @@ grpc_channel_security_connector* grpc_fake_channel_security_connector_create( const char* expected_targets = grpc_fake_transport_get_expected_targets(args); c->expected_targets = gpr_strdup(expected_targets); c->is_lb_channel = grpc_core::FindTargetAuthorityTableInArgs(args) != nullptr; + const grpc_arg* ssl_target_name_override_arg = + grpc_channel_args_find(args, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); + if (ssl_target_name_override_arg != nullptr) { + c->ssl_target_name_override = + grpc_channel_arg_get_string(ssl_target_name_override_arg); + } return &c->base; } diff --git a/test/core/end2end/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc index 95f72ca4c85..00edf63e508 100644 --- a/test/core/end2end/tests/bad_ping.cc +++ b/test/core/end2end/tests/bad_ping.cc @@ -107,11 +107,9 @@ static void test_bad_ping(grpc_end2end_test_config config) { grpc_slice details; int was_cancelled = 2; - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -206,8 +204,6 @@ static void test_bad_ping(grpc_end2end_test_config config) { // the in-progress RPC should fail. GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/binary_metadata.cc b/test/core/end2end/tests/binary_metadata.cc index e66b4da6ccd..cdf5b1eb94d 100644 --- a/test/core/end2end/tests/binary_metadata.cc +++ b/test/core/end2end/tests/binary_metadata.cc @@ -136,11 +136,9 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -278,8 +276,6 @@ static void test_request_response_with_metadata_and_payload( "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0" "\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/call_creds.cc b/test/core/end2end/tests/call_creds.cc index e9cbaa3088c..ead6ecb1f74 100644 --- a/test/core/end2end/tests/call_creds.cc +++ b/test/core/end2end/tests/call_creds.cc @@ -156,11 +156,9 @@ static void request_response_with_payload_and_call_creds( cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, nullptr); GPR_ASSERT(creds != nullptr); @@ -292,8 +290,6 @@ static void request_response_with_payload_and_call_creds( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); @@ -396,11 +392,9 @@ static void test_request_with_server_rejecting_client_creds( f = begin_test(config, "test_request_with_server_rejecting_client_creds", 1); cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); creds = grpc_google_iam_credentials_create(iam_token, iam_selector, nullptr); diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc index e94ea51a75d..788d374baad 100644 --- a/test/core/end2end/tests/cancel_after_accept.cc +++ b/test/core/end2end/tests/cancel_after_accept.cc @@ -146,11 +146,9 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, gpr_timespec deadline = use_service_config ? gpr_inf_future(GPR_CLOCK_MONOTONIC) : five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_client_done.cc b/test/core/end2end/tests/cancel_after_client_done.cc index 31c3ea6f74a..6e9378378ed 100644 --- a/test/core/end2end/tests/cancel_after_client_done.cc +++ b/test/core/end2end/tests/cancel_after_client_done.cc @@ -119,11 +119,9 @@ static void test_cancel_after_accept_and_writes_closed( int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_invoke.cc b/test/core/end2end/tests/cancel_after_invoke.cc index 72f724281e0..78009eb3bb3 100644 --- a/test/core/end2end/tests/cancel_after_invoke.cc +++ b/test/core/end2end/tests/cancel_after_invoke.cc @@ -113,11 +113,9 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_raw_byte_buffer_create(&request_payload_slice, 1); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_round_trip.cc b/test/core/end2end/tests/cancel_after_round_trip.cc index 4890b3013f3..061b273f18d 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.cc +++ b/test/core/end2end/tests/cancel_after_round_trip.cc @@ -148,11 +148,9 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, gpr_timespec deadline = use_service_config ? gpr_inf_future(GPR_CLOCK_MONOTONIC) : five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_before_invoke.cc b/test/core/end2end/tests/cancel_before_invoke.cc index c7d3ed5a4f3..abb2dbc8c3c 100644 --- a/test/core/end2end/tests/cancel_before_invoke.cc +++ b/test/core/end2end/tests/cancel_before_invoke.cc @@ -109,11 +109,9 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, grpc_raw_byte_buffer_create(&request_payload_slice, 1); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, nullptr)); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.cc b/test/core/end2end/tests/cancel_in_a_vacuum.cc index 6be2d690955..4672e64a4e1 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.cc +++ b/test/core/end2end/tests/cancel_in_a_vacuum.cc @@ -97,11 +97,9 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, cq_verifier* v_client = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, nullptr)); diff --git a/test/core/end2end/tests/cancel_with_status.cc b/test/core/end2end/tests/cancel_with_status.cc index 887da859394..2fc9d2ff271 100644 --- a/test/core/end2end/tests/cancel_with_status.cc +++ b/test/core/end2end/tests/cancel_with_status.cc @@ -104,11 +104,9 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc index 85cfe16508b..178d68c608d 100644 --- a/test/core/end2end/tests/compressed_payload.cc +++ b/test/core/end2end/tests/compressed_payload.cc @@ -137,11 +137,9 @@ static void request_for_disabled_algorithm( cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -239,8 +237,6 @@ static void request_for_disabled_algorithm( GPR_ASSERT(0 == grpc_slice_str_cmp(details, expected_details)); gpr_free(expected_details); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); @@ -320,11 +316,9 @@ static void request_with_payload_template( cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -529,8 +523,6 @@ static void request_with_payload_template( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/disappearing_server.cc b/test/core/end2end/tests/disappearing_server.cc index d5b6f8fbf04..fdd780f117e 100644 --- a/test/core/end2end/tests/disappearing_server.cc +++ b/test/core/end2end/tests/disappearing_server.cc @@ -85,11 +85,9 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f->cq, grpc_slice_from_static_string("/foo"), + nullptr, deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -167,8 +165,6 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/empty_batch.cc b/test/core/end2end/tests/empty_batch.cc index 1de4b8fda85..317bb7aeb07 100644 --- a/test/core/end2end/tests/empty_batch.cc +++ b/test/core/end2end/tests/empty_batch.cc @@ -93,11 +93,9 @@ static void empty_batch_body(grpc_end2end_test_config config, grpc_op* op = nullptr; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); error = grpc_call_start_batch(c, op, 0, tag(1), nullptr); diff --git a/test/core/end2end/tests/filter_call_init_fails.cc b/test/core/end2end/tests/filter_call_init_fails.cc index 6f72a1843a2..ab96879fe44 100644 --- a/test/core/end2end/tests/filter_call_init_fails.cc +++ b/test/core/end2end/tests/filter_call_init_fails.cc @@ -117,11 +117,9 @@ static void test_server_channel_filter(grpc_end2end_test_config config) { grpc_slice details; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -213,11 +211,9 @@ static void test_client_channel_filter(grpc_end2end_test_config config) { grpc_call_error error; grpc_slice details; - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -304,11 +300,9 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { grpc_call_error error; grpc_slice details; - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -364,11 +358,9 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { grpc_slice_unref(details); details = grpc_empty_slice(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); error = grpc_call_start_batch(c, ops, static_cast(op - ops), tag(2), diff --git a/test/core/end2end/tests/filter_causes_close.cc b/test/core/end2end/tests/filter_causes_close.cc index bc4cb8633dd..a7f4268803f 100644 --- a/test/core/end2end/tests/filter_causes_close.cc +++ b/test/core/end2end/tests/filter_causes_close.cc @@ -111,11 +111,9 @@ static void test_request(grpc_end2end_test_config config) { grpc_slice details; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/filter_latency.cc b/test/core/end2end/tests/filter_latency.cc index 51f54c97428..a89db7b094b 100644 --- a/test/core/end2end/tests/filter_latency.cc +++ b/test/core/end2end/tests/filter_latency.cc @@ -125,10 +125,9 @@ static void test_request(grpc_end2end_test_config config) { const gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr", config), deadline, nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/filter_status_code.cc b/test/core/end2end/tests/filter_status_code.cc index 32cd95410ef..ba3cbfa6d11 100644 --- a/test/core/end2end/tests/filter_status_code.cc +++ b/test/core/end2end/tests/filter_status_code.cc @@ -126,10 +126,9 @@ static void test_request(grpc_end2end_test_config config) { gpr_mu_unlock(&g_mu); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr", config), deadline, nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); gpr_mu_lock(&g_mu); g_client_call_stack = grpc_call_get_call_stack(c); diff --git a/test/core/end2end/tests/graceful_server_shutdown.cc b/test/core/end2end/tests/graceful_server_shutdown.cc index 3ef414f83cc..42f2d1a4146 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.cc +++ b/test/core/end2end/tests/graceful_server_shutdown.cc @@ -99,11 +99,9 @@ static void test_early_server_shutdown_finishes_inflight_calls( int was_cancelled = 2; gpr_timespec deadline = n_seconds_from_now(10); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -183,8 +181,6 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/high_initial_seqno.cc b/test/core/end2end/tests/high_initial_seqno.cc index 87674378028..18e6ee90ef5 100644 --- a/test/core/end2end/tests/high_initial_seqno.cc +++ b/test/core/end2end/tests/high_initial_seqno.cc @@ -104,11 +104,9 @@ static void simple_request_body(grpc_end2end_test_config config, int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -181,8 +179,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/hpack_size.cc b/test/core/end2end/tests/hpack_size.cc index b49736841e1..7c51294e1cc 100644 --- a/test/core/end2end/tests/hpack_size.cc +++ b/test/core/end2end/tests/hpack_size.cc @@ -257,11 +257,9 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice_from_static_string(dragons[index % GPR_ARRAY_SIZE(dragons)]); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -335,8 +333,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/idempotent_request.cc b/test/core/end2end/tests/idempotent_request.cc index 56be2d6afe7..80908d5210c 100644 --- a/test/core/end2end/tests/idempotent_request.cc +++ b/test/core/end2end/tests/idempotent_request.cc @@ -104,11 +104,9 @@ static void simple_request_body(grpc_end2end_test_config config, char* peer; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -195,8 +193,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/invoke_large_request.cc b/test/core/end2end/tests/invoke_large_request.cc index 1aab34c2cee..39d90ab64df 100644 --- a/test/core/end2end/tests/invoke_large_request.cc +++ b/test/core/end2end/tests/invoke_large_request.cc @@ -131,11 +131,9 @@ static void test_invoke_large_request(grpc_end2end_test_config config, int was_cancelled = 2; gpr_timespec deadline = n_seconds_from_now(30); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -237,8 +235,6 @@ static void test_invoke_large_request(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/keepalive_timeout.cc b/test/core/end2end/tests/keepalive_timeout.cc index f0dd061e339..9168a4e0168 100644 --- a/test/core/end2end/tests/keepalive_timeout.cc +++ b/test/core/end2end/tests/keepalive_timeout.cc @@ -130,11 +130,9 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { grpc_set_disable_ping_ack(true); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -200,8 +198,6 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_INTERNAL); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "keepalive watchdog timeout")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); gpr_free(details_str); gpr_free(method_str); diff --git a/test/core/end2end/tests/large_metadata.cc b/test/core/end2end/tests/large_metadata.cc index da0615bf6e5..c7f72a1cabb 100644 --- a/test/core/end2end/tests/large_metadata.cc +++ b/test/core/end2end/tests/large_metadata.cc @@ -114,11 +114,9 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); meta.key = grpc_slice_from_static_string("key"); @@ -220,8 +218,6 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(contains_metadata_slices(&request_metadata_recv, diff --git a/test/core/end2end/tests/load_reporting_hook.cc b/test/core/end2end/tests/load_reporting_hook.cc index 9e79d02be4a..4324e9dfc17 100644 --- a/test/core/end2end/tests/load_reporting_hook.cc +++ b/test/core/end2end/tests/load_reporting_hook.cc @@ -138,11 +138,9 @@ static void request_response_with_payload( int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string(method_name), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string(method_name), + nullptr, deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/max_concurrent_streams.cc b/test/core/end2end/tests/max_concurrent_streams.cc index 789b3d4b77a..86a8d224435 100644 --- a/test/core/end2end/tests/max_concurrent_streams.cc +++ b/test/core/end2end/tests/max_concurrent_streams.cc @@ -100,11 +100,9 @@ static void simple_request_body(grpc_end2end_test_config config, int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -177,8 +175,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); @@ -248,17 +244,13 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { /* start two requests - ensuring that the second is not accepted until the first completes */ deadline = n_seconds_from_now(1000); - c1 = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/alpha"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c1 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f.cq, grpc_slice_from_static_string("/alpha"), + nullptr, deadline, nullptr); GPR_ASSERT(c1); - c2 = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/beta"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c2 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f.cq, grpc_slice_from_static_string("/beta"), + nullptr, deadline, nullptr); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -494,17 +486,13 @@ static void test_max_concurrent_streams_with_timeout_on_first( /* start two requests - ensuring that the second is not accepted until the first completes */ - c1 = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/alpha"), - get_host_override_slice("foo.test.google.fr:1234", config), - n_seconds_from_now(3), nullptr); + c1 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f.cq, grpc_slice_from_static_string("/alpha"), + nullptr, n_seconds_from_now(3), nullptr); GPR_ASSERT(c1); - c2 = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/beta"), - get_host_override_slice("foo.test.google.fr:1234", config), - n_seconds_from_now(1000), nullptr); + c2 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f.cq, grpc_slice_from_static_string("/beta"), + nullptr, n_seconds_from_now(1000), nullptr); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -694,17 +682,13 @@ static void test_max_concurrent_streams_with_timeout_on_second( /* start two requests - ensuring that the second is not accepted until the first completes , and the second request will timeout in the concurrent_list */ - c1 = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/alpha"), - get_host_override_slice("foo.test.google.fr:1234", config), - n_seconds_from_now(1000), nullptr); + c1 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f.cq, grpc_slice_from_static_string("/alpha"), + nullptr, n_seconds_from_now(1000), nullptr); GPR_ASSERT(c1); - c2 = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/beta"), - get_host_override_slice("foo.test.google.fr:1234", config), - n_seconds_from_now(3), nullptr); + c2 = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f.cq, grpc_slice_from_static_string("/beta"), + nullptr, n_seconds_from_now(3), nullptr); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( diff --git a/test/core/end2end/tests/max_connection_age.cc b/test/core/end2end/tests/max_connection_age.cc index e494dad19cf..fcb0aaffc4a 100644 --- a/test/core/end2end/tests/max_connection_age.cc +++ b/test/core/end2end/tests/max_connection_age.cc @@ -109,11 +109,9 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { grpc_slice details; int was_cancelled = 2; - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -208,8 +206,6 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { the in-progress RPC should fail. */ GPR_ASSERT(status == GRPC_STATUS_INTERNAL); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); @@ -255,11 +251,9 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { grpc_slice details; int was_cancelled = 2; - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -348,8 +342,6 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/max_connection_idle.cc b/test/core/end2end/tests/max_connection_idle.cc index 2f212b965ff..faa1383207d 100644 --- a/test/core/end2end/tests/max_connection_idle.cc +++ b/test/core/end2end/tests/max_connection_idle.cc @@ -60,11 +60,9 @@ static void simple_request_body(grpc_end2end_test_config config, char* peer; gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); - c = grpc_channel_create_call( - f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f->cq, grpc_slice_from_static_string("/foo"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -151,8 +149,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/max_message_length.cc b/test/core/end2end/tests/max_message_length.cc index fa5b3b6e9b4..6ac941e0da0 100644 --- a/test/core/end2end/tests/max_message_length.cc +++ b/test/core/end2end/tests/max_message_length.cc @@ -180,11 +180,10 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), - gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, gpr_inf_future(GPR_CLOCK_REALTIME), + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -258,8 +257,6 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, cq_verify(cqv); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); done: @@ -371,11 +368,10 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, } cqv = cq_verifier_create(f.cq); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), - gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, gpr_inf_future(GPR_CLOCK_REALTIME), + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -456,9 +452,6 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, cq_verify(cqv); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - GPR_ASSERT(0 == - grpc_slice_str_cmp(call_details.host, "foo.test.google.fr:1234")); - GPR_ASSERT(status == GRPC_STATUS_RESOURCE_EXHAUSTED); GPR_ASSERT( grpc_slice_str_cmp( diff --git a/test/core/end2end/tests/negative_deadline.cc b/test/core/end2end/tests/negative_deadline.cc index dce3a02d254..2b2ff126c4a 100644 --- a/test/core/end2end/tests/negative_deadline.cc +++ b/test/core/end2end/tests/negative_deadline.cc @@ -101,11 +101,9 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_REALTIME); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/network_status_change.cc b/test/core/end2end/tests/network_status_change.cc index 83cb172f262..98a95582046 100644 --- a/test/core/end2end/tests/network_status_change.cc +++ b/test/core/end2end/tests/network_status_change.cc @@ -110,11 +110,9 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -209,8 +207,6 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); diff --git a/test/core/end2end/tests/no_logging.cc b/test/core/end2end/tests/no_logging.cc index b357e3b0ad5..c8154023b89 100644 --- a/test/core/end2end/tests/no_logging.cc +++ b/test/core/end2end/tests/no_logging.cc @@ -131,11 +131,9 @@ static void simple_request_body(grpc_end2end_test_config config, char* peer; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -219,8 +217,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/payload.cc b/test/core/end2end/tests/payload.cc index 340c76e1733..cb6eb47de93 100644 --- a/test/core/end2end/tests/payload.cc +++ b/test/core/end2end/tests/payload.cc @@ -129,11 +129,9 @@ static void request_response_with_payload(grpc_end2end_test_config config, int was_cancelled = 2; gpr_timespec deadline = n_seconds_from_now(60); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -235,8 +233,6 @@ static void request_response_with_payload(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_slice(request_payload_recv, request_payload_slice)); GPR_ASSERT( diff --git a/test/core/end2end/tests/ping_pong_streaming.cc b/test/core/end2end/tests/ping_pong_streaming.cc index 9ca880481fd..30ee0bf8b82 100644 --- a/test/core/end2end/tests/ping_pong_streaming.cc +++ b/test/core/end2end/tests/ping_pong_streaming.cc @@ -112,11 +112,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, grpc_slice_from_copied_string("hello you"); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/proxy_auth.cc b/test/core/end2end/tests/proxy_auth.cc index 5a2e0ef4143..3b12869d2f0 100644 --- a/test/core/end2end/tests/proxy_auth.cc +++ b/test/core/end2end/tests/proxy_auth.cc @@ -108,11 +108,9 @@ static void simple_request_body(grpc_end2end_test_config config, char* peer; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -199,8 +197,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/registered_call.cc b/test/core/end2end/tests/registered_call.cc index d4ca1467079..3e05fd1421f 100644 --- a/test/core/end2end/tests/registered_call.cc +++ b/test/core/end2end/tests/registered_call.cc @@ -177,8 +177,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); @@ -196,9 +194,7 @@ static void simple_request_body(grpc_end2end_test_config config, static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); - void* rc = grpc_channel_register_call( - f.client, "/foo", - get_host_override_string("foo.test.google.fr:1234", config), nullptr); + void* rc = grpc_channel_register_call(f.client, "/foo", nullptr, nullptr); simple_request_body(config, f, rc); end_test(&f); @@ -209,9 +205,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = begin_test(config, "test_invoke_10_simple_requests", nullptr, nullptr); - void* rc = grpc_channel_register_call( - f.client, "/foo", - get_host_override_string("foo.test.google.fr:1234", config), nullptr); + void* rc = grpc_channel_register_call(f.client, "/foo", nullptr, nullptr); for (i = 0; i < 10; i++) { simple_request_body(config, f, rc); diff --git a/test/core/end2end/tests/request_with_flags.cc b/test/core/end2end/tests/request_with_flags.cc index c52482470ef..f3baf3790fb 100644 --- a/test/core/end2end/tests/request_with_flags.cc +++ b/test/core/end2end/tests/request_with_flags.cc @@ -108,11 +108,9 @@ static void test_invoke_request_with_flags( grpc_call_error expectation; gpr_timespec deadline = one_second_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/request_with_payload.cc b/test/core/end2end/tests/request_with_payload.cc index 44398df52de..37d9481f282 100644 --- a/test/core/end2end/tests/request_with_payload.cc +++ b/test/core/end2end/tests/request_with_payload.cc @@ -107,11 +107,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -202,8 +200,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); diff --git a/test/core/end2end/tests/resource_quota_server.cc b/test/core/end2end/tests/resource_quota_server.cc index 33d6b4ef314..df83caa6625 100644 --- a/test/core/end2end/tests/resource_quota_server.cc +++ b/test/core/end2end/tests/resource_quota_server.cc @@ -188,11 +188,10 @@ void resource_quota_server(grpc_end2end_test_config config) { } for (int i = 0; i < NUM_CALLS; i++) { - client_calls[i] = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr", config), - n_seconds_from_now(60), nullptr); + client_calls[i] = + grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f.cq, grpc_slice_from_static_string("/foo"), + nullptr, n_seconds_from_now(60), nullptr); memset(ops, 0, sizeof(ops)); op = ops; diff --git a/test/core/end2end/tests/retry.cc b/test/core/end2end/tests/retry.cc index 38ecc6fbb11..243dedc62c1 100644 --- a/test/core/end2end/tests/retry.cc +++ b/test/core/end2end/tests/retry.cc @@ -145,11 +145,9 @@ static void test_retry(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -293,8 +291,6 @@ static void test_retry(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 0); diff --git a/test/core/end2end/tests/retry_cancellation.cc b/test/core/end2end/tests/retry_cancellation.cc index 0504092c4f6..e764fe70a60 100644 --- a/test/core/end2end/tests/retry_cancellation.cc +++ b/test/core/end2end/tests/retry_cancellation.cc @@ -146,11 +146,9 @@ static void test_retry_cancellation(grpc_end2end_test_config config, cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); diff --git a/test/core/end2end/tests/retry_disabled.cc b/test/core/end2end/tests/retry_disabled.cc index cb30502aeb0..ed3535409fe 100644 --- a/test/core/end2end/tests/retry_disabled.cc +++ b/test/core/end2end/tests/retry_disabled.cc @@ -149,11 +149,9 @@ static void test_retry_disabled(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -230,8 +228,6 @@ static void test_retry_disabled(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc b/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc index 3908f29971c..a033a0aa957 100644 --- a/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc +++ b/test/core/end2end/tests/retry_exceeds_buffer_size_in_initial_batch.cc @@ -152,11 +152,9 @@ static void test_retry_exceeds_buffer_size_in_initial_batch( cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -233,8 +231,6 @@ static void test_retry_exceeds_buffer_size_in_initial_batch( GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc b/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc index 409fac48886..c1070e61918 100644 --- a/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc +++ b/test/core/end2end/tests/retry_exceeds_buffer_size_in_subsequent_batch.cc @@ -157,11 +157,9 @@ static void test_retry_exceeds_buffer_size_in_subsequent_batch( cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -245,8 +243,6 @@ static void test_retry_exceeds_buffer_size_in_subsequent_batch( GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_non_retriable_status.cc b/test/core/end2end/tests/retry_non_retriable_status.cc index 6d59db0b043..b8d094749a5 100644 --- a/test/core/end2end/tests/retry_non_retriable_status.cc +++ b/test/core/end2end/tests/retry_non_retriable_status.cc @@ -144,11 +144,9 @@ static void test_retry_non_retriable_status(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -225,8 +223,6 @@ static void test_retry_non_retriable_status(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_INVALID_ARGUMENT); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_recv_initial_metadata.cc b/test/core/end2end/tests/retry_recv_initial_metadata.cc index 14215e449c6..839b8703677 100644 --- a/test/core/end2end/tests/retry_recv_initial_metadata.cc +++ b/test/core/end2end/tests/retry_recv_initial_metadata.cc @@ -145,11 +145,9 @@ static void test_retry_recv_initial_metadata(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -236,8 +234,6 @@ static void test_retry_recv_initial_metadata(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_recv_message.cc b/test/core/end2end/tests/retry_recv_message.cc index 86171fdc01b..5fdaad0b880 100644 --- a/test/core/end2end/tests/retry_recv_message.cc +++ b/test/core/end2end/tests/retry_recv_message.cc @@ -145,11 +145,9 @@ static void test_retry_recv_message(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -229,8 +227,6 @@ static void test_retry_recv_message(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_server_pushback_delay.cc b/test/core/end2end/tests/retry_server_pushback_delay.cc index 1da986041fd..f6a979613d9 100644 --- a/test/core/end2end/tests/retry_server_pushback_delay.cc +++ b/test/core/end2end/tests/retry_server_pushback_delay.cc @@ -150,11 +150,9 @@ static void test_retry_server_pushback_delay(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -286,8 +284,6 @@ static void test_retry_server_pushback_delay(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 0); diff --git a/test/core/end2end/tests/retry_server_pushback_disabled.cc b/test/core/end2end/tests/retry_server_pushback_disabled.cc index 13d4f01eea9..1c564761835 100644 --- a/test/core/end2end/tests/retry_server_pushback_disabled.cc +++ b/test/core/end2end/tests/retry_server_pushback_disabled.cc @@ -151,11 +151,9 @@ static void test_retry_server_pushback_disabled( cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -274,8 +272,6 @@ static void test_retry_server_pushback_disabled( GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_streaming.cc b/test/core/end2end/tests/retry_streaming.cc index e96e57e8bcf..d06d124ca42 100644 --- a/test/core/end2end/tests/retry_streaming.cc +++ b/test/core/end2end/tests/retry_streaming.cc @@ -158,11 +158,9 @@ static void test_retry_streaming(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -383,8 +381,6 @@ static void test_retry_streaming(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_streaming_after_commit.cc b/test/core/end2end/tests/retry_streaming_after_commit.cc index 43eee86d957..05025d0a10b 100644 --- a/test/core/end2end/tests/retry_streaming_after_commit.cc +++ b/test/core/end2end/tests/retry_streaming_after_commit.cc @@ -151,11 +151,9 @@ static void test_retry_streaming_after_commit(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -312,8 +310,6 @@ static void test_retry_streaming_after_commit(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc b/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc index 5c92f648050..14460d2a465 100644 --- a/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc +++ b/test/core/end2end/tests/retry_streaming_succeeds_before_replay_finished.cc @@ -152,11 +152,9 @@ static void test_retry_streaming_succeeds_before_replay_finished( cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -364,8 +362,6 @@ static void test_retry_streaming_succeeds_before_replay_finished( GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_throttled.cc b/test/core/end2end/tests/retry_throttled.cc index 8cd08487eaa..f5b28def0ad 100644 --- a/test/core/end2end/tests/retry_throttled.cc +++ b/test/core/end2end/tests/retry_throttled.cc @@ -151,11 +151,9 @@ static void test_retry_throttled(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -232,8 +230,6 @@ static void test_retry_throttled(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/retry_too_many_attempts.cc b/test/core/end2end/tests/retry_too_many_attempts.cc index 5225c9b229c..2af32679f1e 100644 --- a/test/core/end2end/tests/retry_too_many_attempts.cc +++ b/test/core/end2end/tests/retry_too_many_attempts.cc @@ -145,11 +145,9 @@ static void test_retry_too_many_attempts(grpc_end2end_test_config config) { cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/service/method"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/service/method"), + nullptr, deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -267,8 +265,6 @@ static void test_retry_too_many_attempts(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_ABORTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/service/method")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/server_finishes_request.cc b/test/core/end2end/tests/server_finishes_request.cc index 6fc06cfaa11..c81b309a1e6 100644 --- a/test/core/end2end/tests/server_finishes_request.cc +++ b/test/core/end2end/tests/server_finishes_request.cc @@ -102,11 +102,9 @@ static void simple_request_body(grpc_end2end_test_config config, int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -175,8 +173,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/shutdown_finishes_calls.cc b/test/core/end2end/tests/shutdown_finishes_calls.cc index 28728ef46c9..5dd5bb2ad6c 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.cc +++ b/test/core/end2end/tests/shutdown_finishes_calls.cc @@ -92,11 +92,9 @@ static void test_early_server_shutdown_finishes_inflight_calls( int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -172,8 +170,6 @@ static void test_early_server_shutdown_finishes_inflight_calls( GPR_ASSERT(status == GRPC_STATUS_INTERNAL || status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/simple_cacheable_request.cc b/test/core/end2end/tests/simple_cacheable_request.cc index 4ae8398a6e8..be6d16ecad7 100644 --- a/test/core/end2end/tests/simple_cacheable_request.cc +++ b/test/core/end2end/tests/simple_cacheable_request.cc @@ -132,11 +132,9 @@ static void test_cacheable_request_response_with_metadata_and_payload( int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -240,8 +238,6 @@ static void test_cacheable_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); if (config.feature_mask & FEATURE_MASK_SUPPORTS_REQUEST_PROXYING) { // Our simple proxy does not support cacheable requests } else { diff --git a/test/core/end2end/tests/simple_delayed_request.cc b/test/core/end2end/tests/simple_delayed_request.cc index f8a1ddfdc39..8d116999459 100644 --- a/test/core/end2end/tests/simple_delayed_request.cc +++ b/test/core/end2end/tests/simple_delayed_request.cc @@ -94,11 +94,9 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, config.init_server(f, server_args); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, + f->cq, grpc_slice_from_static_string("/foo"), + nullptr, deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -171,8 +169,6 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/simple_metadata.cc b/test/core/end2end/tests/simple_metadata.cc index 1f39f8983b2..3e476c2129d 100644 --- a/test/core/end2end/tests/simple_metadata.cc +++ b/test/core/end2end/tests/simple_metadata.cc @@ -130,11 +130,9 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -238,8 +236,6 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index 926e2c7452d..2d6ccad0ec4 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -111,11 +111,9 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_stats_collect(before); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); @@ -212,8 +210,6 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(nullptr != strstr(error_string, "grpc_message")); GPR_ASSERT(nullptr != strstr(error_string, "grpc_status")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.cc b/test/core/end2end/tests/stream_compression_compressed_payload.cc index e90d54f0541..839f0912a87 100644 --- a/test/core/end2end/tests/stream_compression_compressed_payload.cc +++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc @@ -137,11 +137,9 @@ static void request_for_disabled_algorithm( cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -239,8 +237,6 @@ static void request_for_disabled_algorithm( GPR_ASSERT(0 == grpc_slice_str_cmp(details, expected_details)); gpr_free(expected_details); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); @@ -327,11 +323,9 @@ static void request_with_payload_template( cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -529,8 +523,6 @@ static void request_with_payload_template( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/stream_compression_payload.cc b/test/core/end2end/tests/stream_compression_payload.cc index 9eace97afd0..4c08150723a 100644 --- a/test/core/end2end/tests/stream_compression_payload.cc +++ b/test/core/end2end/tests/stream_compression_payload.cc @@ -132,11 +132,9 @@ static void request_response_with_payload(grpc_end2end_test_config config, int was_cancelled = 2; gpr_timespec deadline = n_seconds_from_now(60); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -238,8 +236,6 @@ static void request_response_with_payload(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_slice(request_payload_recv, request_payload_slice)); GPR_ASSERT( diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc index 5b033292b0d..f7af59febe9 100644 --- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc +++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc @@ -120,11 +120,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, grpc_slice_from_copied_string("hello you"); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/streaming_error_response.cc b/test/core/end2end/tests/streaming_error_response.cc index 7c7d778d1e2..4c357e077e2 100644 --- a/test/core/end2end/tests/streaming_error_response.cc +++ b/test/core/end2end/tests/streaming_error_response.cc @@ -116,11 +116,9 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -244,8 +242,6 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { GPR_ASSERT(status == GRPC_STATUS_FAILED_PRECONDITION); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/trailing_metadata.cc b/test/core/end2end/tests/trailing_metadata.cc index 24069854acc..5cf6f2bb115 100644 --- a/test/core/end2end/tests/trailing_metadata.cc +++ b/test/core/end2end/tests/trailing_metadata.cc @@ -138,11 +138,9 @@ static void test_request_response_with_metadata_and_payload( int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -247,8 +245,6 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc index 4d4c369a422..f44ddca3b10 100644 --- a/test/core/end2end/tests/workaround_cronet_compression.cc +++ b/test/core/end2end/tests/workaround_cronet_compression.cc @@ -155,11 +155,9 @@ static void request_with_payload_template( cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -338,8 +336,6 @@ static void request_with_payload_template( GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); grpc_slice_unref(details); diff --git a/test/core/end2end/tests/write_buffering.cc b/test/core/end2end/tests/write_buffering.cc index 5d76d238b9e..2f7ee9c8926 100644 --- a/test/core/end2end/tests/write_buffering.cc +++ b/test/core/end2end/tests/write_buffering.cc @@ -111,11 +111,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -255,8 +253,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv1, "hello world")); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv2, "abc123")); diff --git a/test/core/end2end/tests/write_buffering_at_end.cc b/test/core/end2end/tests/write_buffering_at_end.cc index bd046ef9cc5..886d491a10f 100644 --- a/test/core/end2end/tests/write_buffering_at_end.cc +++ b/test/core/end2end/tests/write_buffering_at_end.cc @@ -108,11 +108,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { int was_cancelled = 2; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -246,8 +244,6 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_OK); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv1, "hello world")); GPR_ASSERT(request_payload_recv2 == nullptr); From d043fa06bcc896a12b4563bbf61fe99fdd0bb9d4 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 23 Mar 2018 13:58:27 -0700 Subject: [PATCH 13/25] PR comments --- .../security_connector/security_connector.cc | 19 +++++++++----- src/core/lib/surface/channel.cc | 5 ++-- test/core/end2end/fixtures/h2_fakesec.cc | 1 - test/core/end2end/tests/default_host.cc | 26 +++++++++---------- test/cpp/end2end/end2end_test.cc | 2 +- test/cpp/end2end/shutdown_test.cc | 1 - 6 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/core/lib/security/security_connector/security_connector.cc b/src/core/lib/security/security_connector/security_connector.cc index 8040ec99c44..a0e05a3fbd6 100644 --- a/src/core/lib/security/security_connector/security_connector.cc +++ b/src/core/lib/security/security_connector/security_connector.cc @@ -474,14 +474,21 @@ static bool fake_channel_check_call_host(grpc_channel_security_connector* sc, gpr_split_host_port(host, &authority_hostname, &authority_ignored_port); gpr_split_host_port(c->target, &target_hostname, &target_ignored_port); if (c->ssl_target_name_override != nullptr) { - abort(); - if (strcmp(authority_hostname, target_hostname) != 0) { + char* ssl_target_name_override_hostname = nullptr; + char* ssl_target_name_override_ignored_port = nullptr; + gpr_split_host_port(c->ssl_target_name_override, + &ssl_target_name_override_hostname, + &ssl_target_name_override_ignored_port); + if (strcmp(authority_hostname, ssl_target_name_override_hostname) != 0) { gpr_log(GPR_ERROR, "Authority (host) '%s' != SSL Target override '%s'", - host, c->ssl_target_name_override); + host, ssl_target_name_override_hostname); + abort(); } - } - if (strcmp(authority_hostname, target_hostname) != 0) { - gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s'", host, c->target); + gpr_free(ssl_target_name_override_hostname); + gpr_free(ssl_target_name_override_ignored_port); + } else if (strcmp(authority_hostname, target_hostname) != 0) { + gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s'", + authority_hostname, target_hostname); abort(); } gpr_free(authority_hostname); diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 1eb5ef0c0c8..807e28eef1b 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -157,8 +157,7 @@ grpc_channel* grpc_channel_create_with_builder( } static grpc_core::UniquePtr get_default_authority( - const char* target, const grpc_channel_args* input_args, - grpc_channel_stack_type channel_stack_type) { + const grpc_channel_args* input_args) { bool has_default_authority = false; char* ssl_override = nullptr; grpc_core::UniquePtr default_authority; @@ -202,7 +201,7 @@ grpc_channel* grpc_channel_create(const char* target, grpc_transport* optional_transport) { grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create(); const grpc_core::UniquePtr default_authority = - get_default_authority(target, input_args, channel_stack_type); + get_default_authority(input_args); grpc_channel_args* args = build_channel_args(input_args, default_authority.get()); grpc_channel_stack_builder_set_channel_arguments(builder, args); diff --git a/test/core/end2end/fixtures/h2_fakesec.cc b/test/core/end2end/fixtures/h2_fakesec.cc index bbf65fcd245..8b326befd33 100644 --- a/test/core/end2end/fixtures/h2_fakesec.cc +++ b/test/core/end2end/fixtures/h2_fakesec.cc @@ -132,7 +132,6 @@ static void chttp2_init_server_fake_secure_fullstack( static grpc_end2end_test_config configs[] = { {"chttp2/fake_secure_fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_secure_fullstack, diff --git a/test/core/end2end/tests/default_host.cc b/test/core/end2end/tests/default_host.cc index cda716a259d..5984e522f64 100644 --- a/test/core/end2end/tests/default_host.cc +++ b/test/core/end2end/tests/default_host.cc @@ -85,7 +85,13 @@ static void end_test(grpc_end2end_test_fixture* f) { grpc_completion_queue_destroy(f->shutdown_cq); } -static void simple_request_body(grpc_end2end_test_fixture f) { +static void test_invoke_simple_request(grpc_end2end_test_config config) { + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_simple_request", nullptr, nullptr); + const bool override_host_for_call_creds_use = + (config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) != 0; + const char* expected_host = + override_host_for_call_creds_use ? "foo.test.google.fr" : "localhost"; grpc_call* c; grpc_call* s; cq_verifier* cqv = cq_verifier_create(f.cq); @@ -191,9 +197,12 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - char* target = grpc_channel_get_target(f.client); - GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, target, 9)); - gpr_free(target); + if (override_host_for_call_creds_use) { + validate_host_override_string("foo.test.google.fr", call_details.host, + config); + } + GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, expected_host, + strlen(expected_host))); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); @@ -206,21 +215,12 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_call_unref(s); cq_verifier_destroy(cqv); -} -static void test_invoke_simple_request(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f; - - f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); - simple_request_body(f); end_test(&f); config.tear_down_data(&f); } void default_host(grpc_end2end_test_config config) { - if ((config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) != 0) { - return; - } test_invoke_simple_request(config); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 5efea4a58dc..60238e930d7 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -290,7 +290,7 @@ class End2endTest : public ::testing::TestWithParam { args.SetUserAgentPrefix(user_agent_prefix_); } args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test"); - args.SetString(GRPC_ARG_DEFAULT_AUTHORITY, "test-authority"); + if (!GetParam().inproc) { channel_ = CreateCustomChannel(server_address_.str(), channel_creds, args); diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index dd916da5c4e..a53de691bcd 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -86,7 +86,6 @@ class ShutdownTest : public ::testing::TestWithParam { ChannelArguments args; auto channel_creds = GetCredentialsProvider()->GetChannelCredentials(GetParam(), &args); - args.SetString(GRPC_ARG_DEFAULT_AUTHORITY, "test-authority"); channel_ = CreateCustomChannel(target, channel_creds, args); stub_ = grpc::testing::EchoTestService::NewStub(channel_); } From fa460dcf1d6d2c711be7a88caa93a06310efc4a6 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 23 Mar 2018 14:51:41 -0700 Subject: [PATCH 14/25] Factor out grpc_add_default_authority_if_not_present --- BUILD | 6 ++- CMakeLists.txt | 6 +++ Makefile | 6 +++ build.yaml | 2 + config.m4 | 1 + config.w32 | 1 + gRPC-C++.podspec | 1 + gRPC-Core.podspec | 6 +++ grpc.gemspec | 2 + grpc.gyp | 4 ++ package.xml | 2 + .../ext/filters/client_channel/authority.cc | 42 +++++++++++++++++++ .../ext/filters/client_channel/authority.h | 36 ++++++++++++++++ .../chttp2/client/insecure/channel_create.cc | 24 +---------- src/python/grpcio/grpc_core_dependencies.py | 1 + tools/doxygen/Doxyfile.core.internal | 2 + .../generated/sources_and_headers.json | 3 ++ 17 files changed, 121 insertions(+), 24 deletions(-) create mode 100644 src/core/ext/filters/client_channel/authority.cc create mode 100644 src/core/ext/filters/client_channel/authority.h diff --git a/BUILD b/BUILD index a5118960381..b56e6e47191 100644 --- a/BUILD +++ b/BUILD @@ -682,11 +682,11 @@ grpc_cc_library( "src/core/lib/channel/channel_stack_builder.cc", "src/core/lib/channel/channel_trace.cc", "src/core/lib/channel/channel_trace_registry.cc", - "src/core/lib/channel/status_util.cc", "src/core/lib/channel/connected_channel.cc", "src/core/lib/channel/handshaker.cc", "src/core/lib/channel/handshaker_factory.cc", "src/core/lib/channel/handshaker_registry.cc", + "src/core/lib/channel/status_util.cc", "src/core/lib/compression/compression.cc", "src/core/lib/compression/compression_internal.cc", "src/core/lib/compression/message_compress.cc", @@ -829,12 +829,12 @@ grpc_cc_library( "src/core/lib/channel/channel_stack_builder.h", "src/core/lib/channel/channel_trace.h", "src/core/lib/channel/channel_trace_registry.h", - "src/core/lib/channel/status_util.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/handshaker.h", "src/core/lib/channel/handshaker_factory.h", "src/core/lib/channel/handshaker_registry.h", + "src/core/lib/channel/status_util.h", "src/core/lib/compression/algorithm_metadata.h", "src/core/lib/compression/compression_internal.h", "src/core/lib/compression/message_compress.h", @@ -1009,6 +1009,7 @@ grpc_cc_library( grpc_cc_library( name = "grpc_client_channel", srcs = [ + "src/core/ext/filters/client_channel/authority.cc", "src/core/ext/filters/client_channel/backup_poller.cc", "src/core/ext/filters/client_channel/channel_connectivity.cc", "src/core/ext/filters/client_channel/client_channel.cc", @@ -1032,6 +1033,7 @@ grpc_cc_library( "src/core/ext/filters/client_channel/uri_parser.cc", ], hdrs = [ + "src/core/ext/filters/client_channel/authority.h", "src/core/ext/filters/client_channel/backup_poller.h", "src/core/ext/filters/client_channel/client_channel.h", "src/core/ext/filters/client_channel/client_channel_factory.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d4467beeae..977cb64a147 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1093,6 +1093,7 @@ add_library(grpc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc + src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -1427,6 +1428,7 @@ add_library(grpc_cronet src/core/ext/filters/http/http_filters_plugin.cc src/core/ext/filters/http/message_compress/message_compress_filter.cc src/core/ext/filters/http/server/http_server_filter.cc + src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -1788,6 +1790,7 @@ add_library(grpc_test_util src/core/lib/transport/transport.cc src/core/lib/transport/transport_op_string.cc src/core/lib/debug/trace.cc + src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -2090,6 +2093,7 @@ add_library(grpc_test_util_unsecure src/core/lib/transport/transport.cc src/core/lib/transport/transport_op_string.cc src/core/lib/debug/trace.cc + src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -2405,6 +2409,7 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc + src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -3194,6 +3199,7 @@ add_library(grpc++_cronet src/core/ext/filters/http/http_filters_plugin.cc src/core/ext/filters/http/message_compress/message_compress_filter.cc src/core/ext/filters/http/server/http_server_filter.cc + src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc diff --git a/Makefile b/Makefile index 20992b6a651..e62c94b6517 100644 --- a/Makefile +++ b/Makefile @@ -3419,6 +3419,7 @@ LIBGRPC_SRC = \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ + src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -3755,6 +3756,7 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/http/http_filters_plugin.cc \ src/core/ext/filters/http/message_compress/message_compress_filter.cc \ src/core/ext/filters/http/server/http_server_filter.cc \ + src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4117,6 +4119,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/transport/transport.cc \ src/core/lib/transport/transport_op_string.cc \ src/core/lib/debug/trace.cc \ + src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4412,6 +4415,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/lib/transport/transport.cc \ src/core/lib/transport/transport_op_string.cc \ src/core/lib/debug/trace.cc \ + src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4707,6 +4711,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ + src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -5495,6 +5500,7 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/filters/http/http_filters_plugin.cc \ src/core/ext/filters/http/message_compress/message_compress_filter.cc \ src/core/ext/filters/http/server/http_server_filter.cc \ + src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ diff --git a/build.yaml b/build.yaml index b24eb854ae4..46785a1a3f6 100644 --- a/build.yaml +++ b/build.yaml @@ -544,6 +544,7 @@ filegroups: - grpc_base - name: grpc_client_channel headers: + - src/core/ext/filters/client_channel/authority.h - src/core/ext/filters/client_channel/backup_poller.h - src/core/ext/filters/client_channel/client_channel.h - src/core/ext/filters/client_channel/client_channel_factory.h @@ -565,6 +566,7 @@ filegroups: - src/core/ext/filters/client_channel/subchannel_index.h - src/core/ext/filters/client_channel/uri_parser.h src: + - src/core/ext/filters/client_channel/authority.cc - src/core/ext/filters/client_channel/backup_poller.cc - src/core/ext/filters/client_channel/channel_connectivity.cc - src/core/ext/filters/client_channel/client_channel.cc diff --git a/config.m4 b/config.m4 index a402e0f7679..630fda6d689 100644 --- a/config.m4 +++ b/config.m4 @@ -321,6 +321,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ + src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ diff --git a/config.w32 b/config.w32 index ba908b5e469..3623f2070e4 100644 --- a/config.w32 +++ b/config.w32 @@ -298,6 +298,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create.cc " + "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " + "src\\core\\ext\\transport\\chttp2\\client\\chttp2_connector.cc " + + "src\\core\\ext\\filters\\client_channel\\authority.cc " + "src\\core\\ext\\filters\\client_channel\\backup_poller.cc " + "src\\core\\ext\\filters\\client_channel\\channel_connectivity.cc " + "src\\core\\ext\\filters\\client_channel\\client_channel.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 25013771274..403674d1ee7 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -309,6 +309,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', + 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 137903249b1..f9f9b772612 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -319,6 +319,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', + 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', @@ -738,6 +739,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -897,6 +899,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', + 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', @@ -1380,6 +1383,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/http/client/http_client_filter.h', 'src/core/ext/filters/http/message_compress/message_compress_filter.h', 'src/core/ext/filters/http/server/http_server_filter.h', + 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', @@ -1646,6 +1650,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/http/http_filters_plugin.cc', 'src/core/ext/filters/http/message_compress/message_compress_filter.cc', 'src/core/ext/filters/http/server/http_server_filter.cc', + 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -1930,6 +1935,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/http/client/http_client_filter.h', 'src/core/ext/filters/http/message_compress/message_compress_filter.h', 'src/core/ext/filters/http/server/http_server_filter.h', + 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', diff --git a/grpc.gemspec b/grpc.gemspec index 1c0cfe35c55..dfb0fbb0ad8 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -250,6 +250,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/tsi/transport_security_adapter.h ) s.files += %w( src/core/tsi/transport_security_interface.h ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h ) + s.files += %w( src/core/ext/filters/client_channel/authority.h ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.h ) s.files += %w( src/core/ext/filters/client_channel/client_channel.h ) s.files += %w( src/core/ext/filters/client_channel/client_channel_factory.h ) @@ -672,6 +673,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.cc ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.cc ) + s.files += %w( src/core/ext/filters/client_channel/authority.cc ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.cc ) s.files += %w( src/core/ext/filters/client_channel/channel_connectivity.cc ) s.files += %w( src/core/ext/filters/client_channel/client_channel.cc ) diff --git a/grpc.gyp b/grpc.gyp index 424641641ea..7235e338492 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -474,6 +474,7 @@ 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -730,6 +731,7 @@ 'src/core/lib/transport/transport.cc', 'src/core/lib/transport/transport_op_string.cc', 'src/core/lib/debug/trace.cc', + 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -960,6 +962,7 @@ 'src/core/lib/transport/transport.cc', 'src/core/lib/transport/transport_op_string.cc', 'src/core/lib/debug/trace.cc', + 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -1202,6 +1205,7 @@ 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', diff --git a/package.xml b/package.xml index a8e4667c861..5bb146db8a6 100644 --- a/package.xml +++ b/package.xml @@ -257,6 +257,7 @@ + @@ -679,6 +680,7 @@ + diff --git a/src/core/ext/filters/client_channel/authority.cc b/src/core/ext/filters/client_channel/authority.cc new file mode 100644 index 00000000000..46a9f39aedd --- /dev/null +++ b/src/core/ext/filters/client_channel/authority.cc @@ -0,0 +1,42 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * 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 "src/core/ext/filters/client_channel/authority.h" + +grpc_channel_args* grpc_add_default_authority_if_not_present( + const grpc_channel_args* args) { + const bool has_default_authority = + grpc_channel_args_find(args, GRPC_ARG_DEFAULT_AUTHORITY) != nullptr; + grpc_arg new_args[1]; + size_t num_new_args = 0; + grpc_core::UniquePtr default_authority; + if (!has_default_authority) { + const grpc_arg* server_uri_arg = + grpc_channel_args_find(args, GRPC_ARG_SERVER_URI); + const char* server_uri_str = grpc_channel_arg_get_string(server_uri_arg); + GPR_ASSERT(server_uri_str != nullptr); + default_authority = + grpc_core::ResolverRegistry::GetDefaultAuthority(server_uri_str); + GPR_ASSERT(default_authority != nullptr); + new_args[num_new_args++] = grpc_channel_arg_string_create( + const_cast(GRPC_ARG_DEFAULT_AUTHORITY), default_authority.get()); + } + return grpc_channel_args_copy_and_add(args, new_args, num_new_args); +} diff --git a/src/core/ext/filters/client_channel/authority.h b/src/core/ext/filters/client_channel/authority.h new file mode 100644 index 00000000000..0923e9d56c6 --- /dev/null +++ b/src/core/ext/filters/client_channel/authority.h @@ -0,0 +1,36 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * 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. + * + */ + +#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H +#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H + +#include + +#include + +#include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/client_channel/resolver_registry.h" +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/memory.h" + +/// Returns a copy of \a args with the default authority channel arg set if it +/// wasn't already present. +grpc_channel_args* grpc_add_default_authority_if_not_present( + const grpc_channel_args* args); + +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H */ diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index 9fb87c2164f..5b08b6cd36e 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -25,6 +25,7 @@ #include #include +#include "src/core/ext/filters/client_channel/authority.h" #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/client_channel/resolver_registry.h" #include "src/core/ext/transport/chttp2/client/chttp2_connector.h" @@ -38,33 +39,12 @@ static void client_channel_factory_ref( static void client_channel_factory_unref( grpc_client_channel_factory* cc_factory) {} -static grpc_channel_args* add_default_authority_if_not_present( - const grpc_channel_args* args) { - const bool has_default_authority = - grpc_channel_args_find(args, GRPC_ARG_DEFAULT_AUTHORITY) != nullptr; - grpc_arg new_args[1]; - size_t num_new_args = 0; - grpc_core::UniquePtr default_authority; - if (!has_default_authority) { - const grpc_arg* server_uri_arg = - grpc_channel_args_find(args, GRPC_ARG_SERVER_URI); - const char* server_uri_str = grpc_channel_arg_get_string(server_uri_arg); - GPR_ASSERT(server_uri_str != nullptr); - default_authority = - grpc_core::ResolverRegistry::GetDefaultAuthority(server_uri_str); - GPR_ASSERT(default_authority != nullptr); - new_args[num_new_args++] = grpc_channel_arg_string_create( - const_cast(GRPC_ARG_DEFAULT_AUTHORITY), default_authority.get()); - } - return grpc_channel_args_copy_and_add(args, new_args, num_new_args); -} - static grpc_subchannel* client_channel_factory_create_subchannel( grpc_client_channel_factory* cc_factory, const grpc_subchannel_args* args) { grpc_subchannel_args* final_sc_args = static_cast(gpr_malloc(sizeof(*final_sc_args))); memcpy(final_sc_args, args, sizeof(*args)); - final_sc_args->args = add_default_authority_if_not_present(args->args); + final_sc_args->args = grpc_add_default_authority_if_not_present(args->args); grpc_connector* connector = grpc_chttp2_connector_create(); grpc_subchannel* s = grpc_subchannel_create(connector, final_sc_args); grpc_connector_unref(connector); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index b3b114ef7c0..2ec9e07e953 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -297,6 +297,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', + 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 859efd29d1b..92b97c4c823 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -866,6 +866,8 @@ src/core/README.md \ src/core/ext/README.md \ src/core/ext/census/grpc_context.cc \ src/core/ext/filters/client_channel/README.md \ +src/core/ext/filters/client_channel/authority.cc \ +src/core/ext/filters/client_channel/authority.h \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/backup_poller.h \ src/core/ext/filters/client_channel/channel_connectivity.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 965487fbd6b..b46a2b7f9a6 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -9501,6 +9501,7 @@ "grpc_deadline_filter" ], "headers": [ + "src/core/ext/filters/client_channel/authority.h", "src/core/ext/filters/client_channel/backup_poller.h", "src/core/ext/filters/client_channel/client_channel.h", "src/core/ext/filters/client_channel/client_channel_factory.h", @@ -9526,6 +9527,8 @@ "language": "c", "name": "grpc_client_channel", "src": [ + "src/core/ext/filters/client_channel/authority.cc", + "src/core/ext/filters/client_channel/authority.h", "src/core/ext/filters/client_channel/backup_poller.cc", "src/core/ext/filters/client_channel/backup_poller.h", "src/core/ext/filters/client_channel/channel_connectivity.cc", From 02879244669f40bef06b38e4b6ad8a320529c924 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 23 Mar 2018 18:14:12 -0700 Subject: [PATCH 15/25] Added host override info to test fixture config --- .../CoreCronetEnd2EndTests.mm | 9 +++------ test/core/end2end/end2end_tests.h | 5 +++++ test/core/end2end/fixtures/h2_census.cc | 2 +- test/core/end2end/fixtures/h2_compress.cc | 2 +- test/core/end2end/fixtures/h2_fakesec.cc | 2 +- test/core/end2end/fixtures/h2_fd.cc | 2 +- test/core/end2end/fixtures/h2_full+pipe.cc | 2 +- test/core/end2end/fixtures/h2_full+trace.cc | 2 +- test/core/end2end/fixtures/h2_full+workarounds.cc | 2 +- test/core/end2end/fixtures/h2_full.cc | 2 +- test/core/end2end/fixtures/h2_http_proxy.cc | 2 +- test/core/end2end/fixtures/h2_load_reporting.cc | 5 +++-- test/core/end2end/fixtures/h2_oauth2.cc | 2 +- test/core/end2end/fixtures/h2_proxy.cc | 2 +- test/core/end2end/fixtures/h2_sockpair+trace.cc | 2 +- test/core/end2end/fixtures/h2_sockpair.cc | 2 +- test/core/end2end/fixtures/h2_sockpair_1byte.cc | 6 +++--- test/core/end2end/fixtures/h2_ssl.cc | 2 +- test/core/end2end/fixtures/h2_ssl_proxy.cc | 2 +- test/core/end2end/fixtures/h2_uds.cc | 2 +- test/core/end2end/fixtures/inproc.cc | 5 +++-- test/core/end2end/h2_ssl_cert_test.cc | 1 + test/core/end2end/tests/default_host.cc | 15 ++++++--------- 23 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm index 33ccdb58446..8e1a0ee7df9 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm @@ -147,12 +147,9 @@ static void chttp2_init_server_simple_ssl_secure_fullstack( static grpc_end2end_test_config configs[] = { {"chttp2/simple_ssl_fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, - chttp2_create_fixture_secure_fullstack, - cronet_init_client_simple_ssl_secure_fullstack, - chttp2_init_server_simple_ssl_secure_fullstack, - chttp2_tear_down_secure_fullstack}, + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, nullptr, + chttp2_create_fixture_secure_fullstack, cronet_init_client_simple_ssl_secure_fullstack, + chttp2_init_server_simple_ssl_secure_fullstack, chttp2_tear_down_secure_fullstack}, }; static char *roots_filename; diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index b42d90b55cf..a1ebdedea83 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -52,6 +52,11 @@ struct grpc_end2end_test_config { /* Which features are supported by this fixture. See feature flags above. */ uint32_t feature_mask; + /* If the call host is setup by the fixture (for example, via the + * GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg), which value should the test + * expect to find in call_details.host */ + const char* overridden_call_host; + grpc_end2end_test_fixture (*create_fixture)(grpc_channel_args* client_args, grpc_channel_args* server_args); void (*init_client)(grpc_end2end_test_fixture* f, diff --git a/test/core/end2end/fixtures/h2_census.cc b/test/core/end2end/fixtures/h2_census.cc index b3b4171a727..29b1d6d8839 100644 --- a/test/core/end2end/fixtures/h2_census.cc +++ b/test/core/end2end/fixtures/h2_census.cc @@ -111,7 +111,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, + nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_compress.cc b/test/core/end2end/fixtures/h2_compress.cc index 565c96cf93f..4aaadf715c0 100644 --- a/test/core/end2end/fixtures/h2_compress.cc +++ b/test/core/end2end/fixtures/h2_compress.cc @@ -109,7 +109,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_fullstack_compression, + nullptr, chttp2_create_fixture_fullstack_compression, chttp2_init_client_fullstack_compression, chttp2_init_server_fullstack_compression, chttp2_tear_down_fullstack_compression}, diff --git a/test/core/end2end/fixtures/h2_fakesec.cc b/test/core/end2end/fixtures/h2_fakesec.cc index 8b326befd33..a653d7c477f 100644 --- a/test/core/end2end/fixtures/h2_fakesec.cc +++ b/test/core/end2end/fixtures/h2_fakesec.cc @@ -134,7 +134,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_secure_fullstack, + nullptr, chttp2_create_fixture_secure_fullstack, chttp2_init_client_fake_secure_fullstack, chttp2_init_server_fake_secure_fullstack, chttp2_tear_down_secure_fullstack}, diff --git a/test/core/end2end/fixtures/h2_fd.cc b/test/core/end2end/fixtures/h2_fd.cc index 9157ab04d0d..52be0f7fd51 100644 --- a/test/core/end2end/fixtures/h2_fd.cc +++ b/test/core/end2end/fixtures/h2_fd.cc @@ -96,7 +96,7 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fd", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fd", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr, chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/fixtures/h2_full+pipe.cc b/test/core/end2end/fixtures/h2_full+pipe.cc index ed173c1afb3..c5329640dcd 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.cc +++ b/test/core/end2end/fixtures/h2_full+pipe.cc @@ -96,7 +96,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, + nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+trace.cc b/test/core/end2end/fixtures/h2_full+trace.cc index afb86ea8999..ba7a7803049 100644 --- a/test/core/end2end/fixtures/h2_full+trace.cc +++ b/test/core/end2end/fixtures/h2_full+trace.cc @@ -96,7 +96,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, + nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc index bd9ddff5b59..78da8418f6c 100644 --- a/test/core/end2end/fixtures/h2_full+workarounds.cc +++ b/test/core/end2end/fixtures/h2_full+workarounds.cc @@ -107,7 +107,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER | FEATURE_MASK_SUPPORTS_WORKAROUNDS, - chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, + nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.cc b/test/core/end2end/fixtures/h2_full.cc index ca61ec8effe..0c826b68368 100644 --- a/test/core/end2end/fixtures/h2_full.cc +++ b/test/core/end2end/fixtures/h2_full.cc @@ -90,7 +90,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, + nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_http_proxy.cc b/test/core/end2end/fixtures/h2_http_proxy.cc index 90d0627860c..0af8a29a152 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.cc +++ b/test/core/end2end/fixtures/h2_http_proxy.cc @@ -113,7 +113,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, + nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_load_reporting.cc b/test/core/end2end/fixtures/h2_load_reporting.cc index ec9eedbd346..18ea10a8d21 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.cc +++ b/test/core/end2end/fixtures/h2_load_reporting.cc @@ -98,8 +98,9 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_load_reporting, chttp2_init_client_load_reporting, - chttp2_init_server_load_reporting, chttp2_tear_down_load_reporting}, + nullptr, chttp2_create_fixture_load_reporting, + chttp2_init_client_load_reporting, chttp2_init_server_load_reporting, + chttp2_tear_down_load_reporting}, }; int main(int argc, char** argv) { diff --git a/test/core/end2end/fixtures/h2_oauth2.cc b/test/core/end2end/fixtures/h2_oauth2.cc index 9453f2f7cb6..d44aafd50ab 100644 --- a/test/core/end2end/fixtures/h2_oauth2.cc +++ b/test/core/end2end/fixtures/h2_oauth2.cc @@ -216,7 +216,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_secure_fullstack, + "foo.test.google.fr", chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, chttp2_tear_down_secure_fullstack}, diff --git a/test/core/end2end/fixtures/h2_proxy.cc b/test/core/end2end/fixtures/h2_proxy.cc index c97188fbb29..a32000061a3 100644 --- a/test/core/end2end/fixtures/h2_proxy.cc +++ b/test/core/end2end/fixtures/h2_proxy.cc @@ -117,7 +117,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, + nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.cc b/test/core/end2end/fixtures/h2_sockpair+trace.cc index 701113461f7..cdefcf4546f 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.cc +++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc @@ -123,7 +123,7 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr, chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair.cc b/test/core/end2end/fixtures/h2_sockpair.cc index 24a1d6dd32a..8966cb38d4a 100644 --- a/test/core/end2end/fixtures/h2_sockpair.cc +++ b/test/core/end2end/fixtures/h2_sockpair.cc @@ -118,7 +118,7 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/socketpair", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr, chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.cc b/test/core/end2end/fixtures/h2_sockpair_1byte.cc index d812c226e99..ebf41622178 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.cc +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc @@ -130,9 +130,9 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture* f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { {"chttp2/socketpair_one_byte_at_a_time", - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_socketpair, - chttp2_init_client_socketpair, chttp2_init_server_socketpair, - chttp2_tear_down_socketpair}, + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr, + chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, + chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; int main(int argc, char** argv) { diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc index bbcc88e4f33..0da5b03dfe0 100644 --- a/test/core/end2end/fixtures/h2_ssl.cc +++ b/test/core/end2end/fixtures/h2_ssl.cc @@ -149,7 +149,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_secure_fullstack, + "foo.test.google.fr", chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, chttp2_tear_down_secure_fullstack}, diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc index 6b0b891b185..9ab50c62171 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.cc +++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc @@ -187,7 +187,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_secure_fullstack, + "foo.test.google.fr", chttp2_create_fixture_secure_fullstack, chttp2_init_client_simple_ssl_secure_fullstack, chttp2_init_server_simple_ssl_secure_fullstack, chttp2_tear_down_secure_fullstack}, diff --git a/test/core/end2end/fixtures/h2_uds.cc b/test/core/end2end/fixtures/h2_uds.cc index 1b081f9ea31..2c81c3d3622 100644 --- a/test/core/end2end/fixtures/h2_uds.cc +++ b/test/core/end2end/fixtures/h2_uds.cc @@ -95,7 +95,7 @@ static grpc_end2end_test_config configs[] = { FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, - chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, + nullptr, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/inproc.cc b/test/core/end2end/fixtures/inproc.cc index d47de42540b..be6eda84836 100644 --- a/test/core/end2end/fixtures/inproc.cc +++ b/test/core/end2end/fixtures/inproc.cc @@ -75,8 +75,9 @@ void inproc_tear_down(grpc_end2end_test_fixture* f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"inproc", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, inproc_create_fixture, - inproc_init_client, inproc_init_server, inproc_tear_down}, + {"inproc", FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, nullptr, + inproc_create_fixture, inproc_init_client, inproc_init_server, + inproc_tear_down}, }; int main(int argc, char** argv) { diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc index 9e2082ce9d8..b93420ce3b7 100644 --- a/test/core/end2end/h2_ssl_cert_test.cc +++ b/test/core/end2end/h2_ssl_cert_test.cc @@ -202,6 +202,7 @@ typedef enum { SUCCESS, FAIL } test_result; FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ + "foo.test.google.fr", \ chttp2_create_fixture_secure_fullstack, \ CLIENT_INIT_NAME(cert_type), \ SERVER_INIT_NAME(request_type), \ diff --git a/test/core/end2end/tests/default_host.cc b/test/core/end2end/tests/default_host.cc index 5984e522f64..9da8df7d9b8 100644 --- a/test/core/end2end/tests/default_host.cc +++ b/test/core/end2end/tests/default_host.cc @@ -88,10 +88,6 @@ static void end_test(grpc_end2end_test_fixture* f) { static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); - const bool override_host_for_call_creds_use = - (config.feature_mask & FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS) != 0; - const char* expected_host = - override_host_for_call_creds_use ? "foo.test.google.fr" : "localhost"; grpc_call* c; grpc_call* s; cq_verifier* cqv = cq_verifier_create(f.cq); @@ -197,12 +193,13 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - if (override_host_for_call_creds_use) { - validate_host_override_string("foo.test.google.fr", call_details.host, - config); + + if (config.overridden_call_host != nullptr) { + validate_host_override_string(config.overridden_call_host, + call_details.host, config); + } else { + GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, "localhost", 9)); } - GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, expected_host, - strlen(expected_host))); GPR_ASSERT(was_cancelled == 1); grpc_slice_unref(details); From 27d48dad5ed26ed0ee75bfce8b3fa234300f1ec2 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 23 Mar 2018 22:42:26 -0700 Subject: [PATCH 16/25] fixed bad_ping test after merge --- test/core/end2end/tests/bad_ping.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/core/end2end/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc index b80b228136a..22481d1be75 100644 --- a/test/core/end2end/tests/bad_ping.cc +++ b/test/core/end2end/tests/bad_ping.cc @@ -267,11 +267,9 @@ static void test_pings_without_data(grpc_end2end_test_config config) { grpc_slice details; int was_cancelled = 2; - c = grpc_channel_create_call( - f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr:1234", config), deadline, - nullptr); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -364,8 +362,6 @@ static void test_pings_without_data(grpc_end2end_test_config config) { // The rpc should be successful. GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - validate_host_override_string("foo.test.google.fr:1234", call_details.host, - config); grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); From 8a6453d31b5d56e897ebfbac9b7c2f15299b1af1 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Sun, 25 Mar 2018 12:54:47 -0700 Subject: [PATCH 17/25] localhost or 127.0.0.1 --- test/core/end2end/tests/default_host.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/core/end2end/tests/default_host.cc b/test/core/end2end/tests/default_host.cc index 9da8df7d9b8..22c3102d1a2 100644 --- a/test/core/end2end/tests/default_host.cc +++ b/test/core/end2end/tests/default_host.cc @@ -198,7 +198,8 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { validate_host_override_string(config.overridden_call_host, call_details.host, config); } else { - GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, "localhost", 9)); + GPR_ASSERT(grpc_slice_buf_start_eq(call_details.host, "localhost", 9) || + grpc_slice_buf_start_eq(call_details.host, "127.0.0.1", 9)); } GPR_ASSERT(was_cancelled == 1); From 861363d618a279fa3de9ea8cf0702276b4f8bd83 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 26 Mar 2018 15:57:33 -0700 Subject: [PATCH 18/25] added call_host_override test --- CMakeLists.txt | 2 + Makefile | 2 + gRPC-Core.podspec | 1 + grpc.gyp | 2 + include/grpc/impl/codegen/grpc_types.h | 10 + .../security_connector/security_connector.cc | 38 +- test/core/end2end/end2end_nosec_tests.cc | 8 + test/core/end2end/end2end_tests.cc | 8 + test/core/end2end/fixtures/h2_ssl.cc | 5 +- test/core/end2end/gen_build_yaml.py | 2 + test/core/end2end/tests/call_host_override.cc | 230 ++++++++ .../generated/sources_and_headers.json | 2 + tools/run_tests/generated/tests.json | 503 ++++++++++++++++++ 13 files changed, 791 insertions(+), 22 deletions(-) create mode 100644 test/core/end2end/tests/call_host_override.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 977cb64a147..92bc643cb4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5119,6 +5119,7 @@ add_library(end2end_tests test/core/end2end/tests/bad_ping.cc test/core/end2end/tests/binary_metadata.cc test/core/end2end/tests/call_creds.cc + test/core/end2end/tests/call_host_override.cc test/core/end2end/tests/cancel_after_accept.cc test/core/end2end/tests/cancel_after_client_done.cc test/core/end2end/tests/cancel_after_invoke.cc @@ -5234,6 +5235,7 @@ add_library(end2end_nosec_tests test/core/end2end/tests/bad_hostname.cc test/core/end2end/tests/bad_ping.cc test/core/end2end/tests/binary_metadata.cc + test/core/end2end/tests/call_host_override.cc test/core/end2end/tests/cancel_after_accept.cc test/core/end2end/tests/cancel_after_client_done.cc test/core/end2end/tests/cancel_after_invoke.cc diff --git a/Makefile b/Makefile index e62c94b6517..49f892b6a42 100644 --- a/Makefile +++ b/Makefile @@ -9756,6 +9756,7 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/bad_ping.cc \ test/core/end2end/tests/binary_metadata.cc \ test/core/end2end/tests/call_creds.cc \ + test/core/end2end/tests/call_host_override.cc \ test/core/end2end/tests/cancel_after_accept.cc \ test/core/end2end/tests/cancel_after_client_done.cc \ test/core/end2end/tests/cancel_after_invoke.cc \ @@ -9870,6 +9871,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/bad_hostname.cc \ test/core/end2end/tests/bad_ping.cc \ test/core/end2end/tests/binary_metadata.cc \ + test/core/end2end/tests/call_host_override.cc \ test/core/end2end/tests/cancel_after_accept.cc \ test/core/end2end/tests/cancel_after_client_done.cc \ test/core/end2end/tests/cancel_after_invoke.cc \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index f9f9b772612..e7cb3954469 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -2080,6 +2080,7 @@ Pod::Spec.new do |s| 'test/core/end2end/tests/bad_ping.cc', 'test/core/end2end/tests/binary_metadata.cc', 'test/core/end2end/tests/call_creds.cc', + 'test/core/end2end/tests/call_host_override.cc', 'test/core/end2end/tests/cancel_after_accept.cc', 'test/core/end2end/tests/cancel_after_client_done.cc', 'test/core/end2end/tests/cancel_after_invoke.cc', diff --git a/grpc.gyp b/grpc.gyp index 7235e338492..9587bbfc44e 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -2568,6 +2568,7 @@ 'test/core/end2end/tests/bad_ping.cc', 'test/core/end2end/tests/binary_metadata.cc', 'test/core/end2end/tests/call_creds.cc', + 'test/core/end2end/tests/call_host_override.cc', 'test/core/end2end/tests/cancel_after_accept.cc', 'test/core/end2end/tests/cancel_after_client_done.cc', 'test/core/end2end/tests/cancel_after_invoke.cc', @@ -2656,6 +2657,7 @@ 'test/core/end2end/tests/bad_hostname.cc', 'test/core/end2end/tests/bad_ping.cc', 'test/core/end2end/tests/binary_metadata.cc', + 'test/core/end2end/tests/call_host_override.cc', 'test/core/end2end/tests/cancel_after_accept.cc', 'test/core/end2end/tests/cancel_after_client_done.cc', 'test/core/end2end/tests/cancel_after_invoke.cc', diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 03aaa9fae4d..51f641054f0 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -258,6 +258,16 @@ typedef struct { secure channel is an SSL channel). If this parameter is specified and the underlying is not an SSL channel, it will just be ignored. */ #define GRPC_SSL_TARGET_NAME_OVERRIDE_ARG "grpc.ssl_target_name_override" +/** This *should* be used for testing only. + The caller of the secure_channel_create functions may override the target + name used for fake security host name checking using this channel argument + which is of type \a GRPC_ARG_STRING. If this argument is not specified, the + name used for fake security host name checking will be the target parameter + (assuming that the secure channel is a fake security channel). If this + parameter is specified and the underlying is not a fake security channel, it + will just be ignored. */ +#define GRPC_FAKE_SECURITY_TARGET_NAME_OVERRIDE_ARG \ + "grpc.fake_security_target_name_override" /** If non-zero, a pointer to a session cache (a pointer of type grpc_ssl_session_cache*). (use grpc_ssl_session_cache_arg_vtable() to fetch an appropriate pointer arg vtable) */ diff --git a/src/core/lib/security/security_connector/security_connector.cc b/src/core/lib/security/security_connector/security_connector.cc index a0e05a3fbd6..0066d3f09f2 100644 --- a/src/core/lib/security/security_connector/security_connector.cc +++ b/src/core/lib/security/security_connector/security_connector.cc @@ -306,7 +306,7 @@ typedef struct { char* target; char* expected_targets; bool is_lb_channel; - char* ssl_target_name_override; + char* target_name_override; } grpc_fake_channel_security_connector; static void fake_channel_destroy(grpc_security_connector* sc) { @@ -315,7 +315,7 @@ static void fake_channel_destroy(grpc_security_connector* sc) { grpc_call_credentials_unref(c->base.request_metadata_creds); gpr_free(c->target); gpr_free(c->expected_targets); - gpr_free(c->ssl_target_name_override); + gpr_free(c->target_name_override); gpr_free(c); } @@ -473,19 +473,21 @@ static bool fake_channel_check_call_host(grpc_channel_security_connector* sc, char* target_ignored_port = nullptr; gpr_split_host_port(host, &authority_hostname, &authority_ignored_port); gpr_split_host_port(c->target, &target_hostname, &target_ignored_port); - if (c->ssl_target_name_override != nullptr) { - char* ssl_target_name_override_hostname = nullptr; - char* ssl_target_name_override_ignored_port = nullptr; - gpr_split_host_port(c->ssl_target_name_override, - &ssl_target_name_override_hostname, - &ssl_target_name_override_ignored_port); - if (strcmp(authority_hostname, ssl_target_name_override_hostname) != 0) { - gpr_log(GPR_ERROR, "Authority (host) '%s' != SSL Target override '%s'", - host, ssl_target_name_override_hostname); + if (c->target_name_override != nullptr) { + char* fake_security_target_name_override_hostname = nullptr; + char* fake_security_target_name_override_ignored_port = nullptr; + gpr_split_host_port(c->target_name_override, + &fake_security_target_name_override_hostname, + &fake_security_target_name_override_ignored_port); + if (strcmp(authority_hostname, + fake_security_target_name_override_hostname) != 0) { + gpr_log(GPR_ERROR, + "Authority (host) '%s' != Fake Security Target override '%s'", + host, fake_security_target_name_override_hostname); abort(); } - gpr_free(ssl_target_name_override_hostname); - gpr_free(ssl_target_name_override_ignored_port); + gpr_free(fake_security_target_name_override_hostname); + gpr_free(fake_security_target_name_override_ignored_port); } else if (strcmp(authority_hostname, target_hostname) != 0) { gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s'", authority_hostname, target_hostname); @@ -547,11 +549,11 @@ grpc_channel_security_connector* grpc_fake_channel_security_connector_create( const char* expected_targets = grpc_fake_transport_get_expected_targets(args); c->expected_targets = gpr_strdup(expected_targets); c->is_lb_channel = grpc_core::FindTargetAuthorityTableInArgs(args) != nullptr; - const grpc_arg* ssl_target_name_override_arg = - grpc_channel_args_find(args, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); - if (ssl_target_name_override_arg != nullptr) { - c->ssl_target_name_override = - grpc_channel_arg_get_string(ssl_target_name_override_arg); + const grpc_arg* target_name_override_arg = + grpc_channel_args_find(args, GRPC_FAKE_SECURITY_TARGET_NAME_OVERRIDE_ARG); + if (target_name_override_arg != nullptr) { + c->target_name_override = + gpr_strdup(grpc_channel_arg_get_string(target_name_override_arg)); } return &c->base; } diff --git a/test/core/end2end/end2end_nosec_tests.cc b/test/core/end2end/end2end_nosec_tests.cc index 78ddcdb8f6e..297408cd92b 100644 --- a/test/core/end2end/end2end_nosec_tests.cc +++ b/test/core/end2end/end2end_nosec_tests.cc @@ -38,6 +38,8 @@ extern void bad_ping(grpc_end2end_test_config config); extern void bad_ping_pre_init(void); extern void binary_metadata(grpc_end2end_test_config config); extern void binary_metadata_pre_init(void); +extern void call_host_override(grpc_end2end_test_config config); +extern void call_host_override_pre_init(void); extern void cancel_after_accept(grpc_end2end_test_config config); extern void cancel_after_accept_pre_init(void); extern void cancel_after_client_done(grpc_end2end_test_config config); @@ -187,6 +189,7 @@ void grpc_end2end_tests_pre_init(void) { bad_hostname_pre_init(); bad_ping_pre_init(); binary_metadata_pre_init(); + call_host_override_pre_init(); cancel_after_accept_pre_init(); cancel_after_client_done_pre_init(); cancel_after_invoke_pre_init(); @@ -270,6 +273,7 @@ void grpc_end2end_tests(int argc, char **argv, bad_hostname(config); bad_ping(config); binary_metadata(config); + call_host_override(config); cancel_after_accept(config); cancel_after_client_done(config); cancel_after_invoke(config); @@ -360,6 +364,10 @@ void grpc_end2end_tests(int argc, char **argv, binary_metadata(config); continue; } + if (0 == strcmp("call_host_override", argv[i])) { + call_host_override(config); + continue; + } if (0 == strcmp("cancel_after_accept", argv[i])) { cancel_after_accept(config); continue; diff --git a/test/core/end2end/end2end_tests.cc b/test/core/end2end/end2end_tests.cc index fb1e61b39f8..9b3f6552545 100644 --- a/test/core/end2end/end2end_tests.cc +++ b/test/core/end2end/end2end_tests.cc @@ -40,6 +40,8 @@ extern void binary_metadata(grpc_end2end_test_config config); extern void binary_metadata_pre_init(void); extern void call_creds(grpc_end2end_test_config config); extern void call_creds_pre_init(void); +extern void call_host_override(grpc_end2end_test_config config); +extern void call_host_override_pre_init(void); extern void cancel_after_accept(grpc_end2end_test_config config); extern void cancel_after_accept_pre_init(void); extern void cancel_after_client_done(grpc_end2end_test_config config); @@ -190,6 +192,7 @@ void grpc_end2end_tests_pre_init(void) { bad_ping_pre_init(); binary_metadata_pre_init(); call_creds_pre_init(); + call_host_override_pre_init(); cancel_after_accept_pre_init(); cancel_after_client_done_pre_init(); cancel_after_invoke_pre_init(); @@ -274,6 +277,7 @@ void grpc_end2end_tests(int argc, char **argv, bad_ping(config); binary_metadata(config); call_creds(config); + call_host_override(config); cancel_after_accept(config); cancel_after_client_done(config); cancel_after_invoke(config); @@ -368,6 +372,10 @@ void grpc_end2end_tests(int argc, char **argv, call_creds(config); continue; } + if (0 == strcmp("call_host_override", argv[i])) { + call_host_override(config); + continue; + } if (0 == strcmp("cancel_after_accept", argv[i])) { cancel_after_accept(config); continue; diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc index 0da5b03dfe0..999cd4cdfb9 100644 --- a/test/core/end2end/fixtures/h2_ssl.cc +++ b/test/core/end2end/fixtures/h2_ssl.cc @@ -109,10 +109,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack( grpc_channel_args* new_client_args = grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds); - { - grpc_core::ExecCtx exec_ctx; - grpc_channel_args_destroy(new_client_args); - } + grpc_channel_args_destroy(new_client_args); } static int fail_server_auth_check(grpc_channel_args* server_args) { diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index 4e20b0b3341..c7b03625748 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -108,6 +108,8 @@ END2END_TESTS = { proxyable=False, cpu_cost=LOWCPU, exclude_iomgrs=['uv']), 'default_host': default_test_options._replace( needs_fullstack=True, needs_dns=True, needs_names=True), + 'call_host_override': default_test_options._replace( + needs_fullstack=True, needs_dns=True, needs_names=True), 'disappearing_server': connectivity_test_options._replace(flaky=True, needs_names=True), 'empty_batch': default_test_options._replace(cpu_cost=LOWCPU), diff --git a/test/core/end2end/tests/call_host_override.cc b/test/core/end2end/tests/call_host_override.cc new file mode 100644 index 00000000000..ab920be31a6 --- /dev/null +++ b/test/core/end2end/tests/call_host_override.cc @@ -0,0 +1,230 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * 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 "test/core/end2end/end2end_tests.h" + +#include +#include + +#include +#include +#include +#include +#include + +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gpr/string.h" +#include "test/core/end2end/cq_verifier.h" + +static void* tag(intptr_t t) { return (void*)t; } + +static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, + const char* test_name, + grpc_channel_args* client_args, + grpc_channel_args* server_args) { + grpc_end2end_test_fixture f; + gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name); + f = config.create_fixture(client_args, server_args); + grpc_arg fake_security_name_override = { + GRPC_ARG_STRING, + const_cast(GRPC_FAKE_SECURITY_TARGET_NAME_OVERRIDE_ARG), + {const_cast("foo.test.google.fr:1234")}}; + grpc_channel_args* new_client_args = grpc_channel_args_copy_and_add( + client_args, &fake_security_name_override, 1); + config.init_client(&f, new_client_args); + grpc_channel_args_destroy(new_client_args); + config.init_server(&f, server_args); + return f; +} + +static gpr_timespec n_seconds_from_now(int n) { + return grpc_timeout_seconds_to_deadline(n); +} + +static gpr_timespec five_seconds_from_now(void) { + return n_seconds_from_now(5); +} + +static void drain_cq(grpc_completion_queue* cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture* f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + nullptr) + .type == GRPC_OP_COMPLETE); + grpc_server_destroy(f->server); + f->server = nullptr; +} + +static void shutdown_client(grpc_end2end_test_fixture* f) { + if (!f->client) return; + grpc_channel_destroy(f->client); + f->client = nullptr; +} + +static void end_test(grpc_end2end_test_fixture* f) { + shutdown_server(f); + shutdown_client(f); + + grpc_completion_queue_shutdown(f->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); +} + +static void test_invoke_simple_request(grpc_end2end_test_config config) { + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_simple_request", nullptr, nullptr); + grpc_call* c; + grpc_call* s; + cq_verifier* cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op* op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + int was_cancelled = 2; + char* peer; + + gpr_timespec deadline = five_seconds_from_now(); + c = grpc_channel_create_call( + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + nullptr); + GPR_ASSERT(c); + + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != nullptr); + gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); + gpr_free(peer); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = nullptr; + op++; + error = grpc_call_start_batch(c, ops, static_cast(op - ops), tag(1), + nullptr); + GPR_ASSERT(error == GRPC_CALL_OK); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(error == GRPC_CALL_OK); + CQ_EXPECT_COMPLETION(cqv, tag(101), 1); + cq_verify(cqv); + + peer = grpc_call_get_peer(s); + GPR_ASSERT(peer != nullptr); + gpr_log(GPR_DEBUG, "server_peer=%s", peer); + gpr_free(peer); + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != nullptr); + gpr_log(GPR_DEBUG, "client_peer=%s", peer); + gpr_free(peer); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; + grpc_slice status_details = grpc_slice_from_static_string("xyz"); + op->data.send_status_from_server.status_details = &status_details; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = nullptr; + op++; + error = grpc_call_start_batch(s, ops, static_cast(op - ops), tag(102), + nullptr); + GPR_ASSERT(error == GRPC_CALL_OK); + + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); + GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); + GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); + GPR_ASSERT(was_cancelled == 1); + + grpc_slice_unref(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_unref(c); + grpc_call_unref(s); + + cq_verifier_destroy(cqv); + + end_test(&f); + config.tear_down_data(&f); +} + +void call_host_override(grpc_end2end_test_config config) { + test_invoke_simple_request(config); +} + +void call_host_override_pre_init(void) {} diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index b46a2b7f9a6..92e9f939b78 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8452,6 +8452,7 @@ "test/core/end2end/tests/bad_ping.cc", "test/core/end2end/tests/binary_metadata.cc", "test/core/end2end/tests/call_creds.cc", + "test/core/end2end/tests/call_host_override.cc", "test/core/end2end/tests/cancel_after_accept.cc", "test/core/end2end/tests/cancel_after_client_done.cc", "test/core/end2end/tests/cancel_after_invoke.cc", @@ -8549,6 +8550,7 @@ "test/core/end2end/tests/bad_hostname.cc", "test/core/end2end/tests/bad_ping.cc", "test/core/end2end/tests/binary_metadata.cc", + "test/core/end2end/tests/call_host_override.cc", "test/core/end2end/tests/cancel_after_accept.cc", "test/core/end2end/tests/cancel_after_client_done.cc", "test/core/end2end/tests/cancel_after_invoke.cc", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 0ea0569f77e..fcdeb9a0297 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -6899,6 +6899,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -8605,6 +8628,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -10283,6 +10329,28 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_fakesec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -13116,6 +13184,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -14802,6 +14893,25 @@ "linux" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, { "args": [ "cancel_after_accept" @@ -16228,6 +16338,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -17888,6 +18021,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+workarounds_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -19599,6 +19755,30 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -21394,6 +21574,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -23105,6 +23308,30 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_oauth2_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -24857,6 +25084,30 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -29778,6 +30029,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -31465,6 +31739,30 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_ssl_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -35235,6 +35533,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -36918,6 +37239,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -39751,6 +40095,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -41418,6 +41785,25 @@ "linux" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "cancel_after_accept" @@ -42821,6 +43207,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -44458,6 +44867,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+workarounds_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -46145,6 +46577,30 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -47917,6 +48373,29 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" @@ -49580,6 +50059,30 @@ "posix" ] }, + { + "args": [ + "call_host_override" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_after_accept" From e44efe099de238a8f5ddc613baad2d3b4fd9438d Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 26 Mar 2018 16:23:07 -0700 Subject: [PATCH 19/25] rest of pr comments --- CMakeLists.txt | 12 +++---- Makefile | 12 +++---- build.yaml | 4 +-- config.m4 | 2 +- config.w32 | 2 +- gRPC-C++.podspec | 2 +- gRPC-Core.podspec | 12 +++---- grpc.gemspec | 4 +-- grpc.gyp | 8 ++--- package.xml | 4 +-- .../ext/filters/client_channel/authority.h | 8 ++--- .../chttp2/client}/authority.cc | 4 +-- .../ext/transport/chttp2/client/authority.h | 36 +++++++++++++++++++ .../chttp2/client/insecure/channel_create.cc | 2 +- src/python/grpcio/grpc_core_dependencies.py | 2 +- tools/doxygen/Doxyfile.core.internal | 4 +-- .../generated/sources_and_headers.json | 10 +++--- 17 files changed, 82 insertions(+), 46 deletions(-) rename src/core/ext/{filters/client_channel => transport/chttp2/client}/authority.cc (92%) create mode 100644 src/core/ext/transport/chttp2/client/authority.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 92bc643cb4e..1b5848b6679 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1093,7 +1093,6 @@ add_library(grpc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc - src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -1115,6 +1114,7 @@ add_library(grpc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/tsi/alts_transport_security.cc src/core/tsi/fake_transport_security.cc @@ -1428,7 +1428,6 @@ add_library(grpc_cronet src/core/ext/filters/http/http_filters_plugin.cc src/core/ext/filters/http/message_compress/message_compress_filter.cc src/core/ext/filters/http/server/http_server_filter.cc - src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -1450,6 +1449,7 @@ add_library(grpc_cronet src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/lib/http/httpcli_security_connector.cc src/core/lib/security/context/security_context.cc src/core/lib/security/credentials/alts/alts_credentials.cc @@ -1790,7 +1790,6 @@ add_library(grpc_test_util src/core/lib/transport/transport.cc src/core/lib/transport/transport_op_string.cc src/core/lib/debug/trace.cc - src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -1812,6 +1811,7 @@ add_library(grpc_test_util src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc @@ -2093,7 +2093,6 @@ add_library(grpc_test_util_unsecure src/core/lib/transport/transport.cc src/core/lib/transport/transport_op_string.cc src/core/lib/debug/trace.cc - src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -2115,6 +2114,7 @@ add_library(grpc_test_util_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc @@ -2409,7 +2409,6 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc - src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -2431,6 +2430,7 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/transport/inproc/inproc_plugin.cc src/core/ext/transport/inproc/inproc_transport.cc @@ -3199,7 +3199,6 @@ add_library(grpc++_cronet src/core/ext/filters/http/http_filters_plugin.cc src/core/ext/filters/http/message_compress/message_compress_filter.cc src/core/ext/filters/http/server/http_server_filter.cc - src/core/ext/filters/client_channel/authority.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc src/core/ext/filters/client_channel/client_channel.cc @@ -3221,6 +3220,7 @@ add_library(grpc++_cronet src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc diff --git a/Makefile b/Makefile index 49f892b6a42..f213f6de2e7 100644 --- a/Makefile +++ b/Makefile @@ -3419,7 +3419,6 @@ LIBGRPC_SRC = \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ - src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -3441,6 +3440,7 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/tsi/alts_transport_security.cc \ src/core/tsi/fake_transport_security.cc \ @@ -3756,7 +3756,6 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/http/http_filters_plugin.cc \ src/core/ext/filters/http/message_compress/message_compress_filter.cc \ src/core/ext/filters/http/server/http_server_filter.cc \ - src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -3778,6 +3777,7 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/lib/http/httpcli_security_connector.cc \ src/core/lib/security/context/security_context.cc \ src/core/lib/security/credentials/alts/alts_credentials.cc \ @@ -4119,7 +4119,6 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/transport/transport.cc \ src/core/lib/transport/transport_op_string.cc \ src/core/lib/debug/trace.cc \ - src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4141,6 +4140,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ @@ -4415,7 +4415,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/lib/transport/transport.cc \ src/core/lib/transport/transport_op_string.cc \ src/core/lib/debug/trace.cc \ - src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4437,6 +4436,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ @@ -4711,7 +4711,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ - src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -4733,6 +4732,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/transport/inproc/inproc_plugin.cc \ src/core/ext/transport/inproc/inproc_transport.cc \ @@ -5500,7 +5500,6 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/filters/http/http_filters_plugin.cc \ src/core/ext/filters/http/message_compress/message_compress_filter.cc \ src/core/ext/filters/http/server/http_server_filter.cc \ - src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -5522,6 +5521,7 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc \ src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc \ diff --git a/build.yaml b/build.yaml index 46785a1a3f6..6550ab87b23 100644 --- a/build.yaml +++ b/build.yaml @@ -544,7 +544,6 @@ filegroups: - grpc_base - name: grpc_client_channel headers: - - src/core/ext/filters/client_channel/authority.h - src/core/ext/filters/client_channel/backup_poller.h - src/core/ext/filters/client_channel/client_channel.h - src/core/ext/filters/client_channel/client_channel_factory.h @@ -565,8 +564,8 @@ filegroups: - src/core/ext/filters/client_channel/subchannel.h - src/core/ext/filters/client_channel/subchannel_index.h - src/core/ext/filters/client_channel/uri_parser.h + - src/core/ext/transport/chttp2/client/authority.h src: - - src/core/ext/filters/client_channel/authority.cc - src/core/ext/filters/client_channel/backup_poller.cc - src/core/ext/filters/client_channel/channel_connectivity.cc - src/core/ext/filters/client_channel/client_channel.cc @@ -588,6 +587,7 @@ filegroups: - src/core/ext/filters/client_channel/subchannel.cc - src/core/ext/filters/client_channel/subchannel_index.cc - src/core/ext/filters/client_channel/uri_parser.cc + - src/core/ext/transport/chttp2/client/authority.cc plugin: grpc_client_channel uses: - grpc_base diff --git a/config.m4 b/config.m4 index 630fda6d689..5d39c14e6a4 100644 --- a/config.m4 +++ b/config.m4 @@ -321,7 +321,6 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ - src/core/ext/filters/client_channel/authority.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ src/core/ext/filters/client_channel/client_channel.cc \ @@ -343,6 +342,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/tsi/alts_transport_security.cc \ src/core/tsi/fake_transport_security.cc \ diff --git a/config.w32 b/config.w32 index 3623f2070e4..208059b38ae 100644 --- a/config.w32 +++ b/config.w32 @@ -298,7 +298,6 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create.cc " + "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " + "src\\core\\ext\\transport\\chttp2\\client\\chttp2_connector.cc " + - "src\\core\\ext\\filters\\client_channel\\authority.cc " + "src\\core\\ext\\filters\\client_channel\\backup_poller.cc " + "src\\core\\ext\\filters\\client_channel\\channel_connectivity.cc " + "src\\core\\ext\\filters\\client_channel\\client_channel.cc " + @@ -320,6 +319,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\subchannel.cc " + "src\\core\\ext\\filters\\client_channel\\subchannel_index.cc " + "src\\core\\ext\\filters\\client_channel\\uri_parser.cc " + + "src\\core\\ext\\transport\\chttp2\\client\\authority.cc " + "src\\core\\ext\\filters\\deadline\\deadline_filter.cc " + "src\\core\\tsi\\alts_transport_security.cc " + "src\\core\\tsi\\fake_transport_security.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 403674d1ee7..7b3e65c7931 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -309,7 +309,6 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', - 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', @@ -330,6 +329,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index e7cb3954469..3b4f108844e 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -319,7 +319,6 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', - 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', @@ -340,6 +339,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', @@ -739,7 +739,6 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', - 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -761,6 +760,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/tsi/alts_transport_security.cc', 'src/core/tsi/fake_transport_security.cc', @@ -899,7 +899,6 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', - 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', @@ -920,6 +919,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', @@ -1383,7 +1383,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/http/client/http_client_filter.h', 'src/core/ext/filters/http/message_compress/message_compress_filter.h', 'src/core/ext/filters/http/server/http_server_filter.h', - 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', @@ -1404,6 +1403,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/lib/security/context/security_context.h', 'src/core/lib/security/credentials/alts/alts_credentials.h', 'src/core/lib/security/credentials/composite/composite_credentials.h', @@ -1650,7 +1650,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/http/http_filters_plugin.cc', 'src/core/ext/filters/http/message_compress/message_compress_filter.cc', 'src/core/ext/filters/http/server/http_server_filter.cc', - 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -1672,6 +1671,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/lib/http/httpcli_security_connector.cc', 'src/core/lib/security/context/security_context.cc', 'src/core/lib/security/credentials/alts/alts_credentials.cc', @@ -1935,7 +1935,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/http/client/http_client_filter.h', 'src/core/ext/filters/http/message_compress/message_compress_filter.h', 'src/core/ext/filters/http/server/http_server_filter.h', - 'src/core/ext/filters/client_channel/authority.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', 'src/core/ext/filters/client_channel/client_channel_factory.h', @@ -1956,6 +1955,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/lib/security/context/security_context.h', 'src/core/lib/security/credentials/alts/alts_credentials.h', 'src/core/lib/security/credentials/composite/composite_credentials.h', diff --git a/grpc.gemspec b/grpc.gemspec index dfb0fbb0ad8..d5d052d35c4 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -250,7 +250,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/tsi/transport_security_adapter.h ) s.files += %w( src/core/tsi/transport_security_interface.h ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h ) - s.files += %w( src/core/ext/filters/client_channel/authority.h ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.h ) s.files += %w( src/core/ext/filters/client_channel/client_channel.h ) s.files += %w( src/core/ext/filters/client_channel/client_channel_factory.h ) @@ -271,6 +270,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel.h ) s.files += %w( src/core/ext/filters/client_channel/subchannel_index.h ) s.files += %w( src/core/ext/filters/client_channel/uri_parser.h ) + s.files += %w( src/core/ext/transport/chttp2/client/authority.h ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.h ) s.files += %w( src/core/tsi/alts_transport_security.h ) s.files += %w( src/core/tsi/fake_transport_security.h ) @@ -673,7 +673,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.cc ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.cc ) - s.files += %w( src/core/ext/filters/client_channel/authority.cc ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.cc ) s.files += %w( src/core/ext/filters/client_channel/channel_connectivity.cc ) s.files += %w( src/core/ext/filters/client_channel/client_channel.cc ) @@ -695,6 +694,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel.cc ) s.files += %w( src/core/ext/filters/client_channel/subchannel_index.cc ) s.files += %w( src/core/ext/filters/client_channel/uri_parser.cc ) + s.files += %w( src/core/ext/transport/chttp2/client/authority.cc ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.cc ) s.files += %w( src/core/tsi/alts_transport_security.cc ) s.files += %w( src/core/tsi/fake_transport_security.cc ) diff --git a/grpc.gyp b/grpc.gyp index 9587bbfc44e..9e1c91012b0 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -474,7 +474,6 @@ 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', - 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -496,6 +495,7 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/tsi/alts_transport_security.cc', 'src/core/tsi/fake_transport_security.cc', @@ -731,7 +731,6 @@ 'src/core/lib/transport/transport.cc', 'src/core/lib/transport/transport_op_string.cc', 'src/core/lib/debug/trace.cc', - 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -753,6 +752,7 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', @@ -962,7 +962,6 @@ 'src/core/lib/transport/transport.cc', 'src/core/lib/transport/transport_op_string.cc', 'src/core/lib/debug/trace.cc', - 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -984,6 +983,7 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', @@ -1205,7 +1205,6 @@ 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', - 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -1227,6 +1226,7 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/transport/inproc/inproc_plugin.cc', 'src/core/ext/transport/inproc/inproc_transport.cc', diff --git a/package.xml b/package.xml index 5bb146db8a6..f616e56d512 100644 --- a/package.xml +++ b/package.xml @@ -257,7 +257,6 @@ - @@ -278,6 +277,7 @@ + @@ -680,7 +680,6 @@ - @@ -702,6 +701,7 @@ + diff --git a/src/core/ext/filters/client_channel/authority.h b/src/core/ext/filters/client_channel/authority.h index 0923e9d56c6..642584ef566 100644 --- a/src/core/ext/filters/client_channel/authority.h +++ b/src/core/ext/filters/client_channel/authority.h @@ -16,8 +16,8 @@ * */ -#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H -#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H +#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H +#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H #include @@ -30,7 +30,7 @@ /// Returns a copy of \a args with the default authority channel arg set if it /// wasn't already present. -grpc_channel_args* grpc_add_default_authority_if_not_present( +grpc_channel_args* grpc_default_authority_add_if_not_present( const grpc_channel_args* args); -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H */ +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H */ diff --git a/src/core/ext/filters/client_channel/authority.cc b/src/core/ext/transport/chttp2/client/authority.cc similarity index 92% rename from src/core/ext/filters/client_channel/authority.cc rename to src/core/ext/transport/chttp2/client/authority.cc index 46a9f39aedd..bad3153b013 100644 --- a/src/core/ext/filters/client_channel/authority.cc +++ b/src/core/ext/transport/chttp2/client/authority.cc @@ -18,9 +18,9 @@ #include -#include "src/core/ext/filters/client_channel/authority.h" +#include "src/core/ext/transport/chttp2/client/authority.h" -grpc_channel_args* grpc_add_default_authority_if_not_present( +grpc_channel_args* grpc_default_authority_add_if_not_present( const grpc_channel_args* args) { const bool has_default_authority = grpc_channel_args_find(args, GRPC_ARG_DEFAULT_AUTHORITY) != nullptr; diff --git a/src/core/ext/transport/chttp2/client/authority.h b/src/core/ext/transport/chttp2/client/authority.h new file mode 100644 index 00000000000..fa08bd7073b --- /dev/null +++ b/src/core/ext/transport/chttp2/client/authority.h @@ -0,0 +1,36 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * 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. + * + */ + +#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H +#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H + +#include + +#include + +#include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/client_channel/resolver_registry.h" +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/memory.h" + +/// Returns a copy of \a args with the default authority channel arg set if it +/// wasn't already present. +grpc_channel_args* grpc_default_authority_add_if_not_present( + const grpc_channel_args* args); + +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H */ diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index 5b08b6cd36e..baac4fb9b2c 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -44,7 +44,7 @@ static grpc_subchannel* client_channel_factory_create_subchannel( grpc_subchannel_args* final_sc_args = static_cast(gpr_malloc(sizeof(*final_sc_args))); memcpy(final_sc_args, args, sizeof(*args)); - final_sc_args->args = grpc_add_default_authority_if_not_present(args->args); + final_sc_args->args = grpc_default_authority_add_if_not_present(args->args); grpc_connector* connector = grpc_chttp2_connector_create(); grpc_subchannel* s = grpc_subchannel_create(connector, final_sc_args); grpc_connector_unref(connector); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 2ec9e07e953..8d358494117 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -297,7 +297,6 @@ CORE_SOURCE_FILES = [ 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', - 'src/core/ext/filters/client_channel/authority.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', 'src/core/ext/filters/client_channel/client_channel.cc', @@ -319,6 +318,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/tsi/alts_transport_security.cc', 'src/core/tsi/fake_transport_security.cc', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 92b97c4c823..b5869a6231e 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -866,8 +866,6 @@ src/core/README.md \ src/core/ext/README.md \ src/core/ext/census/grpc_context.cc \ src/core/ext/filters/client_channel/README.md \ -src/core/ext/filters/client_channel/authority.cc \ -src/core/ext/filters/client_channel/authority.h \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/backup_poller.h \ src/core/ext/filters/client_channel/channel_connectivity.cc \ @@ -964,6 +962,8 @@ src/core/ext/transport/README.md \ src/core/ext/transport/chttp2/README.md \ src/core/ext/transport/chttp2/alpn/alpn.cc \ src/core/ext/transport/chttp2/alpn/alpn.h \ +src/core/ext/transport/chttp2/client/authority.cc \ +src/core/ext/transport/chttp2/client/authority.h \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.h \ src/core/ext/transport/chttp2/client/insecure/README.md \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 92e9f939b78..4a3a9edf26a 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -9503,7 +9503,6 @@ "grpc_deadline_filter" ], "headers": [ - "src/core/ext/filters/client_channel/authority.h", "src/core/ext/filters/client_channel/backup_poller.h", "src/core/ext/filters/client_channel/client_channel.h", "src/core/ext/filters/client_channel/client_channel_factory.h", @@ -9523,14 +9522,13 @@ "src/core/ext/filters/client_channel/retry_throttle.h", "src/core/ext/filters/client_channel/subchannel.h", "src/core/ext/filters/client_channel/subchannel_index.h", - "src/core/ext/filters/client_channel/uri_parser.h" + "src/core/ext/filters/client_channel/uri_parser.h", + "src/core/ext/transport/chttp2/client/authority.h" ], "is_filegroup": true, "language": "c", "name": "grpc_client_channel", "src": [ - "src/core/ext/filters/client_channel/authority.cc", - "src/core/ext/filters/client_channel/authority.h", "src/core/ext/filters/client_channel/backup_poller.cc", "src/core/ext/filters/client_channel/backup_poller.h", "src/core/ext/filters/client_channel/channel_connectivity.cc", @@ -9571,7 +9569,9 @@ "src/core/ext/filters/client_channel/subchannel_index.cc", "src/core/ext/filters/client_channel/subchannel_index.h", "src/core/ext/filters/client_channel/uri_parser.cc", - "src/core/ext/filters/client_channel/uri_parser.h" + "src/core/ext/filters/client_channel/uri_parser.h", + "src/core/ext/transport/chttp2/client/authority.cc", + "src/core/ext/transport/chttp2/client/authority.h" ], "third_party": false, "type": "filegroup" From 49f625f232bc859cbb59a0de37bbd1d66b8b8ec7 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 27 Mar 2018 11:23:49 -0700 Subject: [PATCH 20/25] more comments --- BUILD | 2 ++ CMakeLists.txt | 10 +++--- Makefile | 10 +++--- build.yaml | 4 +-- config.m4 | 2 +- config.w32 | 2 +- gRPC-C++.podspec | 2 +- gRPC-Core.podspec | 12 +++---- grpc.gemspec | 4 +-- grpc.gyp | 6 ++-- include/grpc/impl/codegen/grpc_types.h | 10 ------ package.xml | 4 +-- .../ext/filters/client_channel/authority.h | 36 ------------------- .../security_connector/security_connector.cc | 2 +- src/python/grpcio/grpc_core_dependencies.py | 2 +- test/core/end2end/tests/call_host_override.cc | 2 +- .../generated/sources_and_headers.json | 10 +++--- 17 files changed, 35 insertions(+), 85 deletions(-) delete mode 100644 src/core/ext/filters/client_channel/authority.h diff --git a/BUILD b/BUILD index b56e6e47191..7900b8d23d1 100644 --- a/BUILD +++ b/BUILD @@ -1485,9 +1485,11 @@ grpc_cc_library( grpc_cc_library( name = "grpc_transport_chttp2_client_connector", srcs = [ + "src/core/ext/transport/chttp2/client/authority.cc", "src/core/ext/transport/chttp2/client/chttp2_connector.cc", ], hdrs = [ + "src/core/ext/transport/chttp2/client/authority.h", "src/core/ext/transport/chttp2/client/chttp2_connector.h", ], language = "c++", diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b5848b6679..a50017dc00c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1092,6 +1092,7 @@ add_library(grpc src/core/tsi/transport_security_adapter.cc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc @@ -1114,7 +1115,6 @@ add_library(grpc src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc - src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/tsi/alts_transport_security.cc src/core/tsi/fake_transport_security.cc @@ -1449,7 +1449,6 @@ add_library(grpc_cronet src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc - src/core/ext/transport/chttp2/client/authority.cc src/core/lib/http/httpcli_security_connector.cc src/core/lib/security/context/security_context.cc src/core/lib/security/credentials/alts/alts_credentials.cc @@ -1514,6 +1513,7 @@ add_library(grpc_cronet src/core/tsi/transport_security_adapter.cc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc src/core/tsi/alts_transport_security.cc src/core/tsi/fake_transport_security.cc @@ -1811,7 +1811,6 @@ add_library(grpc_test_util src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc - src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc @@ -2114,7 +2113,6 @@ add_library(grpc_test_util_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc - src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc @@ -2408,6 +2406,7 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/server/chttp2_server.cc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc src/core/ext/filters/client_channel/backup_poller.cc src/core/ext/filters/client_channel/channel_connectivity.cc @@ -2430,7 +2429,6 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc - src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/transport/inproc/inproc_plugin.cc src/core/ext/transport/inproc/inproc_transport.cc @@ -3022,6 +3020,7 @@ add_library(grpc++_cronet src/cpp/codegen/codegen_init.cc src/core/ext/transport/chttp2/client/insecure/channel_create.cc src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc + src/core/ext/transport/chttp2/client/authority.cc src/core/ext/transport/chttp2/client/chttp2_connector.cc src/core/ext/transport/chttp2/transport/bin_decoder.cc src/core/ext/transport/chttp2/transport/bin_encoder.cc @@ -3220,7 +3219,6 @@ add_library(grpc++_cronet src/core/ext/filters/client_channel/subchannel.cc src/core/ext/filters/client_channel/subchannel_index.cc src/core/ext/filters/client_channel/uri_parser.cc - src/core/ext/transport/chttp2/client/authority.cc src/core/ext/filters/deadline/deadline_filter.cc src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc diff --git a/Makefile b/Makefile index f213f6de2e7..af01e2380f9 100644 --- a/Makefile +++ b/Makefile @@ -3418,6 +3418,7 @@ LIBGRPC_SRC = \ src/core/tsi/transport_security_adapter.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ @@ -3440,7 +3441,6 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ - src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/tsi/alts_transport_security.cc \ src/core/tsi/fake_transport_security.cc \ @@ -3777,7 +3777,6 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ - src/core/ext/transport/chttp2/client/authority.cc \ src/core/lib/http/httpcli_security_connector.cc \ src/core/lib/security/context/security_context.cc \ src/core/lib/security/credentials/alts/alts_credentials.cc \ @@ -3842,6 +3841,7 @@ LIBGRPC_CRONET_SRC = \ src/core/tsi/transport_security_adapter.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ src/core/tsi/alts_transport_security.cc \ src/core/tsi/fake_transport_security.cc \ @@ -4140,7 +4140,6 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ - src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ @@ -4436,7 +4435,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ - src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ @@ -4710,6 +4708,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/server/chttp2_server.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ @@ -4732,7 +4731,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ - src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/transport/inproc/inproc_plugin.cc \ src/core/ext/transport/inproc/inproc_transport.cc \ @@ -5323,6 +5321,7 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/codegen/codegen_init.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ src/core/ext/transport/chttp2/transport/bin_decoder.cc \ src/core/ext/transport/chttp2/transport/bin_encoder.cc \ @@ -5521,7 +5520,6 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ - src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc \ src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc \ diff --git a/build.yaml b/build.yaml index 6550ab87b23..1bdca1065fd 100644 --- a/build.yaml +++ b/build.yaml @@ -564,7 +564,6 @@ filegroups: - src/core/ext/filters/client_channel/subchannel.h - src/core/ext/filters/client_channel/subchannel_index.h - src/core/ext/filters/client_channel/uri_parser.h - - src/core/ext/transport/chttp2/client/authority.h src: - src/core/ext/filters/client_channel/backup_poller.cc - src/core/ext/filters/client_channel/channel_connectivity.cc @@ -587,7 +586,6 @@ filegroups: - src/core/ext/filters/client_channel/subchannel.cc - src/core/ext/filters/client_channel/subchannel_index.cc - src/core/ext/filters/client_channel/uri_parser.cc - - src/core/ext/transport/chttp2/client/authority.cc plugin: grpc_client_channel uses: - grpc_base @@ -939,8 +937,10 @@ filegroups: - gpr - name: grpc_transport_chttp2_client_connector headers: + - src/core/ext/transport/chttp2/client/authority.h - src/core/ext/transport/chttp2/client/chttp2_connector.h src: + - src/core/ext/transport/chttp2/client/authority.cc - src/core/ext/transport/chttp2/client/chttp2_connector.cc uses: - grpc_transport_chttp2 diff --git a/config.m4 b/config.m4 index 5d39c14e6a4..f1abdd8df48 100644 --- a/config.m4 +++ b/config.m4 @@ -320,6 +320,7 @@ if test "$PHP_GRPC" != "no"; then src/core/tsi/transport_security_adapter.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ + src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/transport/chttp2/client/chttp2_connector.cc \ src/core/ext/filters/client_channel/backup_poller.cc \ src/core/ext/filters/client_channel/channel_connectivity.cc \ @@ -342,7 +343,6 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/subchannel.cc \ src/core/ext/filters/client_channel/subchannel_index.cc \ src/core/ext/filters/client_channel/uri_parser.cc \ - src/core/ext/transport/chttp2/client/authority.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/tsi/alts_transport_security.cc \ src/core/tsi/fake_transport_security.cc \ diff --git a/config.w32 b/config.w32 index 208059b38ae..efabab48a6d 100644 --- a/config.w32 +++ b/config.w32 @@ -297,6 +297,7 @@ if (PHP_GRPC != "no") { "src\\core\\tsi\\transport_security_adapter.cc " + "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create.cc " + "src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " + + "src\\core\\ext\\transport\\chttp2\\client\\authority.cc " + "src\\core\\ext\\transport\\chttp2\\client\\chttp2_connector.cc " + "src\\core\\ext\\filters\\client_channel\\backup_poller.cc " + "src\\core\\ext\\filters\\client_channel\\channel_connectivity.cc " + @@ -319,7 +320,6 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\subchannel.cc " + "src\\core\\ext\\filters\\client_channel\\subchannel_index.cc " + "src\\core\\ext\\filters\\client_channel\\uri_parser.cc " + - "src\\core\\ext\\transport\\chttp2\\client\\authority.cc " + "src\\core\\ext\\filters\\deadline\\deadline_filter.cc " + "src\\core\\tsi\\alts_transport_security.cc " + "src\\core\\tsi\\fake_transport_security.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 7b3e65c7931..9d4d15a9a1d 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -308,6 +308,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', @@ -329,7 +330,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', - 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 3b4f108844e..a4bf9341004 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -318,6 +318,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', @@ -339,7 +340,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', - 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', @@ -738,6 +738,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_adapter.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', @@ -760,7 +761,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', - 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/tsi/alts_transport_security.cc', 'src/core/tsi/fake_transport_security.cc', @@ -898,6 +898,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/backup_poller.h', 'src/core/ext/filters/client_channel/client_channel.h', @@ -919,7 +920,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', - 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', @@ -1403,7 +1403,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', - 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/lib/security/context/security_context.h', 'src/core/lib/security/credentials/alts/alts_credentials.h', 'src/core/lib/security/credentials/composite/composite_credentials.h', @@ -1457,6 +1456,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', @@ -1671,7 +1671,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', - 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/lib/http/httpcli_security_connector.cc', 'src/core/lib/security/context/security_context.cc', 'src/core/lib/security/credentials/alts/alts_credentials.cc', @@ -1736,6 +1735,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_adapter.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', 'src/core/tsi/alts_transport_security.cc', 'src/core/tsi/fake_transport_security.cc', @@ -1955,7 +1955,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', - 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/lib/security/context/security_context.h', 'src/core/lib/security/credentials/alts/alts_credentials.h', 'src/core/lib/security/credentials/composite/composite_credentials.h', @@ -2009,6 +2008,7 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security.h', 'src/core/tsi/transport_security_adapter.h', 'src/core/tsi/transport_security_interface.h', + 'src/core/ext/transport/chttp2/client/authority.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/tsi/alts_transport_security.h', 'src/core/tsi/fake_transport_security.h', diff --git a/grpc.gemspec b/grpc.gemspec index d5d052d35c4..ec8a7ffb771 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -249,6 +249,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/tsi/transport_security.h ) s.files += %w( src/core/tsi/transport_security_adapter.h ) s.files += %w( src/core/tsi/transport_security_interface.h ) + s.files += %w( src/core/ext/transport/chttp2/client/authority.h ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.h ) s.files += %w( src/core/ext/filters/client_channel/client_channel.h ) @@ -270,7 +271,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel.h ) s.files += %w( src/core/ext/filters/client_channel/subchannel_index.h ) s.files += %w( src/core/ext/filters/client_channel/uri_parser.h ) - s.files += %w( src/core/ext/transport/chttp2/client/authority.h ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.h ) s.files += %w( src/core/tsi/alts_transport_security.h ) s.files += %w( src/core/tsi/fake_transport_security.h ) @@ -672,6 +672,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/tsi/transport_security_adapter.cc ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.cc ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc ) + s.files += %w( src/core/ext/transport/chttp2/client/authority.cc ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.cc ) s.files += %w( src/core/ext/filters/client_channel/backup_poller.cc ) s.files += %w( src/core/ext/filters/client_channel/channel_connectivity.cc ) @@ -694,7 +695,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel.cc ) s.files += %w( src/core/ext/filters/client_channel/subchannel_index.cc ) s.files += %w( src/core/ext/filters/client_channel/uri_parser.cc ) - s.files += %w( src/core/ext/transport/chttp2/client/authority.cc ) s.files += %w( src/core/ext/filters/deadline/deadline_filter.cc ) s.files += %w( src/core/tsi/alts_transport_security.cc ) s.files += %w( src/core/tsi/fake_transport_security.cc ) diff --git a/grpc.gyp b/grpc.gyp index 9e1c91012b0..5e112fafecb 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -473,6 +473,7 @@ 'src/core/tsi/transport_security_adapter.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', @@ -495,7 +496,6 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', - 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/tsi/alts_transport_security.cc', 'src/core/tsi/fake_transport_security.cc', @@ -752,7 +752,6 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', - 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', @@ -983,7 +982,6 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', - 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/transport/chttp2/transport/bin_decoder.cc', 'src/core/ext/transport/chttp2/transport/bin_encoder.cc', @@ -1204,6 +1202,7 @@ 'src/core/ext/transport/chttp2/server/chttp2_server.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', @@ -1226,7 +1225,6 @@ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', - 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/ext/transport/inproc/inproc_plugin.cc', 'src/core/ext/transport/inproc/inproc_transport.cc', diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 51f641054f0..03aaa9fae4d 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -258,16 +258,6 @@ typedef struct { secure channel is an SSL channel). If this parameter is specified and the underlying is not an SSL channel, it will just be ignored. */ #define GRPC_SSL_TARGET_NAME_OVERRIDE_ARG "grpc.ssl_target_name_override" -/** This *should* be used for testing only. - The caller of the secure_channel_create functions may override the target - name used for fake security host name checking using this channel argument - which is of type \a GRPC_ARG_STRING. If this argument is not specified, the - name used for fake security host name checking will be the target parameter - (assuming that the secure channel is a fake security channel). If this - parameter is specified and the underlying is not a fake security channel, it - will just be ignored. */ -#define GRPC_FAKE_SECURITY_TARGET_NAME_OVERRIDE_ARG \ - "grpc.fake_security_target_name_override" /** If non-zero, a pointer to a session cache (a pointer of type grpc_ssl_session_cache*). (use grpc_ssl_session_cache_arg_vtable() to fetch an appropriate pointer arg vtable) */ diff --git a/package.xml b/package.xml index f616e56d512..d8b9b2cbbb4 100644 --- a/package.xml +++ b/package.xml @@ -256,6 +256,7 @@ + @@ -277,7 +278,6 @@ - @@ -679,6 +679,7 @@ + @@ -701,7 +702,6 @@ - diff --git a/src/core/ext/filters/client_channel/authority.h b/src/core/ext/filters/client_channel/authority.h deleted file mode 100644 index 642584ef566..00000000000 --- a/src/core/ext/filters/client_channel/authority.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * 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. - * - */ - -#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H -#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H - -#include - -#include - -#include "src/core/ext/filters/client_channel/client_channel.h" -#include "src/core/ext/filters/client_channel/resolver_registry.h" -#include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/gprpp/memory.h" - -/// Returns a copy of \a args with the default authority channel arg set if it -/// wasn't already present. -grpc_channel_args* grpc_default_authority_add_if_not_present( - const grpc_channel_args* args); - -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H */ diff --git a/src/core/lib/security/security_connector/security_connector.cc b/src/core/lib/security/security_connector/security_connector.cc index 0066d3f09f2..980c9e92489 100644 --- a/src/core/lib/security/security_connector/security_connector.cc +++ b/src/core/lib/security/security_connector/security_connector.cc @@ -550,7 +550,7 @@ grpc_channel_security_connector* grpc_fake_channel_security_connector_create( c->expected_targets = gpr_strdup(expected_targets); c->is_lb_channel = grpc_core::FindTargetAuthorityTableInArgs(args) != nullptr; const grpc_arg* target_name_override_arg = - grpc_channel_args_find(args, GRPC_FAKE_SECURITY_TARGET_NAME_OVERRIDE_ARG); + grpc_channel_args_find(args, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); if (target_name_override_arg != nullptr) { c->target_name_override = gpr_strdup(grpc_channel_arg_get_string(target_name_override_arg)); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 8d358494117..ebc0a6c41ad 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -296,6 +296,7 @@ CORE_SOURCE_FILES = [ 'src/core/tsi/transport_security_adapter.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create.cc', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc', + 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/transport/chttp2/client/chttp2_connector.cc', 'src/core/ext/filters/client_channel/backup_poller.cc', 'src/core/ext/filters/client_channel/channel_connectivity.cc', @@ -318,7 +319,6 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/subchannel.cc', 'src/core/ext/filters/client_channel/subchannel_index.cc', 'src/core/ext/filters/client_channel/uri_parser.cc', - 'src/core/ext/transport/chttp2/client/authority.cc', 'src/core/ext/filters/deadline/deadline_filter.cc', 'src/core/tsi/alts_transport_security.cc', 'src/core/tsi/fake_transport_security.cc', diff --git a/test/core/end2end/tests/call_host_override.cc b/test/core/end2end/tests/call_host_override.cc index ab920be31a6..251dc6d045a 100644 --- a/test/core/end2end/tests/call_host_override.cc +++ b/test/core/end2end/tests/call_host_override.cc @@ -42,7 +42,7 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, f = config.create_fixture(client_args, server_args); grpc_arg fake_security_name_override = { GRPC_ARG_STRING, - const_cast(GRPC_FAKE_SECURITY_TARGET_NAME_OVERRIDE_ARG), + const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), {const_cast("foo.test.google.fr:1234")}}; grpc_channel_args* new_client_args = grpc_channel_args_copy_and_add( client_args, &fake_security_name_override, 1); diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 4a3a9edf26a..7c26a20b9ff 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -9522,8 +9522,7 @@ "src/core/ext/filters/client_channel/retry_throttle.h", "src/core/ext/filters/client_channel/subchannel.h", "src/core/ext/filters/client_channel/subchannel_index.h", - "src/core/ext/filters/client_channel/uri_parser.h", - "src/core/ext/transport/chttp2/client/authority.h" + "src/core/ext/filters/client_channel/uri_parser.h" ], "is_filegroup": true, "language": "c", @@ -9569,9 +9568,7 @@ "src/core/ext/filters/client_channel/subchannel_index.cc", "src/core/ext/filters/client_channel/subchannel_index.h", "src/core/ext/filters/client_channel/uri_parser.cc", - "src/core/ext/filters/client_channel/uri_parser.h", - "src/core/ext/transport/chttp2/client/authority.cc", - "src/core/ext/transport/chttp2/client/authority.h" + "src/core/ext/filters/client_channel/uri_parser.h" ], "third_party": false, "type": "filegroup" @@ -10220,12 +10217,15 @@ "grpc_transport_chttp2" ], "headers": [ + "src/core/ext/transport/chttp2/client/authority.h", "src/core/ext/transport/chttp2/client/chttp2_connector.h" ], "is_filegroup": true, "language": "c", "name": "grpc_transport_chttp2_client_connector", "src": [ + "src/core/ext/transport/chttp2/client/authority.cc", + "src/core/ext/transport/chttp2/client/authority.h", "src/core/ext/transport/chttp2/client/chttp2_connector.cc", "src/core/ext/transport/chttp2/client/chttp2_connector.h" ], From 9a2cea0aed7d3be519979116928a9c4585aa40f1 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 27 Mar 2018 11:40:28 -0700 Subject: [PATCH 21/25] fix include guard --- src/core/ext/transport/chttp2/client/authority.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ext/transport/chttp2/client/authority.h b/src/core/ext/transport/chttp2/client/authority.h index fa08bd7073b..642584ef566 100644 --- a/src/core/ext/transport/chttp2/client/authority.h +++ b/src/core/ext/transport/chttp2/client/authority.h @@ -16,8 +16,8 @@ * */ -#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H -#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H +#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H +#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H #include @@ -33,4 +33,4 @@ grpc_channel_args* grpc_default_authority_add_if_not_present( const grpc_channel_args* args); -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_AUTHORITY_H */ +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_AUTHORITY_H */ From d5d36d7b7bdcb0f8dcba780deec1ec7b567c158d Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 27 Mar 2018 11:41:54 -0700 Subject: [PATCH 22/25] fix wrong include --- src/core/ext/transport/chttp2/client/insecure/channel_create.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index baac4fb9b2c..76c1225c48a 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -25,9 +25,9 @@ #include #include -#include "src/core/ext/filters/client_channel/authority.h" #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/client_channel/resolver_registry.h" +#include "src/core/ext/transport/chttp2/client/authority.h" #include "src/core/ext/transport/chttp2/client/chttp2_connector.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/surface/api_trace.h" From 46511cd5d3488007b22480d64074feff0bf71010 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 27 Mar 2018 14:21:06 -0700 Subject: [PATCH 23/25] malloc to stack --- .../chttp2/client/insecure/channel_create.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index 76c1225c48a..e6c8c382607 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -41,16 +41,13 @@ static void client_channel_factory_unref( static grpc_subchannel* client_channel_factory_create_subchannel( grpc_client_channel_factory* cc_factory, const grpc_subchannel_args* args) { - grpc_subchannel_args* final_sc_args = - static_cast(gpr_malloc(sizeof(*final_sc_args))); - memcpy(final_sc_args, args, sizeof(*args)); - final_sc_args->args = grpc_default_authority_add_if_not_present(args->args); + grpc_subchannel_args final_sc_args; + memcpy(&final_sc_args, args, sizeof(*args)); + final_sc_args.args = grpc_default_authority_add_if_not_present(args->args); grpc_connector* connector = grpc_chttp2_connector_create(); - grpc_subchannel* s = grpc_subchannel_create(connector, final_sc_args); + grpc_subchannel* s = grpc_subchannel_create(connector, &final_sc_args); grpc_connector_unref(connector); - grpc_channel_args_destroy( - const_cast(final_sc_args->args)); - gpr_free(final_sc_args); + grpc_channel_args_destroy(const_cast(final_sc_args.args)); return s; } From e27ffd82df58fc8f7bb81d233cc30ab62833e5dd Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 27 Mar 2018 14:55:18 -0700 Subject: [PATCH 24/25] fixed BUILD --- BUILD | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/BUILD b/BUILD index f79c0bb6ea8..e1c5f7663ae 100644 --- a/BUILD +++ b/BUILD @@ -308,8 +308,8 @@ grpc_cc_library( deps = [ "grpc_base", "grpc_deadline_filter", - "grpc_lb_policy_pick_first", "grpc_http_filters", + "grpc_lb_policy_pick_first", "grpc_max_age_filter", "grpc_message_size_filter", "grpc_resolver_dns_native", @@ -1013,7 +1013,6 @@ grpc_cc_library( grpc_cc_library( name = "grpc_client_channel", srcs = [ - "src/core/ext/filters/client_channel/authority.cc", "src/core/ext/filters/client_channel/backup_poller.cc", "src/core/ext/filters/client_channel/channel_connectivity.cc", "src/core/ext/filters/client_channel/client_channel.cc", @@ -1037,7 +1036,6 @@ grpc_cc_library( "src/core/ext/filters/client_channel/uri_parser.cc", ], hdrs = [ - "src/core/ext/filters/client_channel/authority.h", "src/core/ext/filters/client_channel/backup_poller.h", "src/core/ext/filters/client_channel/client_channel.h", "src/core/ext/filters/client_channel/client_channel_factory.h", From b08e6a2e3d72e6dea50f31970c1df5d04fa8222e Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 27 Mar 2018 16:03:18 -0700 Subject: [PATCH 25/25] fix generate_tests.bzl --- test/core/end2end/generate_tests.bzl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index 8e723fd609c..37fd1837f41 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -101,6 +101,8 @@ END2END_TESTS = { 'binary_metadata': test_options(), 'resource_quota_server': test_options(proxyable=False), 'call_creds': test_options(secure=True), + 'call_host_override': test_options(needs_fullstack=True, needs_dns=True, + needs_names=True), 'cancel_after_accept': test_options(), 'cancel_after_client_done': test_options(), 'cancel_after_invoke': test_options(),