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
|
## 2.1.0
|
||||||
|
|
||||||
* Do a health check of the http2-connection before making request.
|
* Do a health check of the http2-connection before making request.
|
||||||
|
|
|
@ -77,19 +77,13 @@ class Http2ClientConnection implements connection.ClientConnection {
|
||||||
|
|
||||||
Future<ClientTransportConnection> connectTransport() async {
|
Future<ClientTransportConnection> connectTransport() async {
|
||||||
final securityContext = credentials.securityContext;
|
final securityContext = credentials.securityContext;
|
||||||
Socket socket;
|
Socket socket = await Socket.connect(host, port);
|
||||||
if (securityContext == null) {
|
if (securityContext != null) {
|
||||||
socket = await Socket.connect(host, port);
|
// Todo(sigurdm): We want to pass supportedProtocols: ['h2']. http://dartbug.com/37950
|
||||||
} else {
|
socket = await SecureSocket.secure(socket,
|
||||||
socket = await SecureSocket.connect(host, port,
|
host: authority,
|
||||||
supportedProtocols: ['h2'],
|
|
||||||
context: securityContext,
|
context: securityContext,
|
||||||
onBadCertificate: _validateBadCertificate);
|
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);
|
final connection = ClientTransportConnection.viaSocket(socket);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: grpc
|
name: grpc
|
||||||
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
|
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>
|
author: Dart Team <misc@dartlang.org>
|
||||||
homepage: https://github.com/dart-lang/grpc-dart
|
homepage: https://github.com/dart-lang/grpc-dart
|
||||||
|
|
Loading…
Reference in New Issue