mirror of https://github.com/grpc/grpc-dart.git
Fix use of authority when making a secure connection
This commit is contained in:
parent
78dcb0f4f1
commit
b7be3af34b
|
@ -1,3 +1,8 @@
|
|||
## 2.1.1
|
||||
|
||||
* Fix bug introduced in 2.1.0 where an explicit `authority` would not be used when making a secure
|
||||
connection.
|
||||
|
||||
## 2.1.0
|
||||
|
||||
* Do a health check of the http2-connection before making request.
|
||||
|
|
|
@ -77,19 +77,13 @@ class Http2ClientConnection implements connection.ClientConnection {
|
|||
|
||||
Future<ClientTransportConnection> connectTransport() async {
|
||||
final securityContext = credentials.securityContext;
|
||||
Socket socket;
|
||||
if (securityContext == null) {
|
||||
socket = await Socket.connect(host, port);
|
||||
} else {
|
||||
socket = await SecureSocket.connect(host, port,
|
||||
supportedProtocols: ['h2'],
|
||||
Socket socket = await Socket.connect(host, port);
|
||||
if (securityContext != null) {
|
||||
// Todo(sigurdm): We want to pass supportedProtocols: ['h2']. http://dartbug.com/37950
|
||||
socket = await SecureSocket.secure(socket,
|
||||
host: authority,
|
||||
context: securityContext,
|
||||
onBadCertificate: _validateBadCertificate);
|
||||
if ((socket as SecureSocket).selectedProtocol != 'h2') {
|
||||
socket.destroy();
|
||||
throw (TransportException(
|
||||
'Endpoint $host:$port does not support http/2 via ALPN'));
|
||||
}
|
||||
}
|
||||
|
||||
final connection = ClientTransportConnection.viaSocket(socket);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name: grpc
|
||||
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
|
||||
|
||||
version: 2.1.0
|
||||
version: 2.1.1
|
||||
|
||||
author: Dart Team <misc@dartlang.org>
|
||||
homepage: https://github.com/dart-lang/grpc-dart
|
||||
|
|
Loading…
Reference in New Issue