mirror of https://github.com/grpc/grpc-dart.git
Allow for non ascii headers (#103)
This commit is contained in:
parent
238fd7ec67
commit
17ce11f7fc
|
@ -1,3 +1,7 @@
|
|||
## 0.6.2 - 2018-07-19
|
||||
|
||||
* Allow for non-ascii header values.
|
||||
|
||||
## 0.6.1 - 2018-07-13
|
||||
|
||||
* More fixes to update to Dart 2 core library APIs.
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:http2/transport.dart';
|
||||
|
@ -78,8 +79,8 @@ class ClientConnection {
|
|||
final headers = [
|
||||
_methodPost,
|
||||
useTls ? _schemeHttps : _schemeHttp,
|
||||
new Header.ascii(':path', path),
|
||||
new Header.ascii(':authority', authority),
|
||||
new Header(ascii.encode(':path'), utf8.encode(path)),
|
||||
new Header(ascii.encode(':authority'), utf8.encode(authority)),
|
||||
];
|
||||
if (timeout != null) {
|
||||
headers.add(new Header.ascii('grpc-timeout', toTimeoutString(timeout)));
|
||||
|
@ -91,7 +92,7 @@ class ClientConnection {
|
|||
_userAgent,
|
||||
]);
|
||||
metadata?.forEach((key, value) {
|
||||
headers.add(new Header.ascii(key, value));
|
||||
headers.add(new Header(ascii.encode(key), utf8.encode(value)));
|
||||
});
|
||||
return headers;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:http2/transport.dart';
|
||||
|
||||
|
@ -268,8 +269,8 @@ class ServerHandler extends ServiceCall {
|
|||
_customHeaders = null;
|
||||
|
||||
final outgoingHeaders = <Header>[];
|
||||
outgoingHeadersMap.forEach(
|
||||
(key, value) => outgoingHeaders.add(new Header.ascii(key, value)));
|
||||
outgoingHeadersMap.forEach((key, value) =>
|
||||
outgoingHeaders.add(new Header(ascii.encode(key), utf8.encode(value))));
|
||||
_stream.sendHeaders(outgoingHeaders);
|
||||
_headersSent = true;
|
||||
}
|
||||
|
@ -296,8 +297,8 @@ class ServerHandler extends ServiceCall {
|
|||
}
|
||||
|
||||
final outgoingTrailers = <Header>[];
|
||||
outgoingTrailersMap.forEach(
|
||||
(key, value) => outgoingTrailers.add(new Header.ascii(key, value)));
|
||||
outgoingTrailersMap.forEach((key, value) =>
|
||||
outgoingTrailers.add(new Header(ascii.encode(key), utf8.encode(value))));
|
||||
_stream.sendHeaders(outgoingTrailers, endStream: true);
|
||||
// We're done!
|
||||
_cancelResponseSubscription();
|
||||
|
|
|
@ -60,7 +60,7 @@ class GrpcHttpEncoder extends Converter<GrpcMessage, StreamMessage> {
|
|||
if (input is GrpcMetadata) {
|
||||
final headers = <Header>[];
|
||||
input.metadata.forEach((key, value) {
|
||||
headers.add(new Header.ascii(key, value));
|
||||
headers.add(new Header(ascii.encode(key), utf8.encode(value)));
|
||||
});
|
||||
return new HeadersStreamMessage(headers);
|
||||
} else if (input is GrpcData) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: grpc
|
||||
description: Dart implementation of gRPC.
|
||||
version: 0.6.1
|
||||
version: 0.6.2
|
||||
author: Dart Team <misc@dartlang.org>
|
||||
homepage: https://github.com/dart-lang/grpc-dart
|
||||
|
||||
|
|
Loading…
Reference in New Issue