aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2018-12-21 11:12:46 +0100
committerGravatar GitHub <noreply@github.com>2018-12-21 11:12:46 +0100
commit95511c0cfd13a85a83e2d457b75fcc8c201adb33 (patch)
treeddc0f19e93f41b51a4dbef1b452ef98cc1c5613f /src
parent102d5d88a626e29f1dccc4ffdb977d1bcd7a5937 (diff)
parentdcb194c6e3836e57ca41ef13ab1ee633590a5af4 (diff)
Merge pull request #17407 from jtattermusch/interop_csharp_sni_fix
better testing of SNI for C-based languages
Diffstat (limited to 'src')
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClient.cs2
-rwxr-xr-xsrc/php/tests/interop/interop_client.php8
-rw-r--r--src/python/grpcio_tests/tests/interop/client.py12
-rw-r--r--src/python/grpcio_tests/tests/stress/client.py1
-rwxr-xr-xsrc/ruby/pb/test/client.rb17
5 files changed, 23 insertions, 17 deletions
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
index e83a8a7274..4750353082 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
@@ -45,7 +45,7 @@ namespace Grpc.IntegrationTesting
[Option("server_host", Default = "localhost")]
public string ServerHost { get; set; }
- [Option("server_host_override", Default = TestCredentials.DefaultHostOverride)]
+ [Option("server_host_override")]
public string ServerHostOverride { get; set; }
[Option("server_port", Required = true)]
diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php
index c865678f70..19cbf21bc2 100755
--- a/src/php/tests/interop/interop_client.php
+++ b/src/php/tests/interop/interop_client.php
@@ -530,7 +530,7 @@ function _makeStub($args)
throw new Exception('Missing argument: --test_case is required');
}
- if ($args['server_port'] === 443) {
+ if ($args['server_port'] === '443') {
$server_address = $args['server_host'];
} else {
$server_address = $args['server_host'].':'.$args['server_port'];
@@ -538,7 +538,7 @@ function _makeStub($args)
$test_case = $args['test_case'];
- $host_override = 'foo.test.google.fr';
+ $host_override = '';
if (array_key_exists('server_host_override', $args)) {
$host_override = $args['server_host_override'];
}
@@ -565,7 +565,9 @@ function _makeStub($args)
$ssl_credentials = Grpc\ChannelCredentials::createSsl();
}
$opts['credentials'] = $ssl_credentials;
- $opts['grpc.ssl_target_name_override'] = $host_override;
+ if (!empty($host_override)) {
+ $opts['grpc.ssl_target_name_override'] = $host_override;
+ }
} else {
$opts['credentials'] = Grpc\ChannelCredentials::createInsecure();
}
diff --git a/src/python/grpcio_tests/tests/interop/client.py b/src/python/grpcio_tests/tests/interop/client.py
index 698c37017f..56cb29477c 100644
--- a/src/python/grpcio_tests/tests/interop/client.py
+++ b/src/python/grpcio_tests/tests/interop/client.py
@@ -54,7 +54,6 @@ def _args():
help='replace platform root CAs with ca.pem')
parser.add_argument(
'--server_host_override',
- default="foo.test.google.fr",
type=str,
help='the server host to which to claim to connect')
parser.add_argument(
@@ -100,10 +99,13 @@ def _stub(args):
channel_credentials = grpc.composite_channel_credentials(
channel_credentials, call_credentials)
- channel = grpc.secure_channel(target, channel_credentials, ((
- 'grpc.ssl_target_name_override',
- args.server_host_override,
- ),))
+ channel_opts = None
+ if args.server_host_override:
+ channel_opts = ((
+ 'grpc.ssl_target_name_override',
+ args.server_host_override,
+ ),)
+ channel = grpc.secure_channel(target, channel_credentials, channel_opts)
else:
channel = grpc.insecure_channel(target)
if args.test_case == "unimplemented_service":
diff --git a/src/python/grpcio_tests/tests/stress/client.py b/src/python/grpcio_tests/tests/stress/client.py
index a318b308e6..4c35b05044 100644
--- a/src/python/grpcio_tests/tests/stress/client.py
+++ b/src/python/grpcio_tests/tests/stress/client.py
@@ -71,7 +71,6 @@ def _args():
'--use_tls', help='Whether to use TLS', default=False, type=bool)
parser.add_argument(
'--server_host_override',
- default="foo.test.google.fr",
help='the server host to which to claim to connect',
type=str)
return parser.parse_args()
diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb
index b2303c6e14..03f3d9001a 100755
--- a/src/ruby/pb/test/client.rb
+++ b/src/ruby/pb/test/client.rb
@@ -111,10 +111,13 @@ def create_stub(opts)
if opts.secure
creds = ssl_creds(opts.use_test_ca)
stub_opts = {
- channel_args: {
- GRPC::Core::Channel::SSL_TARGET => opts.server_host_override
- }
+ channel_args: {}
}
+ unless opts.server_host_override.empty?
+ stub_opts[:channel_args].merge!({
+ GRPC::Core::Channel::SSL_TARGET => opts.server_host_override
+ })
+ end
# Add service account creds if specified
wants_creds = %w(all compute_engine_creds service_account_creds)
@@ -603,7 +606,7 @@ class NamedTests
if not op.metadata.has_key?(initial_metadata_key)
fail AssertionError, "Expected initial metadata. None received"
elsif op.metadata[initial_metadata_key] != metadata[initial_metadata_key]
- fail AssertionError,
+ fail AssertionError,
"Expected initial metadata: #{metadata[initial_metadata_key]}. "\
"Received: #{op.metadata[initial_metadata_key]}"
end
@@ -611,7 +614,7 @@ class NamedTests
fail AssertionError, "Expected trailing metadata. None received"
elsif op.trailing_metadata[trailing_metadata_key] !=
metadata[trailing_metadata_key]
- fail AssertionError,
+ fail AssertionError,
"Expected trailing metadata: #{metadata[trailing_metadata_key]}. "\
"Received: #{op.trailing_metadata[trailing_metadata_key]}"
end
@@ -639,7 +642,7 @@ class NamedTests
fail AssertionError, "Expected trailing metadata. None received"
elsif duplex_op.trailing_metadata[trailing_metadata_key] !=
metadata[trailing_metadata_key]
- fail AssertionError,
+ fail AssertionError,
"Expected trailing metadata: #{metadata[trailing_metadata_key]}. "\
"Received: #{duplex_op.trailing_metadata[trailing_metadata_key]}"
end
@@ -710,7 +713,7 @@ Args = Struct.new(:default_service_account, :server_host, :server_host_override,
# validates the command line options, returning them as a Hash.
def parse_args
args = Args.new
- args.server_host_override = 'foo.test.google.fr'
+ args.server_host_override = ''
OptionParser.new do |opts|
opts.on('--oauth_scope scope',
'Scope for OAuth tokens') { |v| args['oauth_scope'] = v }