Skip to content

Commit 32d5ffc

Browse files
authored
Merge pull request #1745 from dart-lang/revTo3
Update to Dart `3.7.0`
2 parents 1cc17f8 + 4afc7f4 commit 32d5ffc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2375
-1413
lines changed

.github/workflows/http2.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,14 @@ jobs:
4545
run: dart analyze --fatal-infos
4646
if: always() && steps.install.outcome == 'success'
4747

48-
# Run tests on a matrix consisting of two dimensions:
49-
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
50-
# 2. release channel: dev
5148
test:
5249
needs: analyze
5350
runs-on: ${{ matrix.os }}
5451
strategy:
5552
fail-fast: false
5653
matrix:
57-
# Add macos-latest and/or windows-latest if relevant for this package.
5854
os: [ubuntu-latest]
59-
sdk: [3.2, dev]
55+
sdk: [3.7, stable, dev]
6056
steps:
6157
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
6258
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c

pkgs/http2/CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## 2.3.2-wip
1+
## 3.0.0-wip
2+
3+
- Require Dart SDK `3.7.0`.
24

35
## 2.3.1
46

pkgs/http2/example/display_headers.dart

+9-4
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,16 @@ void main(List<String> args) async {
5454
Future<Socket> connect(Uri uri) async {
5555
var useSSL = uri.scheme == 'https';
5656
if (useSSL) {
57-
var secureSocket = await SecureSocket.connect(uri.host, uri.port,
58-
supportedProtocols: ['h2']);
57+
var secureSocket = await SecureSocket.connect(
58+
uri.host,
59+
uri.port,
60+
supportedProtocols: ['h2'],
61+
);
5962
if (secureSocket.selectedProtocol != 'h2') {
60-
throw Exception('Failed to negogiate http/2 via alpn. Maybe server '
61-
"doesn't support http/2.");
63+
throw Exception(
64+
'Failed to negogiate http/2 via alpn. Maybe server '
65+
"doesn't support http/2.",
66+
);
6267
}
6368
return secureSocket;
6469
} else {

pkgs/http2/lib/multiprotocol_server.dart

+29-17
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ class MultiProtocolHttpServer {
3131
final _http2Connections = <http2.ServerTransportConnection>{};
3232

3333
MultiProtocolHttpServer._(this._serverSocket, this._settings) {
34-
_http11Controller =
35-
_ServerSocketController(_serverSocket.address, _serverSocket.port);
34+
_http11Controller = _ServerSocketController(
35+
_serverSocket.address,
36+
_serverSocket.port,
37+
);
3638
_http11Server = HttpServer.listenOn(_http11Controller.stream);
3739
}
3840

@@ -45,8 +47,11 @@ class MultiProtocolHttpServer {
4547
///
4648
/// See also [startServing].
4749
static Future<MultiProtocolHttpServer> bind(
48-
Object? address, int port, SecurityContext context,
49-
{http2.ServerSettings? settings}) async {
50+
Object? address,
51+
int port,
52+
SecurityContext context, {
53+
http2.ServerSettings? settings,
54+
}) async {
5055
context.setAlpnProtocols(['h2', 'h2-14', 'http/1.1'], true);
5156
var secureServer = await SecureServerSocket.bind(address, port, context);
5257
return MultiProtocolHttpServer._(secureServer, settings);
@@ -63,21 +68,27 @@ class MultiProtocolHttpServer {
6368
///
6469
/// It is expected that [callbackHttp11] and [callbackHttp2] will never throw
6570
/// an exception (i.e. these must take care of error handling themselves).
66-
void startServing(void Function(HttpRequest) callbackHttp11,
67-
void Function(http2.ServerTransportStream) callbackHttp2,
68-
{void Function(dynamic error, StackTrace)? onError}) {
71+
void startServing(
72+
void Function(HttpRequest) callbackHttp11,
73+
void Function(http2.ServerTransportStream) callbackHttp2, {
74+
void Function(dynamic error, StackTrace)? onError,
75+
}) {
6976
// 1. Start listening on the real [SecureServerSocket].
7077
_serverSocket.listen((SecureSocket socket) {
7178
var protocol = socket.selectedProtocol;
7279
if (protocol == null || protocol == 'http/1.1') {
7380
_http11Controller.addHttp11Socket(socket);
7481
} else if (protocol == 'h2' || protocol == 'h2-14') {
75-
var connection = http2.ServerTransportConnection.viaSocket(socket,
76-
settings: _settings);
82+
var connection = http2.ServerTransportConnection.viaSocket(
83+
socket,
84+
settings: _settings,
85+
);
7786
_http2Connections.add(connection);
78-
connection.incomingStreams.listen(_http2Controller.add,
79-
onError: onError,
80-
onDone: () => _http2Connections.remove(connection));
87+
connection.incomingStreams.listen(
88+
_http2Controller.add,
89+
onError: onError,
90+
onDone: () => _http2Connections.remove(connection),
91+
);
8192
} else {
8293
socket.destroy();
8394
throw Exception('Unexpected negotiated ALPN protocol: $protocol.');
@@ -93,11 +104,12 @@ class MultiProtocolHttpServer {
93104
/// Closes this [MultiProtocolHttpServer].
94105
///
95106
/// Completes once everything has been successfully shut down.
96-
Future close({bool force = false}) =>
97-
_serverSocket.close().whenComplete(() => Future.wait([
98-
_http11Server.close(force: force),
99-
for (var c in _http2Connections) force ? c.terminate() : c.finish()
100-
]));
107+
Future close({bool force = false}) => _serverSocket.close().whenComplete(
108+
() => Future.wait([
109+
_http11Server.close(force: force),
110+
for (var c in _http2Connections) force ? c.terminate() : c.finish(),
111+
]),
112+
);
101113
}
102114

103115
/// An internal helper class.

pkgs/http2/lib/src/artificial_server_socket.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'dart:io';
1414
class ArtificialServerSocket extends StreamView<Socket>
1515
implements ServerSocket {
1616
ArtificialServerSocket(this.address, this.port, Stream<Socket> stream)
17-
: super(stream);
17+
: super(stream);
1818

1919
// ########################################################################
2020
// These are the methods of [ServerSocket] in addition to [Stream<Socket>].

pkgs/http2/lib/src/async_utils/async_utils.dart

+7-4
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ class BufferedSink {
6868
// Currently `_doneFuture` will just complete normally if the sink
6969
// cancelled.
7070
};
71-
_doneFuture =
72-
Future.wait([_controller.stream.pipe(dataSink), dataSink.done]);
71+
_doneFuture = Future.wait([
72+
_controller.stream.pipe(dataSink),
73+
dataSink.done,
74+
]);
7375
}
7476

7577
/// The underlying sink.
@@ -88,7 +90,7 @@ class BufferedBytesWriter {
8890
final BufferedSink _bufferedSink;
8991

9092
BufferedBytesWriter(StreamSink<List<int>> outgoing)
91-
: _bufferedSink = BufferedSink(outgoing);
93+
: _bufferedSink = BufferedSink(outgoing);
9294

9395
/// An indicator whether the underlying sink is buffering at the moment.
9496
BufferIndicator get bufferIndicator => _bufferedSink.bufferIndicator;
@@ -100,7 +102,8 @@ class BufferedBytesWriter {
100102
void add(List<int> data) {
101103
if (_builder.length > 0) {
102104
throw StateError(
103-
'Cannot trigger an asynchronous write while there is buffered data.');
105+
'Cannot trigger an asynchronous write while there is buffered data.',
106+
);
104107
}
105108
_bufferedSink.sink.add(data);
106109
}

0 commit comments

Comments
 (0)