Provide scheme as part of audience (#211)

This commit is contained in:
Sigurd Meldgaard 2019-06-28 15:24:59 +02:00 committed by GitHub
parent 6d485375ba
commit 9d2a469655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,7 @@
## 2.0.2
* Fix computation of the audience given to metadata providers to include the scheme.
## 2.0.1
* Fix computation of authority. This should fix authorization.

View File

@ -150,7 +150,7 @@ class ClientCall<Q, R> implements Response {
Future.forEach(
options.metadataProviders,
(provider) => provider(
metadata, "${connection.authority}${audiencePath(_method)}"))
metadata, '${connection.scheme}://${connection.authority}${audiencePath(_method)}'))
.then((_) => _sendRequest(connection, _sanitizeMetadata(metadata)))
.catchError(_onMetadataProviderError);
}

View File

@ -38,6 +38,7 @@ enum ConnectionState {
abstract class ClientConnection {
String get authority;
String get scheme;
/// Put [call] on the queue to be dispatched when the connection is ready.
void dispatchCall(ClientCall call);

View File

@ -65,6 +65,8 @@ class Http2ClientConnection implements connection.ClientConnection {
String get authority =>
options.credentials.authority ?? (port == 443 ? host : "$host:$port");
String get scheme => options.credentials.isSecure ? 'https' : 'http';
ConnectionState get state => _state;
Future<ClientTransportConnection> connectTransport() async {

View File

@ -143,6 +143,7 @@ class XhrClientConnection extends ClientConnection {
XhrClientConnection(this.uri);
String get authority => uri.authority;
String get scheme => uri.scheme;
void _initializeRequest(HttpRequest request, Map<String, String> metadata) {
for (final header in metadata.keys) {

View File

@ -1,7 +1,7 @@
name: grpc
description: Dart implementation of gRPC, a high performance, open-source universal RPC framework.
version: 2.0.1
version: 2.0.2
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/grpc-dart