diff --git a/BUILD b/BUILD
index 3095034ae66..67109c99f5a 100644
--- a/BUILD
+++ b/BUILD
@@ -1586,7 +1586,6 @@ grpc_cc_library(
"src/core/lib/surface/server.cc",
"src/core/lib/surface/validate_metadata.cc",
"src/core/lib/surface/version.cc",
- "src/core/lib/transport/authority_override.cc",
"src/core/lib/transport/bdp_estimator.cc",
"src/core/lib/transport/byte_stream.cc",
"src/core/lib/transport/connectivity_state.cc",
@@ -1720,7 +1719,6 @@ grpc_cc_library(
"src/core/lib/surface/lame_client.h",
"src/core/lib/surface/server.h",
"src/core/lib/surface/validate_metadata.h",
- "src/core/lib/transport/authority_override.h",
"src/core/lib/transport/bdp_estimator.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
@@ -3266,11 +3264,9 @@ 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 53c7431606b..ed788de24dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1564,7 +1564,6 @@ add_library(grpc
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
src/core/ext/filters/workarounds/workaround_utils.cc
src/core/ext/transport/chttp2/alpn/alpn.cc
- src/core/ext/transport/chttp2/client/authority.cc
src/core/ext/transport/chttp2/client/chttp2_connector.cc
src/core/ext/transport/chttp2/client/insecure/channel_create.cc
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@@ -2014,7 +2013,6 @@ add_library(grpc
src/core/lib/surface/server.cc
src/core/lib/surface/validate_metadata.cc
src/core/lib/surface/version.cc
- src/core/lib/transport/authority_override.cc
src/core/lib/transport/bdp_estimator.cc
src/core/lib/transport/byte_stream.cc
src/core/lib/transport/connectivity_state.cc
@@ -2399,7 +2397,6 @@ add_library(grpc_unsecure
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
src/core/ext/filters/workarounds/workaround_utils.cc
src/core/ext/transport/chttp2/alpn/alpn.cc
- src/core/ext/transport/chttp2/client/authority.cc
src/core/ext/transport/chttp2/client/chttp2_connector.cc
src/core/ext/transport/chttp2/client/insecure/channel_create.cc
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@@ -2600,7 +2597,6 @@ add_library(grpc_unsecure
src/core/lib/surface/server.cc
src/core/lib/surface/validate_metadata.cc
src/core/lib/surface/version.cc
- src/core/lib/transport/authority_override.cc
src/core/lib/transport/bdp_estimator.cc
src/core/lib/transport/byte_stream.cc
src/core/lib/transport/connectivity_state.cc
diff --git a/Makefile b/Makefile
index afd1b1a0c06..1ebb80707a6 100644
--- a/Makefile
+++ b/Makefile
@@ -1121,7 +1121,6 @@ LIBGRPC_SRC = \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
- src/core/ext/transport/chttp2/client/authority.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \
@@ -1571,7 +1570,6 @@ LIBGRPC_SRC = \
src/core/lib/surface/server.cc \
src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/version.cc \
- src/core/lib/transport/authority_override.cc \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/byte_stream.cc \
src/core/lib/transport/connectivity_state.cc \
@@ -1803,7 +1801,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
- src/core/ext/transport/chttp2/client/authority.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \
@@ -2004,7 +2001,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/server.cc \
src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/version.cc \
- src/core/lib/transport/authority_override.cc \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/byte_stream.cc \
src/core/lib/transport/connectivity_state.cc \
diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml
index 9a7055316de..c6283677cf2 100644
--- a/build_autogenerated.yaml
+++ b/build_autogenerated.yaml
@@ -496,7 +496,6 @@ libs:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
- src/core/ext/filters/workarounds/workaround_utils.h
- src/core/ext/transport/chttp2/alpn/alpn.h
- - src/core/ext/transport/chttp2/client/authority.h
- src/core/ext/transport/chttp2/client/chttp2_connector.h
- src/core/ext/transport/chttp2/server/chttp2_server.h
- src/core/ext/transport/chttp2/transport/bin_decoder.h
@@ -916,7 +915,6 @@ libs:
- src/core/lib/surface/lame_client.h
- src/core/lib/surface/server.h
- src/core/lib/surface/validate_metadata.h
- - src/core/lib/transport/authority_override.h
- src/core/lib/transport/bdp_estimator.h
- src/core/lib/transport/byte_stream.h
- src/core/lib/transport/connectivity_state.h
@@ -1037,7 +1035,6 @@ libs:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
- src/core/ext/filters/workarounds/workaround_utils.cc
- src/core/ext/transport/chttp2/alpn/alpn.cc
- - src/core/ext/transport/chttp2/client/authority.cc
- src/core/ext/transport/chttp2/client/chttp2_connector.cc
- src/core/ext/transport/chttp2/client/insecure/channel_create.cc
- src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@@ -1487,7 +1484,6 @@ libs:
- src/core/lib/surface/server.cc
- src/core/lib/surface/validate_metadata.cc
- src/core/lib/surface/version.cc
- - src/core/lib/transport/authority_override.cc
- src/core/lib/transport/bdp_estimator.cc
- src/core/lib/transport/byte_stream.cc
- src/core/lib/transport/connectivity_state.cc
@@ -1744,7 +1740,6 @@ libs:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
- src/core/ext/filters/workarounds/workaround_utils.h
- src/core/ext/transport/chttp2/alpn/alpn.h
- - src/core/ext/transport/chttp2/client/authority.h
- src/core/ext/transport/chttp2/client/chttp2_connector.h
- src/core/ext/transport/chttp2/server/chttp2_server.h
- src/core/ext/transport/chttp2/transport/bin_decoder.h
@@ -1924,7 +1919,6 @@ libs:
- src/core/lib/surface/lame_client.h
- src/core/lib/surface/server.h
- src/core/lib/surface/validate_metadata.h
- - src/core/lib/transport/authority_override.h
- src/core/lib/transport/bdp_estimator.h
- src/core/lib/transport/byte_stream.h
- src/core/lib/transport/connectivity_state.h
@@ -2012,7 +2006,6 @@ libs:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
- src/core/ext/filters/workarounds/workaround_utils.cc
- src/core/ext/transport/chttp2/alpn/alpn.cc
- - src/core/ext/transport/chttp2/client/authority.cc
- src/core/ext/transport/chttp2/client/chttp2_connector.cc
- src/core/ext/transport/chttp2/client/insecure/channel_create.cc
- src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@@ -2213,7 +2206,6 @@ libs:
- src/core/lib/surface/server.cc
- src/core/lib/surface/validate_metadata.cc
- src/core/lib/surface/version.cc
- - src/core/lib/transport/authority_override.cc
- src/core/lib/transport/bdp_estimator.cc
- src/core/lib/transport/byte_stream.cc
- src/core/lib/transport/connectivity_state.cc
diff --git a/config.m4 b/config.m4
index 9ff3f6382c8..d5cc04522c3 100644
--- a/config.m4
+++ b/config.m4
@@ -116,7 +116,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc \
src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
- src/core/ext/transport/chttp2/client/authority.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create.cc \
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \
@@ -624,7 +623,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/surface/server.cc \
src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/version.cc \
- src/core/lib/transport/authority_override.cc \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/byte_stream.cc \
src/core/lib/transport/connectivity_state.cc \
diff --git a/config.w32 b/config.w32
index 889c95591d6..c63ccbea5f5 100644
--- a/config.w32
+++ b/config.w32
@@ -82,7 +82,6 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\workarounds\\workaround_cronet_compression_filter.cc " +
"src\\core\\ext\\filters\\workarounds\\workaround_utils.cc " +
"src\\core\\ext\\transport\\chttp2\\alpn\\alpn.cc " +
- "src\\core\\ext\\transport\\chttp2\\client\\authority.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\chttp2_connector.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\insecure\\channel_create_posix.cc " +
@@ -590,7 +589,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\surface\\server.cc " +
"src\\core\\lib\\surface\\validate_metadata.cc " +
"src\\core\\lib\\surface\\version.cc " +
- "src\\core\\lib\\transport\\authority_override.cc " +
"src\\core\\lib\\transport\\bdp_estimator.cc " +
"src\\core\\lib\\transport\\byte_stream.cc " +
"src\\core\\lib\\transport\\connectivity_state.cc " +
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index d2a846a19f2..65b96766134 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -267,7 +267,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
- 'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
@@ -729,7 +728,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
- 'src/core/lib/transport/authority_override.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
@@ -940,7 +938,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
- 'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
@@ -1402,7 +1399,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
- 'src/core/lib/transport/authority_override.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index 756c2f92bce..fa125bb6df1 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -334,8 +334,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_utils.h',
'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/channel_create.cc',
@@ -1304,8 +1302,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/validate_metadata.h',
'src/core/lib/surface/version.cc',
- 'src/core/lib/transport/authority_override.cc',
- 'src/core/lib/transport/authority_override.h',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.cc',
@@ -1528,7 +1524,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
- 'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
@@ -1990,7 +1985,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
- 'src/core/lib/transport/authority_override.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
diff --git a/grpc.gemspec b/grpc.gemspec
index a1c6b3043cf..3fabda8cae0 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -246,8 +246,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/workarounds/workaround_utils.h )
s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.cc )
s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.h )
- s.files += %w( src/core/ext/transport/chttp2/client/authority.cc )
- s.files += %w( src/core/ext/transport/chttp2/client/authority.h )
s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.cc )
s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h )
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.cc )
@@ -1216,8 +1214,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/validate_metadata.cc )
s.files += %w( src/core/lib/surface/validate_metadata.h )
s.files += %w( src/core/lib/surface/version.cc )
- s.files += %w( src/core/lib/transport/authority_override.cc )
- s.files += %w( src/core/lib/transport/authority_override.h )
s.files += %w( src/core/lib/transport/bdp_estimator.cc )
s.files += %w( src/core/lib/transport/bdp_estimator.h )
s.files += %w( src/core/lib/transport/byte_stream.cc )
diff --git a/grpc.gyp b/grpc.gyp
index 4aac1c01992..6bd98a2c0d8 100644
--- a/grpc.gyp
+++ b/grpc.gyp
@@ -563,7 +563,6 @@
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
- 'src/core/ext/transport/chttp2/client/authority.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
@@ -1013,7 +1012,6 @@
'src/core/lib/surface/server.cc',
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/version.cc',
- 'src/core/lib/transport/authority_override.cc',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/byte_stream.cc',
'src/core/lib/transport/connectivity_state.cc',
@@ -1221,7 +1219,6 @@
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
- 'src/core/ext/transport/chttp2/client/authority.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
@@ -1422,7 +1419,6 @@
'src/core/lib/surface/server.cc',
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/version.cc',
- 'src/core/lib/transport/authority_override.cc',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/byte_stream.cc',
'src/core/lib/transport/connectivity_state.cc',
diff --git a/package.xml b/package.xml
index d1ccb95d9bd..47f8a18d5eb 100644
--- a/package.xml
+++ b/package.xml
@@ -226,8 +226,6 @@
-
-
@@ -1196,8 +1194,6 @@
-
-
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index 4dbe5170caf..3e529903f56 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -908,24 +908,47 @@ class ClientChannel::ClientChannelControlHelper
if (!inhibit_health_checking) {
health_check_service_name = chand_->health_check_service_name_;
}
+ // Construct channel args for subchannel.
// Remove channel args that should not affect subchannel uniqueness.
- static const char* args_to_remove[] = {
+ absl::InlinedVector args_to_remove = {
GRPC_ARG_INHIBIT_HEALTH_CHECKING,
GRPC_ARG_CHANNELZ_CHANNEL_NODE,
};
// Add channel args needed for the subchannel.
- absl::InlinedVector args_to_add = {
+ absl::InlinedVector args_to_add = {
SubchannelPoolInterface::CreateChannelArg(
chand_->subchannel_pool_.get()),
};
+ // Check if default authority arg is already set.
+ const char* default_authority =
+ grpc_channel_args_find_string(&args, GRPC_ARG_DEFAULT_AUTHORITY);
+ // Add args from subchannel address.
if (address.args() != nullptr) {
for (size_t j = 0; j < address.args()->num_args; ++j) {
- args_to_add.emplace_back(address.args()->args[j]);
+ grpc_arg& arg = address.args()->args[j];
+ if (strcmp(arg.key, GRPC_ARG_DEFAULT_AUTHORITY) == 0) {
+ // Don't add default authority arg from subchannel address if
+ // it's already set at the channel level -- the value from the
+ // application should take precedence over what is set by the
+ // resolver.
+ if (default_authority != nullptr) continue;
+ default_authority = arg.value.string;
+ }
+ args_to_add.emplace_back(arg);
}
}
+ // If we haven't already set the default authority arg, add it from
+ // the channel.
+ if (default_authority == nullptr) {
+ // Remove it, just in case it's actually present but is the wrong type.
+ args_to_remove.push_back(GRPC_ARG_DEFAULT_AUTHORITY);
+ args_to_add.push_back(grpc_channel_arg_string_create(
+ const_cast(GRPC_ARG_DEFAULT_AUTHORITY),
+ const_cast(chand_->default_authority_.c_str())));
+ }
grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(
- &args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove),
- args_to_add.data(), args_to_add.size());
+ &args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(),
+ args_to_add.size());
// Create subchannel.
RefCountedPtr subchannel =
chand_->client_channel_factory_->CreateSubchannel(address.address(),
@@ -968,6 +991,10 @@ class ClientChannel::ClientChannelControlHelper
chand_->resolver_->RequestReresolutionLocked();
}
+ absl::string_view GetAuthority() override {
+ return chand_->default_authority_;
+ }
+
void AddTraceEvent(TraceSeverity severity, absl::string_view message) override
ABSL_EXCLUSIVE_LOCKS_REQUIRED(chand_->work_serializer_) {
if (chand_->resolver_ == nullptr) return; // Shutting down.
@@ -1057,15 +1084,6 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
"Missing client channel factory in args for client channel filter");
return;
}
- // Get server name to resolve, using proxy mapper if needed.
- const char* server_uri =
- grpc_channel_args_find_string(args->channel_args, GRPC_ARG_SERVER_URI);
- if (server_uri == nullptr) {
- *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
- "server URI channel arg missing or wrong type in client channel "
- "filter");
- return;
- }
// Get default service config. If none is specified via the client API,
// we use an empty config.
const char* service_config_json = grpc_channel_args_find_string(
@@ -1078,30 +1096,50 @@ ClientChannel::ClientChannel(grpc_channel_element_args* args,
default_service_config_.reset();
return;
}
- absl::StatusOr uri = URI::Parse(server_uri);
- if (uri.ok() && !uri->path().empty()) {
- server_name_ = std::string(absl::StripPrefix(uri->path(), "/"));
+ // Get URI to resolve, using proxy mapper if needed.
+ const char* server_uri =
+ grpc_channel_args_find_string(args->channel_args, GRPC_ARG_SERVER_URI);
+ if (server_uri == nullptr) {
+ *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "target URI channel arg missing or wrong type in client channel "
+ "filter");
+ return;
}
+ uri_to_resolve_ = server_uri;
char* proxy_name = nullptr;
grpc_channel_args* new_args = nullptr;
ProxyMapperRegistry::MapName(server_uri, args->channel_args, &proxy_name,
&new_args);
- target_uri_.reset(proxy_name != nullptr ? proxy_name
- : gpr_strdup(server_uri));
+ if (proxy_name != nullptr) {
+ uri_to_resolve_ = proxy_name;
+ gpr_free(proxy_name);
+ }
+ // Make sure the URI to resolve is valid, so that we know that
+ // resolver creation will succeed later.
+ if (!ResolverRegistry::IsValidTarget(uri_to_resolve_)) {
+ *error = GRPC_ERROR_CREATE_FROM_CPP_STRING(
+ absl::StrCat("the target uri is not valid: ", uri_to_resolve_.c_str()));
+ return;
+ }
// Strip out service config channel arg, so that it doesn't affect
// subchannel uniqueness when the args flow down to that layer.
const char* arg_to_remove = GRPC_ARG_SERVICE_CONFIG;
channel_args_ = grpc_channel_args_copy_and_remove(
new_args != nullptr ? new_args : args->channel_args, &arg_to_remove, 1);
grpc_channel_args_destroy(new_args);
+ // Set initial keepalive time.
keepalive_time_ = grpc_channel_args_find_integer(
channel_args_, GRPC_ARG_KEEPALIVE_TIME_MS,
{-1 /* default value, unset */, 1, INT_MAX});
- if (!ResolverRegistry::IsValidTarget(target_uri_.get())) {
- *error = GRPC_ERROR_CREATE_FROM_CPP_STRING(
- absl::StrCat("the target uri is not valid: ", target_uri_.get()));
- return;
+ // Set default authority.
+ const char* default_authority =
+ grpc_channel_args_find_string(channel_args_, GRPC_ARG_DEFAULT_AUTHORITY);
+ if (default_authority == nullptr) {
+ default_authority_ = ResolverRegistry::GetDefaultAuthority(server_uri);
+ } else {
+ default_authority_ = default_authority;
}
+ // Success.
*error = GRPC_ERROR_NONE;
}
@@ -1527,8 +1565,8 @@ void ClientChannel::CreateResolverLocked() {
gpr_log(GPR_INFO, "chand=%p: starting name resolution", this);
}
resolver_ = ResolverRegistry::CreateResolver(
- target_uri_.get(), channel_args_, interested_parties_, work_serializer_,
- absl::make_unique(this));
+ uri_to_resolve_.c_str(), channel_args_, interested_parties_,
+ work_serializer_, absl::make_unique(this));
// Since the validity of the args was checked when the channel was created,
// CreateResolver() must return a non-null result.
GPR_ASSERT(resolver_ != nullptr);
diff --git a/src/core/ext/filters/client_channel/client_channel.h b/src/core/ext/filters/client_channel/client_channel.h
index a407c8fcce0..be53707836c 100644
--- a/src/core/ext/filters/client_channel/client_channel.h
+++ b/src/core/ext/filters/client_channel/client_channel.h
@@ -272,8 +272,8 @@ class ClientChannel {
ClientChannelFactory* client_channel_factory_;
const grpc_channel_args* channel_args_;
RefCountedPtr default_service_config_;
- std::string server_name_;
- UniquePtr target_uri_;
+ std::string uri_to_resolve_;
+ std::string default_authority_;
channelz::ChannelNode* channelz_node_;
grpc_pollset_set* interested_parties_;
diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h
index 721e829de76..eaaadf45abc 100644
--- a/src/core/ext/filters/client_channel/lb_policy.h
+++ b/src/core/ext/filters/client_channel/lb_policy.h
@@ -282,6 +282,9 @@ class LoadBalancingPolicy : public InternallyRefCounted {
/// Requests that the resolver re-resolve.
virtual void RequestReresolution() = 0;
+ /// Returns the channel authority.
+ virtual absl::string_view GetAuthority() = 0;
+
/// Adds a trace message associated with the channel.
enum TraceSeverity { TRACE_INFO, TRACE_WARNING, TRACE_ERROR };
virtual void AddTraceEvent(TraceSeverity severity,
diff --git a/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc b/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc
index a307ce6fdc4..1d0b1ef2fb8 100644
--- a/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc
@@ -90,6 +90,10 @@ class ChildPolicyHandler::Helper
parent_->channel_control_helper()->RequestReresolution();
}
+ absl::string_view GetAuthority() override {
+ return parent_->channel_control_helper()->GetAuthority();
+ }
+
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
if (parent_->shutting_down_) return;
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 b1a05aa87f1..777d3f0a819 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
@@ -352,6 +352,7 @@ class GrpcLb : public LoadBalancingPolicy {
void UpdateState(grpc_connectivity_state state, const absl::Status& status,
std::unique_ptr picker) override;
void RequestReresolution() override;
+ absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@@ -730,6 +731,10 @@ void GrpcLb::Helper::RequestReresolution() {
}
}
+absl::string_view GrpcLb::Helper::GetAuthority() {
+ return parent_->channel_control_helper()->GetAuthority();
+}
+
void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity,
absl::string_view message) {
if (parent_->shutting_down_) return;
diff --git a/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc b/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc
index a35ae2eaba0..45b8701b08e 100644
--- a/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc
@@ -162,6 +162,7 @@ class PriorityLb : public LoadBalancingPolicy {
const absl::Status& status,
std::unique_ptr picker) override;
void RequestReresolution() override;
+ absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@@ -740,14 +741,6 @@ void PriorityLb::ChildPriority::OnDeactivationTimerLocked(
// PriorityLb::ChildPriority::Helper
//
-void PriorityLb::ChildPriority::Helper::RequestReresolution() {
- if (priority_->priority_policy_->shutting_down_) return;
- if (priority_->ignore_reresolution_requests_) {
- return;
- }
- priority_->priority_policy_->channel_control_helper()->RequestReresolution();
-}
-
RefCountedPtr
PriorityLb::ChildPriority::Helper::CreateSubchannel(
ServerAddress address, const grpc_channel_args& args) {
@@ -764,6 +757,18 @@ void PriorityLb::ChildPriority::Helper::UpdateState(
priority_->OnConnectivityStateUpdateLocked(state, status, std::move(picker));
}
+void PriorityLb::ChildPriority::Helper::RequestReresolution() {
+ if (priority_->priority_policy_->shutting_down_) return;
+ if (priority_->ignore_reresolution_requests_) {
+ return;
+ }
+ priority_->priority_policy_->channel_control_helper()->RequestReresolution();
+}
+
+absl::string_view PriorityLb::ChildPriority::Helper::GetAuthority() {
+ return priority_->priority_policy_->channel_control_helper()->GetAuthority();
+}
+
void PriorityLb::ChildPriority::Helper::AddTraceEvent(
TraceSeverity severity, absl::string_view message) {
if (priority_->priority_policy_->shutting_down_) return;
diff --git a/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc b/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
index 86978708a61..82e16938d72 100644
--- a/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
@@ -150,6 +150,7 @@ class WeightedTargetLb : public LoadBalancingPolicy {
const absl::Status& status,
std::unique_ptr picker) override;
void RequestReresolution() override;
+ absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@@ -607,6 +608,11 @@ void WeightedTargetLb::WeightedChild::Helper::RequestReresolution() {
->RequestReresolution();
}
+absl::string_view WeightedTargetLb::WeightedChild::Helper::GetAuthority() {
+ return weighted_child_->weighted_target_policy_->channel_control_helper()
+ ->GetAuthority();
+}
+
void WeightedTargetLb::WeightedChild::Helper::AddTraceEvent(
TraceSeverity severity, absl::string_view message) {
if (weighted_child_->weighted_target_policy_->shutting_down_) return;
diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
index 3bbc8fe02f2..a1d74e0b86d 100644
--- a/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
@@ -123,6 +123,7 @@ class CdsLb : public LoadBalancingPolicy {
void UpdateState(grpc_connectivity_state state, const absl::Status& status,
std::unique_ptr picker) override;
void RequestReresolution() override;
+ absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@@ -261,6 +262,10 @@ void CdsLb::Helper::RequestReresolution() {
parent_->channel_control_helper()->RequestReresolution();
}
+absl::string_view CdsLb::Helper::GetAuthority() {
+ return parent_->channel_control_helper()->GetAuthority();
+}
+
void CdsLb::Helper::AddTraceEvent(TraceSeverity severity,
absl::string_view message) {
if (parent_->shutting_down_) return;
diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc
index bce03ce6f9e..c65fa330896 100644
--- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc
@@ -222,6 +222,7 @@ class XdsClusterImplLb : public LoadBalancingPolicy {
void UpdateState(grpc_connectivity_state state, const absl::Status& status,
std::unique_ptr picker) override;
void RequestReresolution() override;
+ absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@@ -576,6 +577,10 @@ void XdsClusterImplLb::Helper::RequestReresolution() {
xds_cluster_impl_policy_->channel_control_helper()->RequestReresolution();
}
+absl::string_view XdsClusterImplLb::Helper::GetAuthority() {
+ return xds_cluster_impl_policy_->channel_control_helper()->GetAuthority();
+}
+
void XdsClusterImplLb::Helper::AddTraceEvent(TraceSeverity severity,
absl::string_view message) {
if (xds_cluster_impl_policy_->shutting_down_) return;
diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc
index 214d0878564..14c7fc0f0b6 100644
--- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc
@@ -151,6 +151,7 @@ class XdsClusterManagerLb : public LoadBalancingPolicy {
const absl::Status& status,
std::unique_ptr picker) override;
void RequestReresolution() override;
+ absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@@ -570,6 +571,12 @@ void XdsClusterManagerLb::ClusterChild::Helper::RequestReresolution() {
->RequestReresolution();
}
+absl::string_view XdsClusterManagerLb::ClusterChild::Helper::GetAuthority() {
+ return xds_cluster_manager_child_->xds_cluster_manager_policy_
+ ->channel_control_helper()
+ ->GetAuthority();
+}
+
void XdsClusterManagerLb::ClusterChild::Helper::AddTraceEvent(
TraceSeverity severity, absl::string_view message) {
if (xds_cluster_manager_child_->xds_cluster_manager_policy_->shutting_down_) {
diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
index cfd1aef0775..422c8acf91d 100644
--- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
@@ -299,6 +299,7 @@ class XdsClusterResolverLb : public LoadBalancingPolicy {
// This is a no-op, because we get the addresses from the xds
// client, which is a watch-based API.
void RequestReresolution() override {}
+ absl::string_view GetAuthority() override;
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override;
@@ -380,6 +381,10 @@ void XdsClusterResolverLb::Helper::UpdateState(
state, status, std::move(picker));
}
+absl::string_view XdsClusterResolverLb::Helper::GetAuthority() {
+ return xds_cluster_resolver_policy_->channel_control_helper()->GetAuthority();
+}
+
void XdsClusterResolverLb::Helper::AddTraceEvent(TraceSeverity severity,
absl::string_view message) {
if (xds_cluster_resolver_policy_->shutting_down_) return;
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
index 39330c8977f..fee656d8388 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
@@ -47,7 +47,6 @@
#include "src/core/lib/iomgr/nameser.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/timer.h"
-#include "src/core/lib/transport/authority_override.h"
using grpc_core::ServerAddress;
using grpc_core::ServerAddressList;
@@ -670,8 +669,8 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/,
for (size_t i = 0; hostent->h_addr_list[i] != nullptr; ++i) {
absl::InlinedVector args_to_add;
if (hr->is_balancer) {
- args_to_add.emplace_back(
- grpc_core::CreateAuthorityOverrideChannelArg(hr->host));
+ args_to_add.emplace_back(grpc_channel_arg_string_create(
+ const_cast(GRPC_ARG_DEFAULT_AUTHORITY), hr->host));
}
grpc_channel_args* args = grpc_channel_args_copy_and_add(
nullptr, args_to_add.data(), args_to_add.size());
diff --git a/src/core/ext/transport/chttp2/client/authority.cc b/src/core/ext/transport/chttp2/client/authority.cc
deleted file mode 100644
index 8e4f8c1bbdf..00000000000
--- a/src/core/ext/transport/chttp2/client/authority.cc
+++ /dev/null
@@ -1,42 +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.
- *
- */
-
-#include
-
-#include "src/core/ext/transport/chttp2/client/authority.h"
-
-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;
- grpc_arg new_args[1];
- size_t num_new_args = 0;
- std::string 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);
- new_args[num_new_args++] = grpc_channel_arg_string_create(
- const_cast(GRPC_ARG_DEFAULT_AUTHORITY),
- const_cast(default_authority.c_str()));
- }
- return grpc_channel_args_copy_and_add(args, new_args, num_new_args);
-}
diff --git a/src/core/ext/transport/chttp2/client/authority.h b/src/core/ext/transport/chttp2/client/authority.h
deleted file mode 100644
index 642584ef566..00000000000
--- a/src/core/ext/transport/chttp2/client/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/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
index 9680a74e7d3..9a199366108 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
@@ -24,7 +24,6 @@
#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"
@@ -37,12 +36,7 @@ class Chttp2InsecureClientChannelFactory : public ClientChannelFactory {
RefCountedPtr CreateSubchannel(
const grpc_resolved_address& address,
const grpc_channel_args* args) override {
- grpc_channel_args* new_args =
- grpc_default_authority_add_if_not_present(args);
- RefCountedPtr s = Subchannel::Create(
- MakeOrphanable(), address, new_args);
- grpc_channel_args_destroy(new_args);
- return s;
+ return Subchannel::Create(MakeOrphanable(), address, args);
}
};
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 c76b6e96d37..ef8db979ea7 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
@@ -33,7 +33,6 @@
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/channel.h"
-#include "src/core/lib/transport/authority_override.h"
#include "src/core/lib/uri/uri_parser.h"
namespace grpc_core {
@@ -74,52 +73,29 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
return nullptr;
}
// Find the authority to use in the security connector.
- // First, check the authority override channel arg.
- // Otherwise, get it from the server name used to construct the
- // channel.
- std::string authority(FindAuthorityOverrideInArgs(args));
- if (authority.empty()) {
- const char* server_uri_str =
- grpc_channel_args_find_string(args, GRPC_ARG_SERVER_URI);
- GPR_ASSERT(server_uri_str != nullptr);
- authority = ResolverRegistry::GetDefaultAuthority(server_uri_str);
- }
- grpc_arg args_to_add[2];
- size_t num_args_to_add = 0;
- if (grpc_channel_args_find(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),
- const_cast(authority.c_str()));
- }
- grpc_channel_args* args_with_authority =
- grpc_channel_args_copy_and_add(args, args_to_add, num_args_to_add);
+ const char* authority =
+ grpc_channel_args_find_string(args, GRPC_ARG_DEFAULT_AUTHORITY);
+ GPR_ASSERT(authority != nullptr);
// Create the security connector using the credentials and target name.
grpc_channel_args* new_args_from_connector = nullptr;
RefCountedPtr
subchannel_security_connector =
channel_credentials->create_security_connector(
- /*call_creds=*/nullptr, authority.c_str(), args_with_authority,
+ /*call_creds=*/nullptr, authority, args,
&new_args_from_connector);
if (subchannel_security_connector == nullptr) {
gpr_log(GPR_ERROR,
"Failed to create secure subchannel for secure name '%s'",
- authority.c_str());
- grpc_channel_args_destroy(args_with_authority);
+ authority);
return nullptr;
}
grpc_arg new_security_connector_arg =
grpc_security_connector_to_arg(subchannel_security_connector.get());
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(
- new_args_from_connector != nullptr ? new_args_from_connector
- : args_with_authority,
+ new_args_from_connector != nullptr ? new_args_from_connector : args,
&new_security_connector_arg, 1);
subchannel_security_connector.reset(DEBUG_LOCATION, "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_channel_args_destroy(new_args_from_connector);
return new_args;
}
};
diff --git a/src/core/lib/transport/authority_override.cc b/src/core/lib/transport/authority_override.cc
deleted file mode 100644
index 668507250fe..00000000000
--- a/src/core/lib/transport/authority_override.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Copyright 2020 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 "absl/strings/string_view.h"
-
-#include "src/core/lib/channel/channel_args.h"
-
-// Channel arg key for the authority override.
-#define GRPC_ARG_AUTHORITY_OVERRIDE "grpc.authority_override"
-
-namespace grpc_core {
-
-grpc_arg CreateAuthorityOverrideChannelArg(const char* authority) {
- return grpc_channel_arg_string_create(
- const_cast(GRPC_ARG_AUTHORITY_OVERRIDE),
- const_cast(authority));
-}
-
-absl::string_view FindAuthorityOverrideInArgs(const grpc_channel_args* args) {
- const char* found =
- grpc_channel_args_find_string(args, GRPC_ARG_AUTHORITY_OVERRIDE);
- return found == nullptr ? "" : found;
-}
-
-} // namespace grpc_core
diff --git a/src/core/lib/transport/authority_override.h b/src/core/lib/transport/authority_override.h
deleted file mode 100644
index 7af6526e0a3..00000000000
--- a/src/core/lib/transport/authority_override.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright 2020 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_TRANSPORT_AUTHORITY_OVERRIDE_H
-#define GRPC_CORE_LIB_TRANSPORT_AUTHORITY_OVERRIDE_H
-
-#include
-
-#include "absl/strings/string_view.h"
-
-#include
-
-namespace grpc_core {
-
-/// Returns a channel argument containing \a authority.
-grpc_arg CreateAuthorityOverrideChannelArg(const char* authority);
-
-/// Returns the authority override from \a args or the empty string. The return
-/// value is a string_view into the `args` data structure.
-absl::string_view FindAuthorityOverrideInArgs(const grpc_channel_args* args);
-
-} // namespace grpc_core
-
-#endif /* GRPC_CORE_LIB_TRANSPORT_AUTHORITY_OVERRIDE_H */
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index 087c9b512cc..710a65d8378 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -91,7 +91,6 @@ CORE_SOURCE_FILES = [
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc',
'src/core/ext/filters/workarounds/workaround_utils.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
- 'src/core/ext/transport/chttp2/client/authority.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
@@ -599,7 +598,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/surface/server.cc',
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/version.cc',
- 'src/core/lib/transport/authority_override.cc',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/byte_stream.cc',
'src/core/lib/transport/connectivity_state.cc',
diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc
index cb5e5162e76..5ceefba485c 100644
--- a/test/core/util/test_lb_policies.cc
+++ b/test/core/util/test_lb_policies.cc
@@ -138,6 +138,10 @@ class TestPickArgsLb : public ForwardingLoadBalancingPolicy {
parent_->channel_control_helper()->RequestReresolution();
}
+ absl::string_view GetAuthority() override {
+ return parent_->channel_control_helper()->GetAuthority();
+ }
+
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
parent_->channel_control_helper()->AddTraceEvent(severity, message);
@@ -252,6 +256,10 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy
parent_->channel_control_helper()->RequestReresolution();
}
+ absl::string_view GetAuthority() override {
+ return parent_->channel_control_helper()->GetAuthority();
+ }
+
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
parent_->channel_control_helper()->AddTraceEvent(severity, message);
@@ -365,6 +373,10 @@ class AddressTestLoadBalancingPolicy : public ForwardingLoadBalancingPolicy {
parent_->channel_control_helper()->RequestReresolution();
}
+ absl::string_view GetAuthority() override {
+ return parent_->channel_control_helper()->GetAuthority();
+ }
+
void AddTraceEvent(TraceSeverity severity,
absl::string_view message) override {
parent_->channel_control_helper()->AddTraceEvent(severity, message);
diff --git a/test/cpp/client/client_channel_stress_test.cc b/test/cpp/client/client_channel_stress_test.cc
index 6a1b2efc835..24c919083fa 100644
--- a/test/cpp/client/client_channel_stress_test.cc
+++ b/test/cpp/client/client_channel_stress_test.cc
@@ -45,7 +45,6 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/sockaddr.h"
-#include "src/core/lib/transport/authority_override.h"
#include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
@@ -228,8 +227,9 @@ class ClientChannelStressTest {
GPR_ASSERT(lb_uri.ok());
grpc_resolved_address address;
GPR_ASSERT(grpc_parse_uri(*lb_uri, &address));
- grpc_arg arg = grpc_core::CreateAuthorityOverrideChannelArg(
- addr.balancer_name.c_str());
+ grpc_arg arg = grpc_channel_arg_string_create(
+ const_cast(GRPC_ARG_DEFAULT_AUTHORITY),
+ const_cast(addr.balancer_name.c_str()));
grpc_channel_args* args =
grpc_channel_args_copy_and_add(nullptr, &arg, 1);
addresses.emplace_back(address.addr, address.len, args);
diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc
index 9f0dddb769d..8043390211a 100644
--- a/test/cpp/end2end/grpclb_end2end_test.cc
+++ b/test/cpp/end2end/grpclb_end2end_test.cc
@@ -52,7 +52,6 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
-#include "src/core/lib/transport/authority_override.h"
#include "src/cpp/client/secure_credentials.h"
#include "src/cpp/server/secure_server_credentials.h"
#include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h"
@@ -546,8 +545,9 @@ class GrpclbEnd2endTest : public ::testing::Test {
GPR_ASSERT(lb_uri.ok());
grpc_resolved_address address;
GPR_ASSERT(grpc_parse_uri(*lb_uri, &address));
- grpc_arg arg = grpc_core::CreateAuthorityOverrideChannelArg(
- addr.balancer_name.c_str());
+ grpc_arg arg = grpc_channel_arg_string_create(
+ const_cast(GRPC_ARG_DEFAULT_AUTHORITY),
+ const_cast(addr.balancer_name.c_str()));
grpc_channel_args* args =
grpc_channel_args_copy_and_add(nullptr, &arg, 1);
addresses.emplace_back(address.addr, address.len, args);
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index a54b9adf997..606f311189e 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -1183,8 +1183,6 @@ src/core/ext/filters/workarounds/workaround_utils.cc \
src/core/ext/filters/workarounds/workaround_utils.h \
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/channel_create.cc \
@@ -2149,8 +2147,6 @@ src/core/lib/surface/server.h \
src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/validate_metadata.h \
src/core/lib/surface/version.cc \
-src/core/lib/transport/authority_override.cc \
-src/core/lib/transport/authority_override.h \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/bdp_estimator.h \
src/core/lib/transport/byte_stream.cc \
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index 3957adc2ce5..80edc9d5d58 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -1013,8 +1013,6 @@ src/core/ext/transport/binder/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 \
@@ -1991,8 +1989,6 @@ src/core/lib/surface/validate_metadata.cc \
src/core/lib/surface/validate_metadata.h \
src/core/lib/surface/version.cc \
src/core/lib/transport/README.md \
-src/core/lib/transport/authority_override.cc \
-src/core/lib/transport/authority_override.h \
src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/bdp_estimator.h \
src/core/lib/transport/byte_stream.cc \