From 20352dd718c84574c23018b878149bd991c3cdc2 Mon Sep 17 00:00:00 2001 From: Sigurd Meldgaard Date: Mon, 9 Sep 2019 08:41:56 +0100 Subject: [PATCH] Use host without port as authority when making secure connection (#238) --- CHANGELOG.md | 5 +++++ lib/src/client/http2_connection.dart | 6 +++++- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aae8a88..3698aae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.1.2 + +* Fix bug introduced in 2.1.1 where the port would be added to the default authority when making a + secure connection. + ## 2.1.1 * Fix bug introduced in 2.1.0 where an explicit `authority` would not be used when making a secure diff --git a/lib/src/client/http2_connection.dart b/lib/src/client/http2_connection.dart index 81886e3..9e34abb 100644 --- a/lib/src/client/http2_connection.dart +++ b/lib/src/client/http2_connection.dart @@ -81,7 +81,11 @@ class Http2ClientConnection implements connection.ClientConnection { if (securityContext != null) { // Todo(sigurdm): We want to pass supportedProtocols: ['h2']. http://dartbug.com/37950 socket = await SecureSocket.secure(socket, - host: authority, + // This is not really the host, but the authority to verify the TLC + // connection against. + // + // We don't use `this.authority` here, as that includes the port. + host: options.credentials.authority ?? host, context: securityContext, onBadCertificate: _validateBadCertificate); } diff --git a/pubspec.yaml b/pubspec.yaml index 28682ed..92168a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: grpc description: Dart implementation of gRPC, a high performance, open-source universal RPC framework. -version: 2.1.1 +version: 2.1.2 author: Dart Team homepage: https://github.com/dart-lang/grpc-dart