From 816ac38a94f1ff45847b7b35fdb3e51715ce6603 Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" Date: Thu, 5 Jun 2014 00:43:37 +0000 Subject: [PATCH 001/107] Add an http_multi_server package. This package supports using the same server class for multiple bound interfaces. In particular, it's useful for binding both IPv4 and IPv6 loopback interfaces. R=rnystrom@google.com BUG=19147 Review URL: https://codereview.chromium.org//311233004 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37023 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/README.md | 25 ++++ .../lib/http_multi_server.dart | 136 ++++++++++++++++++ pkgs/http_multi_server/lib/src/utils.dart | 62 ++++++++ pkgs/http_multi_server/pubspec.yaml | 11 ++ .../test/http_multi_server_test.dart | 128 +++++++++++++++++ 5 files changed, 362 insertions(+) create mode 100644 pkgs/http_multi_server/README.md create mode 100644 pkgs/http_multi_server/lib/http_multi_server.dart create mode 100644 pkgs/http_multi_server/lib/src/utils.dart create mode 100644 pkgs/http_multi_server/pubspec.yaml create mode 100644 pkgs/http_multi_server/test/http_multi_server_test.dart diff --git a/pkgs/http_multi_server/README.md b/pkgs/http_multi_server/README.md new file mode 100644 index 0000000000..e12c8d1cce --- /dev/null +++ b/pkgs/http_multi_server/README.md @@ -0,0 +1,25 @@ +An implementation of `dart:io`'s [HttpServer][] that wraps multiple servers and +forwards methods to all of them. It's useful for serving the same application on +multiple network interfaces while still having a unified way of controlling the +servers. In particular, it supports serving on both the IPv4 and IPv6 loopback +addresses using [HttpMultiServer.loopback][]. + +```dart +import 'package:http_multi_server/http_multi_server.dart'; +import 'package:shelf/shelf.dart' as shelf; +import 'package:shelf/shelf_io.dart' as shelf_io; + +void main() { + // Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same + // server. + HttpMultiServer.loopback(8080).then((server) { + shelf_io.serveRequests(server, (request) { + return new shelf.Response.ok("Hello, world!"); + }); + }); +} +``` + +[HttpServer]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart-io.HttpServer + +[HttpMultiServer.loopback]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/http_multi_server/http_multi_server.HttpMultiServer#id_loopback diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart new file mode 100644 index 0000000000..c055367dc8 --- /dev/null +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -0,0 +1,136 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library http_multi_server; + +import 'dart:async'; +import 'dart:io'; + +import 'src/utils.dart'; + +/// An implementation of `dart:io`'s [HttpServer] that wraps multiple servers +/// and forwards methods to all of them. +/// +/// This is useful for serving the same application on multiple network +/// interfaces while still having a unified way of controlling the servers. In +/// particular, it supports serving on both the IPv4 and IPv6 loopback addresses +/// using [HttpMultiServer.loopback]. +class HttpMultiServer extends StreamView implements HttpServer { + /// The wrapped servers. + final Set _servers; + + String get serverHeader => _servers.first.serverHeader; + set serverHeader(String value) { + for (var server in _servers) { + server.serverHeader = value; + } + } + + Duration get idleTimeout => _servers.first.idleTimeout; + set idleTimeout(Duration value) { + for (var server in _servers) { + server.idleTimeout = value; + } + } + + /// Returns the port that one of the wrapped servers is listening on. + /// + /// If the wrapped servers are listening on different ports, it's not defined + /// which port is returned. + int get port => _servers.first.port; + + /// Returns the address that one of the wrapped servers is listening on. + /// + /// If the wrapped servers are listening on different addresses, it's not + /// defined which address is returned. + InternetAddress get address => _servers.first.address; + + set sessionTimeout(int value) { + for (var server in _servers) { + server.sessionTimeout = value; + } + } + + /// Creates an [HttpMultiServer] wrapping [servers]. + /// + /// All [servers] should have the same configuration and none should be + /// listened to when this is called. + HttpMultiServer(Iterable servers) + : _servers = servers.toSet(), + super(mergeStreams(servers)); + + /// Creates an [HttpServer] listening on all available loopback addresses for + /// this computer. + /// + /// If this computer supports both IPv4 and IPv6, this returns an + /// [HttpMultiServer] listening to [port] on both loopback addresses. + /// Otherwise, it returns a normal [HttpServer] listening only on the IPv4 + /// address. + /// + /// If [port] is 0, the same ephemeral port is used for both the IPv4 and IPv6 + /// addresses. + static Future loopback(int port, {int backlog}) { + if (backlog == null) backlog = 0; + + return _loopback(port, (address, port) => + HttpServer.bind(address, port, backlog: backlog)); + } + + /// Like [loopback], but supports HTTPS requests. + /// + /// The certificate with nickname or distinguished name (DN) [certificateName] + /// is looked up in the certificate database, and is used as the server + /// certificate. If [requestClientCertificate] is true, the server will + /// request clients to authenticate with a client certificate. + static Future loopbackSecure(int port, {int backlog, + String certificateName, bool requestClientCertificate: false}) { + if (backlog == null) backlog = 0; + + return _loopback(port, (address, port) => + HttpServer.bindSecure(address, port, backlog: backlog, + certificateName: certificateName, + requestClientCertificate: requestClientCertificate)); + } + + /// A helper method for initializing loopback servers. + /// + /// [bind] should forward to either [HttpServer.bind] or + /// [HttpServer.bindSecure]. + static Future _loopback(int port, + Future bind(InternetAddress address, int port)) { + return Future.wait([ + supportsIpV6, + bind(InternetAddress.LOOPBACK_IP_V4, port) + ]).then((results) { + var supportsIpV6 = results[0]; + var v4Server = results[1]; + + if (!supportsIpV6) return v4Server; + + // Reuse the IPv4 server's port so that if [port] is 0, both servers use + // the same ephemeral port. + return bind(InternetAddress.LOOPBACK_IP_V6, v4Server.port) + .then((v6Server) { + return new HttpMultiServer([v4Server, v6Server]); + }); + }); + } + + Future close({bool force: false}) => + Future.wait(_servers.map((server) => server.close(force: force))); + + /// Returns an HttpConnectionsInfo object summarizing the total number of + /// current connections handled by all the servers. + HttpConnectionsInfo connectionsInfo() { + var info = new HttpConnectionsInfo(); + for (var server in _servers) { + var subInfo = server.connectionsInfo(); + info.total += subInfo.total; + info.active += subInfo.active; + info.idle += subInfo.idle; + info.closing += subInfo.closing; + } + return info; + } +} diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart new file mode 100644 index 0000000000..9e95aba5f9 --- /dev/null +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -0,0 +1,62 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library http_multi_server.utils; + +import 'dart:async'; +import 'dart:io'; + +/// Merges all streams in [streams] into a single stream that emits all of their +/// values. +/// +/// The returned stream will be closed only when every stream in [streams] is +/// closed. +Stream mergeStreams(Iterable streams) { + var subscriptions = new Set(); + var controller; + controller = new StreamController(onListen: () { + for (var stream in streams) { + var subscription; + subscription = stream.listen(controller.add, + onError: controller.addError, + onDone: () { + subscriptions.remove(subscription); + if (subscriptions.isEmpty) controller.close(); + }); + subscriptions.add(subscription); + } + }, onCancel: () { + for (var subscription in subscriptions) { + subscription.cancel(); + } + }, onPause: () { + for (var subscription in subscriptions) { + subscription.pause(); + } + }, onResume: () { + for (var subscription in subscriptions) { + subscription.resume(); + } + }, sync: true); + + return controller.stream; +} + +/// A cache for [supportsIpV6]. +bool _supportsIpV6; + +/// Returns whether this computer supports binding to IPv6 addresses. +Future get supportsIpV6 { + if (_supportsIpV6 != null) return new Future.value(_supportsIpV6); + + return ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0).then((socket) { + _supportsIpV6 = true; + socket.close(); + return true; + }).catchError((error) { + if (error is! SocketException) throw error; + _supportsIpV6 = false; + return false; + }); +} diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml new file mode 100644 index 0000000000..4199c5851a --- /dev/null +++ b/pkgs/http_multi_server/pubspec.yaml @@ -0,0 +1,11 @@ +name: http_multi_server +version: 1.0.0 +author: "Dart Team " +homepage: http://www.dartlang.org +description: + A dart:io HttpServer wrapper that handles requests from multiple servers. +dev_dependencies: + unittest: ">=0.11.0 <0.12.0" + http: ">=0.11.0 <0.12.0" +environment: + sdk: ">=1.4.0 <2.0.0" diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart new file mode 100644 index 0000000000..a3d9062067 --- /dev/null +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -0,0 +1,128 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library http_multi_server.test; + +import 'dart:async'; +import 'dart:io'; + +import 'package:http/http.dart' as http; +import 'package:http_multi_server/http_multi_server.dart'; +import 'package:http_multi_server/src/utils.dart'; +import 'package:unittest/unittest.dart'; + +void main() { + group("with multiple HttpServers", () { + var multiServer; + var subServer1; + var subServer2; + var subServer3; + setUp(() { + return Future.wait([ + HttpServer.bind("127.0.0.1", 0).then((server) => subServer1 = server), + HttpServer.bind("127.0.0.1", 0).then((server) => subServer2 = server), + HttpServer.bind("127.0.0.1", 0).then((server) => subServer3 = server) + ]).then((servers) => multiServer = new HttpMultiServer(servers)); + }); + + tearDown(() => multiServer.close()); + + test("listen listens to all servers", () { + multiServer.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + expect(_read(subServer1), completion(equals("got request"))); + expect(_read(subServer2), completion(equals("got request"))); + expect(_read(subServer3), completion(equals("got request"))); + }); + + test("serverHeader= sets the value for all servers", () { + multiServer.serverHeader = "http_multi_server test"; + + multiServer.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + expect(_get(subServer1).then((response) { + expect(response.headers['server'], equals("http_multi_server test")); + }), completes); + + expect(_get(subServer2).then((response) { + expect(response.headers['server'], equals("http_multi_server test")); + }), completes); + + expect(_get(subServer3).then((response) { + expect(response.headers['server'], equals("http_multi_server test")); + }), completes); + }); + + test("connectionsInfo sums the values for all servers", () { + var pendingRequests = 0; + var awaitingResponseCompleter = new Completer(); + var sendResponseCompleter = new Completer(); + multiServer.listen((request) { + sendResponseCompleter.future.then((_) { + request.response.write("got request"); + request.response.close(); + }); + + pendingRequests++; + if (pendingRequests == 2) awaitingResponseCompleter.complete(); + }); + + // Queue up some requests, then wait on [awaitingResponseCompleter] to + // make sure they're in-flight before we check [connectionsInfo]. + expect(_get(subServer1), completes); + expect(_get(subServer2), completes); + + return awaitingResponseCompleter.future.then((_) { + var info = multiServer.connectionsInfo(); + expect(info.total, equals(2)); + expect(info.active, equals(2)); + expect(info.idle, equals(0)); + expect(info.closing, equals(0)); + + sendResponseCompleter.complete(); + }); + }); + }); + + group("HttpMultiServer.loopback", () { + var server; + setUp(() { + return HttpMultiServer.loopback(0).then((server_) => server = server_); + }); + + tearDown(() => server.close()); + + test("listens on all localhost interfaces", () { + server.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + expect(http.read("http://127.0.0.1:${server.port}/"), + completion(equals("got request"))); + + return supportsIpV6.then((supportsIpV6) { + if (!supportsIpV6) return; + expect(http.read("http://[::1]:${server.port}/"), + completion(equals("got request"))); + }); + }); + }); +} + +/// Makes a GET request to the root of [server] and returns the response. +Future _get(HttpServer server) => http.get(_urlFor(server)); + +/// Makes a GET request to the root of [server] and returns the response body. +Future _read(HttpServer server) => http.read(_urlFor(server)); + +/// Returns the URL for the root of [server]. +String _urlFor(HttpServer server) => + "http://${server.address.host}:${server.port}/"; From bf3c13013be557c8676b93648ebbc6a699a4b785 Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" Date: Thu, 5 Jun 2014 19:14:50 +0000 Subject: [PATCH 002/107] Add a LICENSE file to pkg/http_multi_server. R=rnystrom@google.com Review URL: https://codereview.chromium.org//317803003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37048 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/LICENSE | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pkgs/http_multi_server/LICENSE diff --git a/pkgs/http_multi_server/LICENSE b/pkgs/http_multi_server/LICENSE new file mode 100644 index 0000000000..5c60afea39 --- /dev/null +++ b/pkgs/http_multi_server/LICENSE @@ -0,0 +1,26 @@ +Copyright 2014, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 8df4fcf271e31d9ce46a87aeafc3ad55d9bb375b Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" Date: Thu, 24 Jul 2014 01:42:47 +0000 Subject: [PATCH 003/107] Swallow errors in subscriptions in http_multi_server.. BUG=19815 R=alanknight@google.com Review URL: https://codereview.chromium.org//411203002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38532 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/CHANGELOG.md | 7 ++++ .../lib/http_multi_server.dart | 17 ++++------ pkgs/http_multi_server/lib/src/utils.dart | 34 +++++++------------ pkgs/http_multi_server/pubspec.yaml | 2 +- .../test/http_multi_server_test.dart | 22 +++++++++++- 5 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 pkgs/http_multi_server/CHANGELOG.md diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md new file mode 100644 index 0000000000..ac009083c2 --- /dev/null +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -0,0 +1,7 @@ +## 1.0.1 + +* Ignore errors from one of the servers if others are still bound. In + particular, this works around [issue 19815][] on some Windows machines where + IPv6 failure isn't discovered until we try to connect to the socket. + +[issue 19815]: http://code.google.com/p/dart/issues/detail?id=19815 diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index c055367dc8..da128885fa 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -99,20 +99,15 @@ class HttpMultiServer extends StreamView implements HttpServer { /// [HttpServer.bindSecure]. static Future _loopback(int port, Future bind(InternetAddress address, int port)) { - return Future.wait([ - supportsIpV6, - bind(InternetAddress.LOOPBACK_IP_V4, port) - ]).then((results) { - var supportsIpV6 = results[0]; - var v4Server = results[1]; - - if (!supportsIpV6) return v4Server; - + return bind(InternetAddress.LOOPBACK_IP_V4, port).then((v4Server) { // Reuse the IPv4 server's port so that if [port] is 0, both servers use // the same ephemeral port. return bind(InternetAddress.LOOPBACK_IP_V6, v4Server.port) - .then((v6Server) { - return new HttpMultiServer([v4Server, v6Server]); + .then((v6Server) => new HttpMultiServer([v4Server, v6Server])) + .catchError((error) { + // If we fail to bind to IPv6, just use IPv4. + if (error is SocketException) return v4Server; + throw error; }); }); } diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index 9e95aba5f9..d6159753c3 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -7,6 +7,8 @@ library http_multi_server.utils; import 'dart:async'; import 'dart:io'; +// TODO(nweiz): Revert this to the version of [mergeStreams] found elsewhere in +// the repo once issue 19815 is fixed in dart:io. /// Merges all streams in [streams] into a single stream that emits all of their /// values. /// @@ -18,9 +20,17 @@ Stream mergeStreams(Iterable streams) { controller = new StreamController(onListen: () { for (var stream in streams) { var subscription; - subscription = stream.listen(controller.add, - onError: controller.addError, - onDone: () { + subscription = stream.listen(controller.add, onError: (error, trace) { + if (subscriptions.length == 1) { + // If the last subscription errored, pass it on. + controller.addError(error, trace); + } else { + // If only one of the subscriptions has an error (usually IPv6 failing + // late), then just remove that subscription and ignore the error. + subscriptions.remove(subscription); + subscription.cancel(); + } + }, onDone: () { subscriptions.remove(subscription); if (subscriptions.isEmpty) controller.close(); }); @@ -42,21 +52,3 @@ Stream mergeStreams(Iterable streams) { return controller.stream; } - -/// A cache for [supportsIpV6]. -bool _supportsIpV6; - -/// Returns whether this computer supports binding to IPv6 addresses. -Future get supportsIpV6 { - if (_supportsIpV6 != null) return new Future.value(_supportsIpV6); - - return ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0).then((socket) { - _supportsIpV6 = true; - socket.close(); - return true; - }).catchError((error) { - if (error is! SocketException) throw error; - _supportsIpV6 = false; - return false; - }); -} diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 4199c5851a..2bdb4a2857 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.0.0 +version: 1.0.1 author: "Dart Team " homepage: http://www.dartlang.org description: diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index a3d9062067..0140ee7c89 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -108,7 +108,7 @@ void main() { expect(http.read("http://127.0.0.1:${server.port}/"), completion(equals("got request"))); - return supportsIpV6.then((supportsIpV6) { + return _supportsIpV6.then((supportsIpV6) { if (!supportsIpV6) return; expect(http.read("http://[::1]:${server.port}/"), completion(equals("got request"))); @@ -117,6 +117,26 @@ void main() { }); } +/// A cache for [supportsIpV6]. +bool _supportsIpV6Cache; + +// TODO(nweiz): This is known to be inaccurate on Windows machines with IPv6 +// disabled (issue 19815). Tests will fail on such machines. +/// Returns whether this computer supports binding to IPv6 addresses. +Future get _supportsIpV6 { + if (_supportsIpV6Cache != null) return new Future.value(_supportsIpV6Cache); + + return ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0).then((socket) { + _supportsIpV6Cache = true; + socket.close(); + return true; + }).catchError((error) { + if (error is! SocketException) throw error; + _supportsIpV6Cache = false; + return false; + }); +} + /// Makes a GET request to the root of [server] and returns the response. Future _get(HttpServer server) => http.get(_urlFor(server)); From 80a11f83b1f631d13433ac97da47118e8425b75f Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" Date: Wed, 30 Jul 2014 21:54:43 +0000 Subject: [PATCH 004/107] Remove the workaround for issue 19815 in http_multi_server. This releases http_multi_server 1.0.2. R=rnystrom@google.com BUG=20257 Review URL: https://codereview.chromium.org//433593002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38755 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/CHANGELOG.md | 4 +++ .../lib/http_multi_server.dart | 17 ++++++---- pkgs/http_multi_server/lib/src/utils.dart | 34 ++++++++++++------- pkgs/http_multi_server/pubspec.yaml | 4 +-- .../test/http_multi_server_test.dart | 22 +----------- 5 files changed, 39 insertions(+), 42 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index ac009083c2..8cab523fe1 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.2 + +* Remove the workaround for [issue 19815][]. + ## 1.0.1 * Ignore errors from one of the servers if others are still bound. In diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index da128885fa..c055367dc8 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -99,15 +99,20 @@ class HttpMultiServer extends StreamView implements HttpServer { /// [HttpServer.bindSecure]. static Future _loopback(int port, Future bind(InternetAddress address, int port)) { - return bind(InternetAddress.LOOPBACK_IP_V4, port).then((v4Server) { + return Future.wait([ + supportsIpV6, + bind(InternetAddress.LOOPBACK_IP_V4, port) + ]).then((results) { + var supportsIpV6 = results[0]; + var v4Server = results[1]; + + if (!supportsIpV6) return v4Server; + // Reuse the IPv4 server's port so that if [port] is 0, both servers use // the same ephemeral port. return bind(InternetAddress.LOOPBACK_IP_V6, v4Server.port) - .then((v6Server) => new HttpMultiServer([v4Server, v6Server])) - .catchError((error) { - // If we fail to bind to IPv6, just use IPv4. - if (error is SocketException) return v4Server; - throw error; + .then((v6Server) { + return new HttpMultiServer([v4Server, v6Server]); }); }); } diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index d6159753c3..9e95aba5f9 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -7,8 +7,6 @@ library http_multi_server.utils; import 'dart:async'; import 'dart:io'; -// TODO(nweiz): Revert this to the version of [mergeStreams] found elsewhere in -// the repo once issue 19815 is fixed in dart:io. /// Merges all streams in [streams] into a single stream that emits all of their /// values. /// @@ -20,17 +18,9 @@ Stream mergeStreams(Iterable streams) { controller = new StreamController(onListen: () { for (var stream in streams) { var subscription; - subscription = stream.listen(controller.add, onError: (error, trace) { - if (subscriptions.length == 1) { - // If the last subscription errored, pass it on. - controller.addError(error, trace); - } else { - // If only one of the subscriptions has an error (usually IPv6 failing - // late), then just remove that subscription and ignore the error. - subscriptions.remove(subscription); - subscription.cancel(); - } - }, onDone: () { + subscription = stream.listen(controller.add, + onError: controller.addError, + onDone: () { subscriptions.remove(subscription); if (subscriptions.isEmpty) controller.close(); }); @@ -52,3 +42,21 @@ Stream mergeStreams(Iterable streams) { return controller.stream; } + +/// A cache for [supportsIpV6]. +bool _supportsIpV6; + +/// Returns whether this computer supports binding to IPv6 addresses. +Future get supportsIpV6 { + if (_supportsIpV6 != null) return new Future.value(_supportsIpV6); + + return ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0).then((socket) { + _supportsIpV6 = true; + socket.close(); + return true; + }).catchError((error) { + if (error is! SocketException) throw error; + _supportsIpV6 = false; + return false; + }); +} diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 2bdb4a2857..c7361d45d0 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.0.1 +version: 1.0.2 author: "Dart Team " homepage: http://www.dartlang.org description: @@ -8,4 +8,4 @@ dev_dependencies: unittest: ">=0.11.0 <0.12.0" http: ">=0.11.0 <0.12.0" environment: - sdk: ">=1.4.0 <2.0.0" + sdk: ">=1.6.0-dev.6.0 <2.0.0" diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 0140ee7c89..a3d9062067 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -108,7 +108,7 @@ void main() { expect(http.read("http://127.0.0.1:${server.port}/"), completion(equals("got request"))); - return _supportsIpV6.then((supportsIpV6) { + return supportsIpV6.then((supportsIpV6) { if (!supportsIpV6) return; expect(http.read("http://[::1]:${server.port}/"), completion(equals("got request"))); @@ -117,26 +117,6 @@ void main() { }); } -/// A cache for [supportsIpV6]. -bool _supportsIpV6Cache; - -// TODO(nweiz): This is known to be inaccurate on Windows machines with IPv6 -// disabled (issue 19815). Tests will fail on such machines. -/// Returns whether this computer supports binding to IPv6 addresses. -Future get _supportsIpV6 { - if (_supportsIpV6Cache != null) return new Future.value(_supportsIpV6Cache); - - return ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0).then((socket) { - _supportsIpV6Cache = true; - socket.close(); - return true; - }).catchError((error) { - if (error is! SocketException) throw error; - _supportsIpV6Cache = false; - return false; - }); -} - /// Makes a GET request to the root of [server] and returns the response. Future _get(HttpServer server) => http.get(_urlFor(server)); From e034b8886df2935bf8d3f91ff941ea80069f55c9 Mon Sep 17 00:00:00 2001 From: "sgjesse@google.com" Date: Tue, 12 Aug 2014 09:54:24 +0000 Subject: [PATCH 005/107] Add dummy implementation of defaultResponseHeaders This fixes the analyzer redness on the buildbot. TBR=nweiz@google.com BUG= Review URL: https://codereview.chromium.org//460973002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39122 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/lib/http_multi_server.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index c055367dc8..76c3eba1a4 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -27,6 +27,9 @@ class HttpMultiServer extends StreamView implements HttpServer { } } + HttpHeaders get defaultResponseHeaders => + throw new UnsupportedError('defaultResponseHeaders not supported'); + Duration get idleTimeout => _servers.first.idleTimeout; set idleTimeout(Duration value) { for (var server in _servers) { From e883828c3c8bcc28319fdf58748507dfc3285820 Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" Date: Thu, 14 Aug 2014 00:42:37 +0000 Subject: [PATCH 006/107] Add support for HttpServer.defaultResponseHeaders to HttpMultiServer. R=rnystrom@google.com BUG= Review URL: https://codereview.chromium.org//469583002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39235 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/CHANGELOG.md | 4 + .../lib/http_multi_server.dart | 15 ++- .../lib/src/multi_headers.dart | 117 ++++++++++++++++++ pkgs/http_multi_server/pubspec.yaml | 2 +- .../test/http_multi_server_test.dart | 22 ++++ 5 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 pkgs/http_multi_server/lib/src/multi_headers.dart diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 8cab523fe1..7c7f2e4ef3 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.0 + +* Add support for `HttpServer.defaultResponseHeaders`. + ## 1.0.2 * Remove the workaround for [issue 19815][]. diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 76c3eba1a4..7075ab4736 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -7,6 +7,7 @@ library http_multi_server; import 'dart:async'; import 'dart:io'; +import 'src/multi_headers.dart'; import 'src/utils.dart'; /// An implementation of `dart:io`'s [HttpServer] that wraps multiple servers @@ -20,6 +21,11 @@ class HttpMultiServer extends StreamView implements HttpServer { /// The wrapped servers. final Set _servers; + /// Returns the default value of the `Server` header for all responses + /// generated by each server. + /// + /// If the wrapped servers have different default values, it's not defined + /// which value is returned. String get serverHeader => _servers.first.serverHeader; set serverHeader(String value) { for (var server in _servers) { @@ -27,8 +33,11 @@ class HttpMultiServer extends StreamView implements HttpServer { } } - HttpHeaders get defaultResponseHeaders => - throw new UnsupportedError('defaultResponseHeaders not supported'); + /// Returns the default set of headers added to all response objects. + /// + /// If the wrapped servers have different default headers, it's not defined + /// which header is returned for accessor methods. + final HttpHeaders defaultResponseHeaders; Duration get idleTimeout => _servers.first.idleTimeout; set idleTimeout(Duration value) { @@ -61,6 +70,8 @@ class HttpMultiServer extends StreamView implements HttpServer { /// listened to when this is called. HttpMultiServer(Iterable servers) : _servers = servers.toSet(), + defaultResponseHeaders = new MultiHeaders( + servers.map((server) => server.defaultResponseHeaders)), super(mergeStreams(servers)); /// Creates an [HttpServer] listening on all available loopback addresses for diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart new file mode 100644 index 0000000000..1677a9fa8c --- /dev/null +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -0,0 +1,117 @@ +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library http_multi_server.multi_headers; + +import 'dart:io'; + +/// A class that delegates header access and setting to many [HttpHeaders] +/// instances. +class MultiHeaders implements HttpHeaders { + /// The wrapped headers. + final Set _headers; + + bool get chunkedTransferEncoding => _headers.first.chunkedTransferEncoding; + set chunkedTransferEncoding(bool value) { + for (var headers in _headers) { + headers.chunkedTransferEncoding = value; + } + } + + int get contentLength => _headers.first.contentLength; + set contentLength(int value) { + for (var headers in _headers) { + headers.contentLength = value; + } + } + + ContentType get contentType => _headers.first.contentType; + set contentType(ContentType value) { + for (var headers in _headers) { + headers.contentType = value; + } + } + + DateTime get date => _headers.first.date; + set date(DateTime value) { + for (var headers in _headers) { + headers.date = value; + } + } + + DateTime get expires => _headers.first.expires; + set expires(DateTime value) { + for (var headers in _headers) { + headers.expires = value; + } + } + + String get host => _headers.first.host; + set host(String value) { + for (var headers in _headers) { + headers.host = value; + } + } + + DateTime get ifModifiedSince => _headers.first.ifModifiedSince; + set ifModifiedSince(DateTime value) { + for (var headers in _headers) { + headers.ifModifiedSince = value; + } + } + + bool get persistentConnection => _headers.first.persistentConnection; + set persistentConnection(bool value) { + for (var headers in _headers) { + headers.persistentConnection = value; + } + } + + int get port => _headers.first.port; + set port(int value) { + for (var headers in _headers) { + headers.port = value; + } + } + + MultiHeaders(Iterable headers) + : _headers = headers.toSet(); + + void add(String name, Object value) { + for (var headers in _headers) { + headers.add(name, value); + } + } + + void forEach(void f(String name, List values)) => + _headers.first.forEach(f); + + void noFolding(String name) { + for (var headers in _headers) { + headers.noFolding(name); + } + } + + void remove(String name, Object value) { + for (var headers in _headers) { + headers.remove(name); + } + } + + void removeAll(String name) { + for (var headers in _headers) { + headers.removeAll(name, value); + } + } + + void set(String name, Object value) { + for (var headers in _headers) { + headers.set(name, value); + } + } + + String value(String name) => _headers.first.value(name); + + List operator[](String name) => _headers.first[name]; +} diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index c7361d45d0..61e3dff177 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.0.2 +version: 1.1.0 author: "Dart Team " homepage: http://www.dartlang.org description: diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index a3d9062067..0371c8973e 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -60,6 +60,28 @@ void main() { }), completes); }); + test("headers.set sets the value for all servers", () { + multiServer.defaultResponseHeaders.set( + "server", "http_multi_server test"); + + multiServer.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + expect(_get(subServer1).then((response) { + expect(response.headers['server'], equals("http_multi_server test")); + }), completes); + + expect(_get(subServer2).then((response) { + expect(response.headers['server'], equals("http_multi_server test")); + }), completes); + + expect(_get(subServer3).then((response) { + expect(response.headers['server'], equals("http_multi_server test")); + }), completes); + }); + test("connectionsInfo sums the values for all servers", () { var pendingRequests = 0; var awaitingResponseCompleter = new Completer(); From f2beb709cf267fdafefdd2558cde066825ccba0c Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" Date: Thu, 14 Aug 2014 01:25:30 +0000 Subject: [PATCH 007/107] Fix analyzer warnings in http_multi_server. R=rnystrom@google.com TBR Review URL: https://codereview.chromium.org//477513002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39236 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/CHANGELOG.md | 6 ++++++ pkgs/http_multi_server/lib/src/multi_headers.dart | 10 ++++++++-- pkgs/http_multi_server/pubspec.yaml | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 7c7f2e4ef3..05f2f2c12f 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.2.0 + +* Add support for `HttpServer.defaultResponseHeaders.clear`. + +* Fix `HttpServer.defaultResponseHeaders.remove` and `.removeAll`. + ## 1.1.0 * Add support for `HttpServer.defaultResponseHeaders`. diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart index 1677a9fa8c..fcd782cfce 100644 --- a/pkgs/http_multi_server/lib/src/multi_headers.dart +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -95,13 +95,13 @@ class MultiHeaders implements HttpHeaders { void remove(String name, Object value) { for (var headers in _headers) { - headers.remove(name); + headers.remove(name, value); } } void removeAll(String name) { for (var headers in _headers) { - headers.removeAll(name, value); + headers.removeAll(name); } } @@ -114,4 +114,10 @@ class MultiHeaders implements HttpHeaders { String value(String name) => _headers.first.value(name); List operator[](String name) => _headers.first[name]; + + void clear() { + for (var headers in _headers) { + headers.clear(); + } + } } diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 61e3dff177..b1b28308ef 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.1.0 +version: 1.2.0 author: "Dart Team " homepage: http://www.dartlang.org description: From e39fb079548aad680a628a66fbf7caf0a331f32a Mon Sep 17 00:00:00 2001 From: "ajohnsen@google.com" Date: Tue, 23 Sep 2014 11:08:24 +0000 Subject: [PATCH 008/107] Add HttpServer:autoCompress option, to disable auto gzip compression. BUG= R=lrn@google.com, sgjesse@google.com Review URL: https://codereview.chromium.org//598453003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40587 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/CHANGELOG.md | 4 ++++ .../lib/http_multi_server.dart | 7 +++++++ pkgs/http_multi_server/pubspec.yaml | 2 +- .../test/http_multi_server_test.dart | 21 +++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 05f2f2c12f..f3d79a3e35 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.3.0 + +* Add support for `HttpServer.autoCompress`. + ## 1.2.0 * Add support for `HttpServer.defaultResponseHeaders.clear`. diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 7075ab4736..01e3ca89df 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -46,6 +46,13 @@ class HttpMultiServer extends StreamView implements HttpServer { } } + bool get autoCompress => _servers.first.autoCompress; + set autoCompress(bool value) { + for (var server in _servers) { + server.autoCompress = value; + } + } + /// Returns the port that one of the wrapped servers is listening on. /// /// If the wrapped servers are listening on different ports, it's not defined diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index b1b28308ef..3d9271097c 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.2.0 +version: 1.3.0-dev author: "Dart Team " homepage: http://www.dartlang.org description: diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 0371c8973e..f74f359634 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -58,6 +58,27 @@ void main() { expect(_get(subServer3).then((response) { expect(response.headers['server'], equals("http_multi_server test")); }), completes); + } + ); + test("autoCompress= sets the value for all servers", () { + multiServer.autoCompress = true; + + multiServer.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + expect(_get(subServer1).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), completes); + + expect(_get(subServer2).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), completes); + + expect(_get(subServer3).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), completes); }); test("headers.set sets the value for all servers", () { From dfcc4a7095038909093a7dd9f75ee5211af061ad Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" Date: Tue, 23 Sep 2014 22:01:08 +0000 Subject: [PATCH 009/107] Release http_multi_server 1.3.0. R=rnystrom@google.com Review URL: https://codereview.chromium.org//599663002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40608 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 3d9271097c..b8199dad42 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.3.0-dev +version: 1.3.0 author: "Dart Team " homepage: http://www.dartlang.org description: @@ -8,4 +8,4 @@ dev_dependencies: unittest: ">=0.11.0 <0.12.0" http: ">=0.11.0 <0.12.0" environment: - sdk: ">=1.6.0-dev.6.0 <2.0.0" + sdk: ">=1.7.0 <2.0.0" From 83fbe23ba7dca927ab0f034c5350a3825e48caec Mon Sep 17 00:00:00 2001 From: "nweiz@google.com" Date: Wed, 24 Sep 2014 00:51:46 +0000 Subject: [PATCH 010/107] Give http_multi_server a more accurate SDK bound. R=rnystrom@google.com TBR Review URL: https://codereview.chromium.org//593383002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40620 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index b8199dad42..edc4c41253 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.3.0 +version: 1.3.0+1 author: "Dart Team " homepage: http://www.dartlang.org description: @@ -8,4 +8,4 @@ dev_dependencies: unittest: ">=0.11.0 <0.12.0" http: ">=0.11.0 <0.12.0" environment: - sdk: ">=1.7.0 <2.0.0" + sdk: ">=1.7.0-edge.40587 <2.0.0" From ab32229055d6be9edd5fbb633274dfd2a4ae6686 Mon Sep 17 00:00:00 2001 From: "ajohnsen@google.com" Date: Wed, 24 Sep 2014 09:13:20 +0000 Subject: [PATCH 011/107] Clean up http_multi_server. BUG= R=lrn@google.com Review URL: https://codereview.chromium.org//597103002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40627 260f80e4-7a28-3924-810f-c04153c831b5 --- pkgs/http_multi_server/test/http_multi_server_test.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index f74f359634..2729fa0a3a 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -58,8 +58,8 @@ void main() { expect(_get(subServer3).then((response) { expect(response.headers['server'], equals("http_multi_server test")); }), completes); - } - ); + }); + test("autoCompress= sets the value for all servers", () { multiServer.autoCompress = true; From f47910390c1fce8cc26adfaeea054b96c74a7cd6 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 17 Dec 2014 15:04:00 -0800 Subject: [PATCH 012/107] Add gitignore, status, and codereview files. --- pkgs/http_multi_server/.gitignore | 14 ++++++++++++++ pkgs/http_multi_server/.status | 6 ++++++ pkgs/http_multi_server/codereview.settings | 3 +++ 3 files changed, 23 insertions(+) create mode 100644 pkgs/http_multi_server/.gitignore create mode 100644 pkgs/http_multi_server/.status create mode 100644 pkgs/http_multi_server/codereview.settings diff --git a/pkgs/http_multi_server/.gitignore b/pkgs/http_multi_server/.gitignore new file mode 100644 index 0000000000..388eff0ba3 --- /dev/null +++ b/pkgs/http_multi_server/.gitignore @@ -0,0 +1,14 @@ +# Don’t commit the following directories created by pub. +.buildlog +.pub/ +build/ +packages + +# Or the files created by dart2js. +*.dart.js +*.js_ +*.js.deps +*.js.map + +# Include when developing application packages. +pubspec.lock \ No newline at end of file diff --git a/pkgs/http_multi_server/.status b/pkgs/http_multi_server/.status new file mode 100644 index 0000000000..5e2ea52159 --- /dev/null +++ b/pkgs/http_multi_server/.status @@ -0,0 +1,6 @@ +# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +[ $browser ] +http_multi_server/test/http_multi_server_test: Skip # Uses dart:io diff --git a/pkgs/http_multi_server/codereview.settings b/pkgs/http_multi_server/codereview.settings new file mode 100644 index 0000000000..23d9fd4ded --- /dev/null +++ b/pkgs/http_multi_server/codereview.settings @@ -0,0 +1,3 @@ +CODE_REVIEW_SERVER: http://codereview.chromium.org/ +VIEW_VC: https://github.com/dart-lang/http_multi_server/commit/ +CC_LIST: reviews@dartlang.org \ No newline at end of file From 7944efc69d84e1aa03cfcab5c50d155d803c3a16 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 17 Dec 2014 15:18:51 -0800 Subject: [PATCH 013/107] Update the pubspec's homepage link. --- pkgs/http_multi_server/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index edc4c41253..b1a294fac7 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,7 +1,7 @@ name: http_multi_server version: 1.3.0+1 author: "Dart Team " -homepage: http://www.dartlang.org +homepage: http://github.com/dart-lang/http_multi_server description: A dart:io HttpServer wrapper that handles requests from multiple servers. dev_dependencies: From 4b300ce8afbbafd7490bc0b1cabf6d7095e7d7bb Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 17 Dec 2014 16:49:42 -0800 Subject: [PATCH 014/107] Fix the status file to match the package bots' expectations. --- pkgs/http_multi_server/.status | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/.status b/pkgs/http_multi_server/.status index 5e2ea52159..95b6ac9c16 100644 --- a/pkgs/http_multi_server/.status +++ b/pkgs/http_multi_server/.status @@ -2,5 +2,12 @@ # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. +# Skip non-test files ending with "_test". +*/packages/*: Skip + +# Only run tests from the build directory, since we don't care about the +# difference between transformed an untransformed code. +test/*: Skip + [ $browser ] -http_multi_server/test/http_multi_server_test: Skip # Uses dart:io +*: Skip # Uses dart:io From 5cef50d58e886fb6bb367d49483abe999c6e9f67 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 18 Dec 2014 17:41:17 -0800 Subject: [PATCH 015/107] Properly skip tests in packages directories. --- pkgs/http_multi_server/.status | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/http_multi_server/.status b/pkgs/http_multi_server/.status index 95b6ac9c16..ac80ccc07b 100644 --- a/pkgs/http_multi_server/.status +++ b/pkgs/http_multi_server/.status @@ -3,7 +3,12 @@ # BSD-style license that can be found in the LICENSE file. # Skip non-test files ending with "_test". +packages/*: Skip */packages/*: Skip +*/*/packages/*: Skip +*/*/*/packages/*: Skip +*/*/*/*packages/*: Skip +*/*/*/*/*packages/*: Skip # Only run tests from the build directory, since we don't care about the # difference between transformed an untransformed code. From 6b03e0d39e8b25a52ec0d38cbf7f9efe419c6dac Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Mon, 9 Mar 2015 15:03:24 -0700 Subject: [PATCH 016/107] Recover gracefully if a matching port is unavailable. R=rnystrom@google.com BUG=dartbug.com/22673 Review URL: https://codereview.chromium.org//993743002 --- pkgs/http_multi_server/CHANGELOG.md | 5 +++++ .../lib/http_multi_server.dart | 19 +++++++++++++++++++ pkgs/http_multi_server/pubspec.yaml | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index f3d79a3e35..96b81c8eb0 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.3.1 + +* `loopback()` and `loopbackSecure()` recover gracefully if an ephemeral port is + requested and the located port isn't available on both IPv4 and IPv6. + ## 1.3.0 * Add support for `HttpServer.autoCompress`. diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 01e3ca89df..fc87455048 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -10,6 +10,15 @@ import 'dart:io'; import 'src/multi_headers.dart'; import 'src/utils.dart'; +/// The error code for an error caused by a port already being in use. +final _addressInUseErrno = _computeAddressInUseErrno(); +int _computeAddressInUseErrno() { + if (Platform.isWindows) return 10048; + if (Platform.isMacOS) return 48; + assert(Platform.isLinux); + return 98; +} + /// An implementation of `dart:io`'s [HttpServer] that wraps multiple servers /// and forwards methods to all of them. /// @@ -134,6 +143,16 @@ class HttpMultiServer extends StreamView implements HttpServer { return bind(InternetAddress.LOOPBACK_IP_V6, v4Server.port) .then((v6Server) { return new HttpMultiServer([v4Server, v6Server]); + }).catchError((error) { + if (error is! SocketException) throw error; + if (error.osError.errno != _addressInUseErrno) throw error; + if (port != 0) throw error; + + // A port being available on IPv4 doesn't necessarily mean that the same + // port is available on IPv6. If it's not (which is rare in practice), + // we try again until we find one that's available on both. + v4Server.close(); + return _loopback(port, bind); }); }); } diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index b1a294fac7..8faaace67d 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.3.0+1 +version: 1.3.1 author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: From 1e13011df4addb02741309dd47ed3d062afcdcf0 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 10 Mar 2015 09:20:43 -0700 Subject: [PATCH 017/107] Eventually stop retrying port allocation if it fails repeatedly. R=skybrian@google.com Review URL: https://codereview.chromium.org//992843002 --- pkgs/http_multi_server/CHANGELOG.md | 4 ++++ pkgs/http_multi_server/lib/http_multi_server.dart | 8 ++++++-- pkgs/http_multi_server/pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 96b81c8eb0..e2b731b9e4 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.3.2 + +* Eventually stop retrying port allocation if it fails repeatedly. + ## 1.3.1 * `loopback()` and `loopbackSecure()` recover gracefully if an ephemeral port is diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index fc87455048..36d583f78d 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -128,7 +128,10 @@ class HttpMultiServer extends StreamView implements HttpServer { /// [bind] should forward to either [HttpServer.bind] or /// [HttpServer.bindSecure]. static Future _loopback(int port, - Future bind(InternetAddress address, int port)) { + Future bind(InternetAddress address, int port), + [int remainingRetries]) { + if (remainingRetries == null) remainingRetries = 5; + return Future.wait([ supportsIpV6, bind(InternetAddress.LOOPBACK_IP_V4, port) @@ -147,12 +150,13 @@ class HttpMultiServer extends StreamView implements HttpServer { if (error is! SocketException) throw error; if (error.osError.errno != _addressInUseErrno) throw error; if (port != 0) throw error; + if (remainingRetries == 0) throw error; // A port being available on IPv4 doesn't necessarily mean that the same // port is available on IPv6. If it's not (which is rare in practice), // we try again until we find one that's available on both. v4Server.close(); - return _loopback(port, bind); + return _loopback(port, bind, remainingRetries - 1); }); }); } diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 8faaace67d..e549c4bbe0 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.3.1 +version: 1.3.2-dev author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: From 8098e7925daf7b9f5c081c527fe65c13cd815764 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 10 Mar 2015 12:43:30 -0700 Subject: [PATCH 018/107] Use OSError.errorCode rather than .errno. R=rnystrom@google.com Review URL: https://codereview.chromium.org//985773003 --- pkgs/http_multi_server/CHANGELOG.md | 2 ++ pkgs/http_multi_server/lib/http_multi_server.dart | 2 +- pkgs/http_multi_server/pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index e2b731b9e4..df1b863bba 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -2,6 +2,8 @@ * Eventually stop retrying port allocation if it fails repeatedly. +* Properly detect socket errors caused by already-in-use addresses. + ## 1.3.1 * `loopback()` and `loopbackSecure()` recover gracefully if an ephemeral port is diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 36d583f78d..abad76ebb9 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -148,7 +148,7 @@ class HttpMultiServer extends StreamView implements HttpServer { return new HttpMultiServer([v4Server, v6Server]); }).catchError((error) { if (error is! SocketException) throw error; - if (error.osError.errno != _addressInUseErrno) throw error; + if (error.osError.errorCode != _addressInUseErrno) throw error; if (port != 0) throw error; if (remainingRetries == 0) throw error; diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index e549c4bbe0..2fb1188559 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.3.2-dev +version: 1.3.2 author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: From c9d513ed1545d688d776ad5a53977536efca8bf8 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 16 Jul 2015 13:23:04 -0700 Subject: [PATCH 019/107] Upgrade to the new test package. R=rnystrom@google.com Review URL: https://codereview.chromium.org//1236403006 . --- pkgs/http_multi_server/.gitignore | 1 + pkgs/http_multi_server/.status | 18 ------------------ pkgs/http_multi_server/.test_config | 5 +++++ pkgs/http_multi_server/pubspec.yaml | 4 ++-- .../test/http_multi_server_test.dart | 2 +- 5 files changed, 9 insertions(+), 21 deletions(-) delete mode 100644 pkgs/http_multi_server/.status create mode 100644 pkgs/http_multi_server/.test_config diff --git a/pkgs/http_multi_server/.gitignore b/pkgs/http_multi_server/.gitignore index 388eff0ba3..7dbf0350d6 100644 --- a/pkgs/http_multi_server/.gitignore +++ b/pkgs/http_multi_server/.gitignore @@ -3,6 +3,7 @@ .pub/ build/ packages +.packages # Or the files created by dart2js. *.dart.js diff --git a/pkgs/http_multi_server/.status b/pkgs/http_multi_server/.status deleted file mode 100644 index ac80ccc07b..0000000000 --- a/pkgs/http_multi_server/.status +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -# Skip non-test files ending with "_test". -packages/*: Skip -*/packages/*: Skip -*/*/packages/*: Skip -*/*/*/packages/*: Skip -*/*/*/*packages/*: Skip -*/*/*/*/*packages/*: Skip - -# Only run tests from the build directory, since we don't care about the -# difference between transformed an untransformed code. -test/*: Skip - -[ $browser ] -*: Skip # Uses dart:io diff --git a/pkgs/http_multi_server/.test_config b/pkgs/http_multi_server/.test_config new file mode 100644 index 0000000000..531426abb3 --- /dev/null +++ b/pkgs/http_multi_server/.test_config @@ -0,0 +1,5 @@ +{ + "test_package": { + "platforms": ["vm"] + } +} \ No newline at end of file diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 2fb1188559..e6f9a971a5 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,11 +1,11 @@ name: http_multi_server -version: 1.3.2 +version: 1.3.3-dev author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: A dart:io HttpServer wrapper that handles requests from multiple servers. dev_dependencies: - unittest: ">=0.11.0 <0.12.0" + test: ">=0.12.0 <0.13.0" http: ">=0.11.0 <0.12.0" environment: sdk: ">=1.7.0-edge.40587 <2.0.0" diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 2729fa0a3a..889a4cdd1f 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -10,7 +10,7 @@ import 'dart:io'; import 'package:http/http.dart' as http; import 'package:http_multi_server/http_multi_server.dart'; import 'package:http_multi_server/src/utils.dart'; -import 'package:unittest/unittest.dart'; +import 'package:test/test.dart'; void main() { group("with multiple HttpServers", () { From d230d25c1c045941c9d89b3062801e1b2fc958e5 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 8 Dec 2015 16:52:49 -0800 Subject: [PATCH 020/107] Update loopback constructors to match dart:io. Closes dart-lang/http_multi_server#1 R=rnystrom@google.com Review URL: https://codereview.chromium.org//1508203004 . --- pkgs/http_multi_server/CHANGELOG.md | 10 +++++++ .../lib/http_multi_server.dart | 28 ++++++++----------- pkgs/http_multi_server/pubspec.yaml | 4 +-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index df1b863bba..1db0a15433 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.0.0 + +* **Breaking:** Change the signature of `HttpMultiServer.loopbackSecure()` to + match the new Dart 1.13 `HttpServer.bindSecure()` signature. This removes the + `certificateName` named parameter and adds the required `context` parameter + and the named `v6Only` and `shared` parameters. + +* Added `v6Only` and `shared` parameters to `HttpMultiServer.loopback()` to + match `HttpServer.bind()`. + ## 1.3.2 * Eventually stop retrying port allocation if it fails repeatedly. diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index abad76ebb9..12b6e4069e 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -93,33 +93,27 @@ class HttpMultiServer extends StreamView implements HttpServer { /// Creates an [HttpServer] listening on all available loopback addresses for /// this computer. /// - /// If this computer supports both IPv4 and IPv6, this returns an - /// [HttpMultiServer] listening to [port] on both loopback addresses. - /// Otherwise, it returns a normal [HttpServer] listening only on the IPv4 - /// address. - /// - /// If [port] is 0, the same ephemeral port is used for both the IPv4 and IPv6 - /// addresses. - static Future loopback(int port, {int backlog}) { + /// See [HttpServer.bind]. + static Future loopback(int port, {int backlog, bool v6Only: false, + bool shared: false}) { if (backlog == null) backlog = 0; return _loopback(port, (address, port) => - HttpServer.bind(address, port, backlog: backlog)); + HttpServer.bind(address, port, + backlog: backlog, v6Only: v6Only, shared: shared)); } /// Like [loopback], but supports HTTPS requests. /// - /// The certificate with nickname or distinguished name (DN) [certificateName] - /// is looked up in the certificate database, and is used as the server - /// certificate. If [requestClientCertificate] is true, the server will - /// request clients to authenticate with a client certificate. - static Future loopbackSecure(int port, {int backlog, - String certificateName, bool requestClientCertificate: false}) { + /// See [HttpServer.bindSecure]. + static Future loopbackSecure(int port, SecurityContext context, + {int backlog, bool v6Only: false, bool requestClientCertificate: false, + bool shared: false}) { if (backlog == null) backlog = 0; return _loopback(port, (address, port) => - HttpServer.bindSecure(address, port, backlog: backlog, - certificateName: certificateName, + HttpServer.bindSecure(address, port, context, + backlog: backlog, v6Only: v6Only, shared: shared, requestClientCertificate: requestClientCertificate)); } diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index e6f9a971a5..44daa8fa99 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 1.3.3-dev +version: 2.0.0 author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: @@ -8,4 +8,4 @@ dev_dependencies: test: ">=0.12.0 <0.13.0" http: ">=0.11.0 <0.12.0" environment: - sdk: ">=1.7.0-edge.40587 <2.0.0" + sdk: ">=1.13.0 <2.0.0" From ce0dd312dd104dfabef11c9ab43baf3262c649b5 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 12 Jan 2016 17:20:55 -0800 Subject: [PATCH 021/107] Get rid of all the library tags. R=rnystrom@google.com Review URL: https://codereview.chromium.org//1577413003 . --- pkgs/http_multi_server/lib/http_multi_server.dart | 2 -- pkgs/http_multi_server/lib/src/multi_headers.dart | 2 -- pkgs/http_multi_server/lib/src/utils.dart | 2 -- pkgs/http_multi_server/test/http_multi_server_test.dart | 2 -- 4 files changed, 8 deletions(-) diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 12b6e4069e..6c4e4685be 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library http_multi_server; - import 'dart:async'; import 'dart:io'; diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart index fcd782cfce..a42280f242 100644 --- a/pkgs/http_multi_server/lib/src/multi_headers.dart +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library http_multi_server.multi_headers; - import 'dart:io'; /// A class that delegates header access and setting to many [HttpHeaders] diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index 9e95aba5f9..ceb5c82f87 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library http_multi_server.utils; - import 'dart:async'; import 'dart:io'; diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 889a4cdd1f..4aacab12f6 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library http_multi_server.test; - import 'dart:async'; import 'dart:io'; From 4df9fdfd3ee24b086614ee98900ee5916af63cbc Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 31 Mar 2016 17:12:32 -0700 Subject: [PATCH 022/107] Fix most strong mode warnings. There are two remaining warnings. One will go away when a strong mode version of the analyzer has been released; the other will go away when dart-lang/sdkdart-lang/http_multi_server#26143 is fixed. R=jmesserly@google.com Review URL: https://codereview.chromium.org//1843323002 . --- pkgs/http_multi_server/.analysis_options | 2 + pkgs/http_multi_server/CHANGELOG.md | 4 ++ .../lib/http_multi_server.dart | 46 ++++++++---------- pkgs/http_multi_server/lib/src/utils.dart | 48 +++---------------- pkgs/http_multi_server/pubspec.yaml | 3 +- 5 files changed, 34 insertions(+), 69 deletions(-) create mode 100644 pkgs/http_multi_server/.analysis_options diff --git a/pkgs/http_multi_server/.analysis_options b/pkgs/http_multi_server/.analysis_options new file mode 100644 index 0000000000..a10d4c5a05 --- /dev/null +++ b/pkgs/http_multi_server/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 1db0a15433..198b1b6786 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.1 + +* Fix most strong mode errors and warnings. + ## 2.0.0 * **Breaking:** Change the signature of `HttpMultiServer.loopbackSecure()` to diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 6c4e4685be..18d42cfd3c 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -5,6 +5,8 @@ import 'dart:async'; import 'dart:io'; +import 'package:async/async.dart'; + import 'src/multi_headers.dart'; import 'src/utils.dart'; @@ -86,7 +88,7 @@ class HttpMultiServer extends StreamView implements HttpServer { : _servers = servers.toSet(), defaultResponseHeaders = new MultiHeaders( servers.map((server) => server.defaultResponseHeaders)), - super(mergeStreams(servers)); + super(StreamGroup.merge(servers)); /// Creates an [HttpServer] listening on all available loopback addresses for /// this computer. @@ -121,36 +123,28 @@ class HttpMultiServer extends StreamView implements HttpServer { /// [HttpServer.bindSecure]. static Future _loopback(int port, Future bind(InternetAddress address, int port), - [int remainingRetries]) { + [int remainingRetries]) async { if (remainingRetries == null) remainingRetries = 5; - return Future.wait([ - supportsIpV6, - bind(InternetAddress.LOOPBACK_IP_V4, port) - ]).then((results) { - var supportsIpV6 = results[0]; - var v4Server = results[1]; - - if (!supportsIpV6) return v4Server; + var v4Server = await bind(InternetAddress.LOOPBACK_IP_V4, port); + if (!await supportsIpV6) return v4Server; + try { // Reuse the IPv4 server's port so that if [port] is 0, both servers use // the same ephemeral port. - return bind(InternetAddress.LOOPBACK_IP_V6, v4Server.port) - .then((v6Server) { - return new HttpMultiServer([v4Server, v6Server]); - }).catchError((error) { - if (error is! SocketException) throw error; - if (error.osError.errorCode != _addressInUseErrno) throw error; - if (port != 0) throw error; - if (remainingRetries == 0) throw error; - - // A port being available on IPv4 doesn't necessarily mean that the same - // port is available on IPv6. If it's not (which is rare in practice), - // we try again until we find one that's available on both. - v4Server.close(); - return _loopback(port, bind, remainingRetries - 1); - }); - }); + var v6Server = await bind(InternetAddress.LOOPBACK_IP_V6, v4Server.port); + return new HttpMultiServer([v4Server, v6Server]); + } on SocketException catch (error) { + if (error.osError.errorCode != _addressInUseErrno) rethrow; + if (port != 0) rethrow; + if (remainingRetries == 0) rethrow; + + // A port being available on IPv4 doesn't necessarily mean that the same + // port is available on IPv6. If it's not (which is rare in practice), + // we try again until we find one that's available on both. + v4Server.close(); + return await _loopback(port, bind, remainingRetries - 1); + } } Future close({bool force: false}) => diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index ceb5c82f87..19188cbe7f 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -5,56 +5,20 @@ import 'dart:async'; import 'dart:io'; -/// Merges all streams in [streams] into a single stream that emits all of their -/// values. -/// -/// The returned stream will be closed only when every stream in [streams] is -/// closed. -Stream mergeStreams(Iterable streams) { - var subscriptions = new Set(); - var controller; - controller = new StreamController(onListen: () { - for (var stream in streams) { - var subscription; - subscription = stream.listen(controller.add, - onError: controller.addError, - onDone: () { - subscriptions.remove(subscription); - if (subscriptions.isEmpty) controller.close(); - }); - subscriptions.add(subscription); - } - }, onCancel: () { - for (var subscription in subscriptions) { - subscription.cancel(); - } - }, onPause: () { - for (var subscription in subscriptions) { - subscription.pause(); - } - }, onResume: () { - for (var subscription in subscriptions) { - subscription.resume(); - } - }, sync: true); - - return controller.stream; -} - /// A cache for [supportsIpV6]. bool _supportsIpV6; /// Returns whether this computer supports binding to IPv6 addresses. -Future get supportsIpV6 { - if (_supportsIpV6 != null) return new Future.value(_supportsIpV6); +Future get supportsIpV6 async { + if (_supportsIpV6 != null) return _supportsIpV6; - return ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0).then((socket) { + try { + var socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0); _supportsIpV6 = true; socket.close(); return true; - }).catchError((error) { - if (error is! SocketException) throw error; + } on SocketException catch (_) { _supportsIpV6 = false; return false; - }); + } } diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 44daa8fa99..647b7eb50e 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,10 +1,11 @@ name: http_multi_server -version: 2.0.0 +version: 2.0.1 author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: A dart:io HttpServer wrapper that handles requests from multiple servers. dev_dependencies: + async: "^1.2.0" test: ">=0.12.0 <0.13.0" http: ">=0.11.0 <0.12.0" environment: From f09d35a481372e72074665b46bd978711105b2b6 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Mon, 20 Jun 2016 14:20:49 -0700 Subject: [PATCH 023/107] Properly depend on async. We had this as a dev dependency, but we were importing it from lib. R=jmesserly@google.com Review URL: https://codereview.chromium.org//2074573002 . --- pkgs/http_multi_server/CHANGELOG.md | 4 ++++ pkgs/http_multi_server/pubspec.yaml | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 198b1b6786..5e450563ad 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.2 + +* Fix a dependency that was incorrectly marked as dev-only. + ## 2.0.1 * Fix most strong mode errors and warnings. diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 647b7eb50e..37bb75e7fd 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,11 +1,12 @@ name: http_multi_server -version: 2.0.1 +version: 2.0.2 author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: A dart:io HttpServer wrapper that handles requests from multiple servers. -dev_dependencies: +dependencies: async: "^1.2.0" +dev_dependencies: test: ">=0.12.0 <0.13.0" http: ">=0.11.0 <0.12.0" environment: From 230a641493a9b4107d0bd35ddbaa750368080572 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 25 Oct 2016 14:13:28 -0700 Subject: [PATCH 024/107] Work in IPv6-only environments. (dart-lang/http_multi_server#2) --- pkgs/http_multi_server/CHANGELOG.md | 5 +++++ .../lib/http_multi_server.dart | 8 +++++-- pkgs/http_multi_server/lib/src/utils.dart | 22 +++++++++++-------- pkgs/http_multi_server/pubspec.yaml | 2 +- .../test/http_multi_server_test.dart | 13 ++++++----- 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 5e450563ad..a3cb13f6be 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.3 + +* Fix `HttpMultiServer.loopback()` and `.loopbackSecure()` for environments that + don't support IPv4. + ## 2.0.2 * Fix a dependency that was incorrectly marked as dev-only. diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 18d42cfd3c..1f5bddd83b 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -124,10 +124,14 @@ class HttpMultiServer extends StreamView implements HttpServer { static Future _loopback(int port, Future bind(InternetAddress address, int port), [int remainingRetries]) async { - if (remainingRetries == null) remainingRetries = 5; + remainingRetries ??= 5; + + if (!await supportsIPv4) { + return await bind(InternetAddress.LOOPBACK_IP_V6, port); + } var v4Server = await bind(InternetAddress.LOOPBACK_IP_V4, port); - if (!await supportsIpV6) return v4Server; + if (!await supportsIPv6) return v4Server; try { // Reuse the IPv4 server's port so that if [port] is 0, both servers use diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index 19188cbe7f..21c335cc17 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -5,20 +5,24 @@ import 'dart:async'; import 'dart:io'; -/// A cache for [supportsIpV6]. -bool _supportsIpV6; - /// Returns whether this computer supports binding to IPv6 addresses. -Future get supportsIpV6 async { - if (_supportsIpV6 != null) return _supportsIpV6; - +final Future supportsIPv6 = () async { try { var socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0); - _supportsIpV6 = true; socket.close(); return true; } on SocketException catch (_) { - _supportsIpV6 = false; return false; } -} +}(); + +/// Returns whether this computer supports binding to IPv4 addresses. +final Future supportsIPv4 = () async { + try { + var socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0); + socket.close(); + return true; + } on SocketException catch (_) { + return false; + } +}(); diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 37bb75e7fd..9beaa7d171 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 2.0.2 +version: 2.0.3 author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 4aacab12f6..9468cfe0df 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -140,20 +140,21 @@ void main() { tearDown(() => server.close()); - test("listens on all localhost interfaces", () { + test("listens on all localhost interfaces", () async { server.listen((request) { request.response.write("got request"); request.response.close(); }); - expect(http.read("http://127.0.0.1:${server.port}/"), - completion(equals("got request"))); + if (await supportsIPv4) { + expect(http.read("http://127.0.0.1:${server.port}/"), + completion(equals("got request"))); + } - return supportsIpV6.then((supportsIpV6) { - if (!supportsIpV6) return; + if (await supportsIPv4) { expect(http.read("http://[::1]:${server.port}/"), completion(equals("got request"))); - }); + } }); }); } From 3f161f5cb361e5e894ddb64da3921bac648ad2db Mon Sep 17 00:00:00 2001 From: Keerti Parthasarathy Date: Wed, 21 Jun 2017 09:24:59 -0700 Subject: [PATCH 025/107] Change '127.0.0.1' to 'localhost' to support both IPv4 and IPv6 envs. BUG= R=nweiz@google.com Review-Url: https://codereview.chromium.org//2950883002 . --- pkgs/http_multi_server/pubspec.yaml | 2 +- pkgs/http_multi_server/test/http_multi_server_test.dart | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 9beaa7d171..124852852d 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 2.0.3 +version: 2.0.4-dev author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 9468cfe0df..d638a48386 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -18,9 +18,9 @@ void main() { var subServer3; setUp(() { return Future.wait([ - HttpServer.bind("127.0.0.1", 0).then((server) => subServer1 = server), - HttpServer.bind("127.0.0.1", 0).then((server) => subServer2 = server), - HttpServer.bind("127.0.0.1", 0).then((server) => subServer3 = server) + HttpServer.bind("localhost", 0).then((server) => subServer1 = server), + HttpServer.bind("localhost", 0).then((server) => subServer2 = server), + HttpServer.bind("localhost", 0).then((server) => subServer3 = server) ]).then((servers) => multiServer = new HttpMultiServer(servers)); }); @@ -151,7 +151,7 @@ void main() { completion(equals("got request"))); } - if (await supportsIPv4) { + if (await supportsIPv6) { expect(http.read("http://[::1]:${server.port}/"), completion(equals("got request"))); } From d0507f6582372538b61b71afdbfcb69f2ee5c298 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Tue, 7 Feb 2017 09:49:34 -0800 Subject: [PATCH 026/107] Add travis-ci support --- pkgs/http_multi_server/.travis.yml | 18 ++++++++++++++++++ pkgs/http_multi_server/pubspec.yaml | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 pkgs/http_multi_server/.travis.yml diff --git a/pkgs/http_multi_server/.travis.yml b/pkgs/http_multi_server/.travis.yml new file mode 100644 index 0000000000..74d7d9c25d --- /dev/null +++ b/pkgs/http_multi_server/.travis.yml @@ -0,0 +1,18 @@ +language: dart +sudo: false +dart: + - dev + - stable + +dart_task: + - test + - dartfmt + - dartanalyzer + +# Only building master means that we don't run two builds for each pull request. +branches: + only: [master] + +cache: + directories: + - $HOME/.pub-cache diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 124852852d..4f6f238bf4 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -4,10 +4,10 @@ author: "Dart Team " homepage: http://github.com/dart-lang/http_multi_server description: A dart:io HttpServer wrapper that handles requests from multiple servers. +environment: + sdk: ">=1.13.0 <2.0.0-dev.infinity" dependencies: async: "^1.2.0" dev_dependencies: test: ">=0.12.0 <0.13.0" http: ">=0.11.0 <0.12.0" -environment: - sdk: ">=1.13.0 <2.0.0" From b37ced874b8ee9f1408d2d08e9a95fb3891ba401 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 2 Aug 2017 10:30:34 -0700 Subject: [PATCH 027/107] Use the correct name for analysis_options --- .../{.analysis_options => analysis_options.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pkgs/http_multi_server/{.analysis_options => analysis_options.yaml} (100%) diff --git a/pkgs/http_multi_server/.analysis_options b/pkgs/http_multi_server/analysis_options.yaml similarity index 100% rename from pkgs/http_multi_server/.analysis_options rename to pkgs/http_multi_server/analysis_options.yaml From 19903c0f433780d77db598c2a8aabdc26fc9788a Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 2 Aug 2017 10:40:30 -0700 Subject: [PATCH 028/107] dartfmt --- .../lib/http_multi_server.dart | 26 +++-- .../lib/src/multi_headers.dart | 5 +- .../test/http_multi_server_test.dart | 94 ++++++++++++------- 3 files changed, 77 insertions(+), 48 deletions(-) diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 1f5bddd83b..b57e46cfc0 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -94,12 +94,13 @@ class HttpMultiServer extends StreamView implements HttpServer { /// this computer. /// /// See [HttpServer.bind]. - static Future loopback(int port, {int backlog, bool v6Only: false, - bool shared: false}) { + static Future loopback(int port, + {int backlog, bool v6Only: false, bool shared: false}) { if (backlog == null) backlog = 0; - return _loopback(port, (address, port) => - HttpServer.bind(address, port, + return _loopback( + port, + (address, port) => HttpServer.bind(address, port, backlog: backlog, v6Only: v6Only, shared: shared)); } @@ -107,13 +108,18 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// See [HttpServer.bindSecure]. static Future loopbackSecure(int port, SecurityContext context, - {int backlog, bool v6Only: false, bool requestClientCertificate: false, + {int backlog, + bool v6Only: false, + bool requestClientCertificate: false, bool shared: false}) { if (backlog == null) backlog = 0; - return _loopback(port, (address, port) => - HttpServer.bindSecure(address, port, context, - backlog: backlog, v6Only: v6Only, shared: shared, + return _loopback( + port, + (address, port) => HttpServer.bindSecure(address, port, context, + backlog: backlog, + v6Only: v6Only, + shared: shared, requestClientCertificate: requestClientCertificate)); } @@ -121,8 +127,8 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// [bind] should forward to either [HttpServer.bind] or /// [HttpServer.bindSecure]. - static Future _loopback(int port, - Future bind(InternetAddress address, int port), + static Future _loopback( + int port, Future bind(InternetAddress address, int port), [int remainingRetries]) async { remainingRetries ??= 5; diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart index a42280f242..9267aee196 100644 --- a/pkgs/http_multi_server/lib/src/multi_headers.dart +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -73,8 +73,7 @@ class MultiHeaders implements HttpHeaders { } } - MultiHeaders(Iterable headers) - : _headers = headers.toSet(); + MultiHeaders(Iterable headers) : _headers = headers.toSet(); void add(String name, Object value) { for (var headers in _headers) { @@ -111,7 +110,7 @@ class MultiHeaders implements HttpHeaders { String value(String name) => _headers.first.value(name); - List operator[](String name) => _headers.first[name]; + List operator [](String name) => _headers.first[name]; void clear() { for (var headers in _headers) { diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index d638a48386..9c7becf5cb 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -45,17 +45,26 @@ void main() { request.response.close(); }); - expect(_get(subServer1).then((response) { - expect(response.headers['server'], equals("http_multi_server test")); - }), completes); - - expect(_get(subServer2).then((response) { - expect(response.headers['server'], equals("http_multi_server test")); - }), completes); - - expect(_get(subServer3).then((response) { - expect(response.headers['server'], equals("http_multi_server test")); - }), completes); + expect( + _get(subServer1).then((response) { + expect( + response.headers['server'], equals("http_multi_server test")); + }), + completes); + + expect( + _get(subServer2).then((response) { + expect( + response.headers['server'], equals("http_multi_server test")); + }), + completes); + + expect( + _get(subServer3).then((response) { + expect( + response.headers['server'], equals("http_multi_server test")); + }), + completes); }); test("autoCompress= sets the value for all servers", () { @@ -66,39 +75,54 @@ void main() { request.response.close(); }); - expect(_get(subServer1).then((response) { - expect(response.headers['content-encoding'], equals("gzip")); - }), completes); - - expect(_get(subServer2).then((response) { - expect(response.headers['content-encoding'], equals("gzip")); - }), completes); - - expect(_get(subServer3).then((response) { - expect(response.headers['content-encoding'], equals("gzip")); - }), completes); + expect( + _get(subServer1).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), + completes); + + expect( + _get(subServer2).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), + completes); + + expect( + _get(subServer3).then((response) { + expect(response.headers['content-encoding'], equals("gzip")); + }), + completes); }); test("headers.set sets the value for all servers", () { - multiServer.defaultResponseHeaders.set( - "server", "http_multi_server test"); + multiServer.defaultResponseHeaders + .set("server", "http_multi_server test"); multiServer.listen((request) { request.response.write("got request"); request.response.close(); }); - expect(_get(subServer1).then((response) { - expect(response.headers['server'], equals("http_multi_server test")); - }), completes); - - expect(_get(subServer2).then((response) { - expect(response.headers['server'], equals("http_multi_server test")); - }), completes); - - expect(_get(subServer3).then((response) { - expect(response.headers['server'], equals("http_multi_server test")); - }), completes); + expect( + _get(subServer1).then((response) { + expect( + response.headers['server'], equals("http_multi_server test")); + }), + completes); + + expect( + _get(subServer2).then((response) { + expect( + response.headers['server'], equals("http_multi_server test")); + }), + completes); + + expect( + _get(subServer3).then((response) { + expect( + response.headers['server'], equals("http_multi_server test")); + }), + completes); }); test("connectionsInfo sums the values for all servers", () { From f2df08338e42e3d077d8a12f51a41e181a09306f Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 2 Aug 2017 12:07:14 -0700 Subject: [PATCH 029/107] Homepage: use https (dart-lang/http_multi_server#4) --- pkgs/http_multi_server/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 4f6f238bf4..e491d72b34 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,7 +1,7 @@ name: http_multi_server version: 2.0.4-dev author: "Dart Team " -homepage: http://github.com/dart-lang/http_multi_server +homepage: https://github.com/dart-lang/http_multi_server description: A dart:io HttpServer wrapper that handles requests from multiple servers. environment: From c174b74f0c96a408f691fae54a80befab84b7024 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 18 Sep 2017 18:10:30 -0700 Subject: [PATCH 030/107] Remove -dev.infinity in SDK upper constraint --- pkgs/http_multi_server/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index e491d72b34..243e070328 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://github.com/dart-lang/http_multi_server description: A dart:io HttpServer wrapper that handles requests from multiple servers. environment: - sdk: ">=1.13.0 <2.0.0-dev.infinity" + sdk: ">=1.13.0 <2.0.0" dependencies: async: "^1.2.0" dev_dependencies: From d08c3ca2b48b5775295475cff996dc235c381236 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Fri, 22 Sep 2017 13:42:45 -0700 Subject: [PATCH 031/107] Declare support for async 2.0.0 (dart-lang/http_multi_server#5) --- pkgs/http_multi_server/CHANGELOG.md | 4 ++++ pkgs/http_multi_server/pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index a3cb13f6be..824ba4677a 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.4 + +* Declare support for `async` 2.0.0. + ## 2.0.3 * Fix `HttpMultiServer.loopback()` and `.loopbackSecure()` for environments that diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 243e070328..7d4114ac4f 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 2.0.4-dev +version: 2.0.4 author: "Dart Team " homepage: https://github.com/dart-lang/http_multi_server description: @@ -7,7 +7,7 @@ description: environment: sdk: ">=1.13.0 <2.0.0" dependencies: - async: "^1.2.0" + async: ">=1.2.0 <3.0.0" dev_dependencies: test: ">=0.12.0 <0.13.0" http: ">=0.11.0 <0.12.0" From 2cd3d6324a7761f5315701cad3a7377fac4f73fa Mon Sep 17 00:00:00 2001 From: BC Ko Date: Thu, 24 May 2018 13:29:27 -0700 Subject: [PATCH 032/107] Update .gitignore to new `dart_tool` pub cache dart-lang/sdkdart-lang/http_multi_server#32030 --- pkgs/http_multi_server/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/.gitignore b/pkgs/http_multi_server/.gitignore index 7dbf0350d6..ab3cb76e6a 100644 --- a/pkgs/http_multi_server/.gitignore +++ b/pkgs/http_multi_server/.gitignore @@ -1,5 +1,6 @@ # Don’t commit the following directories created by pub. .buildlog +.dart_tool/ .pub/ build/ packages @@ -12,4 +13,4 @@ packages *.js.map # Include when developing application packages. -pubspec.lock \ No newline at end of file +pubspec.lock From 883b045d5c825883c5c5c0e1c45bccb0b91730b0 Mon Sep 17 00:00:00 2001 From: BC Ko Date: Mon, 28 May 2018 11:15:41 -0700 Subject: [PATCH 033/107] remove .pub and packages --- pkgs/http_multi_server/.gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/http_multi_server/.gitignore b/pkgs/http_multi_server/.gitignore index ab3cb76e6a..e98dd1481e 100644 --- a/pkgs/http_multi_server/.gitignore +++ b/pkgs/http_multi_server/.gitignore @@ -1,10 +1,8 @@ # Don’t commit the following directories created by pub. .buildlog .dart_tool/ -.pub/ -build/ -packages .packages +build/ # Or the files created by dart2js. *.dart.js From 46a61352fe5f2c4aaa3a0578ae28b08337aa8cc0 Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Fri, 1 Jun 2018 14:44:13 +0200 Subject: [PATCH 034/107] Update SDK to version 2.0.0-dev.55.0. (dart-lang/http_multi_server#8) Remove use of deprecated constants. --- pkgs/http_multi_server/.travis.yml | 1 - pkgs/http_multi_server/CHANGELOG.md | 4 ++++ pkgs/http_multi_server/lib/http_multi_server.dart | 6 +++--- pkgs/http_multi_server/lib/src/utils.dart | 4 ++-- pkgs/http_multi_server/pubspec.yaml | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pkgs/http_multi_server/.travis.yml b/pkgs/http_multi_server/.travis.yml index 74d7d9c25d..9c44c0b35b 100644 --- a/pkgs/http_multi_server/.travis.yml +++ b/pkgs/http_multi_server/.travis.yml @@ -2,7 +2,6 @@ language: dart sudo: false dart: - dev - - stable dart_task: - test diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 824ba4677a..2b737e19b9 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.5 + +* Update SDK to 2.0.0-dev. + ## 2.0.4 * Declare support for `async` 2.0.0. diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index b57e46cfc0..309e57fa5c 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -133,16 +133,16 @@ class HttpMultiServer extends StreamView implements HttpServer { remainingRetries ??= 5; if (!await supportsIPv4) { - return await bind(InternetAddress.LOOPBACK_IP_V6, port); + return await bind(InternetAddress.loopbackIPv6, port); } - var v4Server = await bind(InternetAddress.LOOPBACK_IP_V4, port); + var v4Server = await bind(InternetAddress.loopbackIPv4, port); if (!await supportsIPv6) return v4Server; try { // Reuse the IPv4 server's port so that if [port] is 0, both servers use // the same ephemeral port. - var v6Server = await bind(InternetAddress.LOOPBACK_IP_V6, v4Server.port); + var v6Server = await bind(InternetAddress.loopbackIPv6, v4Server.port); return new HttpMultiServer([v4Server, v6Server]); } on SocketException catch (error) { if (error.osError.errorCode != _addressInUseErrno) rethrow; diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index 21c335cc17..3d24a03d14 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -8,7 +8,7 @@ import 'dart:io'; /// Returns whether this computer supports binding to IPv6 addresses. final Future supportsIPv6 = () async { try { - var socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0); + var socket = await ServerSocket.bind(InternetAddress.loopbackIPv6, 0); socket.close(); return true; } on SocketException catch (_) { @@ -19,7 +19,7 @@ final Future supportsIPv6 = () async { /// Returns whether this computer supports binding to IPv4 addresses. final Future supportsIPv4 = () async { try { - var socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0); + var socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0); socket.close(); return true; } on SocketException catch (_) { diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 7d4114ac4f..ad1bfcc504 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,11 +1,11 @@ name: http_multi_server -version: 2.0.4 +version: 2.0.5 author: "Dart Team " homepage: https://github.com/dart-lang/http_multi_server description: A dart:io HttpServer wrapper that handles requests from multiple servers. environment: - sdk: ">=1.13.0 <2.0.0" + sdk: ">=2.0.0-dev.55.0 <3.0.0" dependencies: async: ">=1.2.0 <3.0.0" dev_dependencies: From 031fd1dcfb06439c14378cae68402e1389dd3183 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 19 Jul 2018 15:03:13 -0400 Subject: [PATCH 035/107] Dart 2 cleanup (dart-lang/http_multi_server#10) --- pkgs/http_multi_server/CHANGELOG.md | 2 +- pkgs/http_multi_server/analysis_options.yaml | 2 -- pkgs/http_multi_server/pubspec.yaml | 19 +++++++++++-------- 3 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 pkgs/http_multi_server/analysis_options.yaml diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 2b737e19b9..84a9e21955 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,6 +1,6 @@ ## 2.0.5 -* Update SDK to 2.0.0-dev. +* Update SDK constraints to `>=2.0.0-dev <3.0.0`. ## 2.0.4 diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml deleted file mode 100644 index a10d4c5a05..0000000000 --- a/pkgs/http_multi_server/analysis_options.yaml +++ /dev/null @@ -1,2 +0,0 @@ -analyzer: - strong-mode: true diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index ad1bfcc504..fb7a3a8360 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,13 +1,16 @@ name: http_multi_server -version: 2.0.5 -author: "Dart Team " +version: 2.0.6-dev + +description: A dart:io HttpServer wrapper that handles requests from multiple servers. +author: Dart Team homepage: https://github.com/dart-lang/http_multi_server -description: - A dart:io HttpServer wrapper that handles requests from multiple servers. + environment: - sdk: ">=2.0.0-dev.55.0 <3.0.0" + sdk: '>=2.0.0-dev.55.0 <3.0.0' + dependencies: - async: ">=1.2.0 <3.0.0" + async: '>=1.2.0 <3.0.0' + dev_dependencies: - test: ">=0.12.0 <0.13.0" - http: ">=0.11.0 <0.12.0" + http: '>=0.11.0 <0.12.0' + test: '>=0.12.0 <2.0.0' From ef7eba444172c73c604a6cdd7fa606e9b910867c Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Fri, 18 Jan 2019 10:20:43 -0800 Subject: [PATCH 036/107] Update dev deps to latest --- pkgs/http_multi_server/pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index fb7a3a8360..1bf6a8efe1 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -12,5 +12,5 @@ dependencies: async: '>=1.2.0 <3.0.0' dev_dependencies: - http: '>=0.11.0 <0.12.0' - test: '>=0.12.0 <2.0.0' + http: ^0.12.0 + test: ^1.5.2 From 7e75f3ca39dde741043dbbf0f4a8d87f621d2272 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Fri, 18 Jan 2019 10:24:06 -0800 Subject: [PATCH 037/107] enable and fix a number of lints --- pkgs/http_multi_server/analysis_options.yaml | 44 +++++++++++++++++++ .../lib/http_multi_server.dart | 18 ++++---- pkgs/http_multi_server/lib/src/utils.dart | 4 +- pkgs/http_multi_server/pubspec.yaml | 1 + .../test/http_multi_server_test.dart | 14 +++--- 5 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 pkgs/http_multi_server/analysis_options.yaml diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml new file mode 100644 index 0000000000..6f476fe9c5 --- /dev/null +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -0,0 +1,44 @@ +include: package:pedantic/analysis_options.yaml +analyzer: + strong-mode: + implicit-casts: false +linter: + rules: + - avoid_empty_else + - avoid_init_to_null + - avoid_null_checks_in_equality_operators + - avoid_unused_constructor_parameters + - await_only_futures + - camel_case_types + - cancel_subscriptions + - constant_identifier_names + - control_flow_in_finally + - directives_ordering + - empty_catches + - empty_constructor_bodies + - empty_statements + - hash_and_equals + - implementation_imports + - iterable_contains_unrelated_type + - library_names + - library_prefixes + - list_remove_unrelated_type + - non_constant_identifier_names + - overridden_fields + - package_api_docs + - package_names + - package_prefixed_library_names + - prefer_equal_for_default_values + - prefer_final_fields + - prefer_generic_function_type_aliases + - prefer_is_not_empty + - slash_for_doc_comments + - super_goes_last + - test_types_in_equals + - throw_in_finally + - type_init_formals + - unnecessary_brace_in_string_interps + - unnecessary_const + - unnecessary_new + - unrelated_type_equality_checks + - valid_regexps diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 309e57fa5c..22c6d62718 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -86,7 +86,7 @@ class HttpMultiServer extends StreamView implements HttpServer { /// listened to when this is called. HttpMultiServer(Iterable servers) : _servers = servers.toSet(), - defaultResponseHeaders = new MultiHeaders( + defaultResponseHeaders = MultiHeaders( servers.map((server) => server.defaultResponseHeaders)), super(StreamGroup.merge(servers)); @@ -95,7 +95,7 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// See [HttpServer.bind]. static Future loopback(int port, - {int backlog, bool v6Only: false, bool shared: false}) { + {int backlog, bool v6Only = false, bool shared = false}) { if (backlog == null) backlog = 0; return _loopback( @@ -109,9 +109,9 @@ class HttpMultiServer extends StreamView implements HttpServer { /// See [HttpServer.bindSecure]. static Future loopbackSecure(int port, SecurityContext context, {int backlog, - bool v6Only: false, - bool requestClientCertificate: false, - bool shared: false}) { + bool v6Only = false, + bool requestClientCertificate = false, + bool shared = false}) { if (backlog == null) backlog = 0; return _loopback( @@ -143,7 +143,7 @@ class HttpMultiServer extends StreamView implements HttpServer { // Reuse the IPv4 server's port so that if [port] is 0, both servers use // the same ephemeral port. var v6Server = await bind(InternetAddress.loopbackIPv6, v4Server.port); - return new HttpMultiServer([v4Server, v6Server]); + return HttpMultiServer([v4Server, v6Server]); } on SocketException catch (error) { if (error.osError.errorCode != _addressInUseErrno) rethrow; if (port != 0) rethrow; @@ -152,18 +152,18 @@ class HttpMultiServer extends StreamView implements HttpServer { // A port being available on IPv4 doesn't necessarily mean that the same // port is available on IPv6. If it's not (which is rare in practice), // we try again until we find one that's available on both. - v4Server.close(); + await v4Server.close(); return await _loopback(port, bind, remainingRetries - 1); } } - Future close({bool force: false}) => + Future close({bool force = false}) => Future.wait(_servers.map((server) => server.close(force: force))); /// Returns an HttpConnectionsInfo object summarizing the total number of /// current connections handled by all the servers. HttpConnectionsInfo connectionsInfo() { - var info = new HttpConnectionsInfo(); + var info = HttpConnectionsInfo(); for (var server in _servers) { var subInfo = server.connectionsInfo(); info.total += subInfo.total; diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index 3d24a03d14..2709dabec8 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -9,7 +9,7 @@ import 'dart:io'; final Future supportsIPv6 = () async { try { var socket = await ServerSocket.bind(InternetAddress.loopbackIPv6, 0); - socket.close(); + await socket.close(); return true; } on SocketException catch (_) { return false; @@ -20,7 +20,7 @@ final Future supportsIPv6 = () async { final Future supportsIPv4 = () async { try { var socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0); - socket.close(); + await socket.close(); return true; } on SocketException catch (_) { return false; diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 1bf6a8efe1..01fd07a5ac 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -13,4 +13,5 @@ dependencies: dev_dependencies: http: ^0.12.0 + pedantic: ^1.4.0 test: ^1.5.2 diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 9c7becf5cb..a61212ea8a 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -13,15 +13,15 @@ import 'package:test/test.dart'; void main() { group("with multiple HttpServers", () { var multiServer; - var subServer1; - var subServer2; - var subServer3; + HttpServer subServer1; + HttpServer subServer2; + HttpServer subServer3; setUp(() { return Future.wait([ HttpServer.bind("localhost", 0).then((server) => subServer1 = server), HttpServer.bind("localhost", 0).then((server) => subServer2 = server), HttpServer.bind("localhost", 0).then((server) => subServer3 = server) - ]).then((servers) => multiServer = new HttpMultiServer(servers)); + ]).then((servers) => multiServer = HttpMultiServer(servers)); }); tearDown(() => multiServer.close()); @@ -127,8 +127,8 @@ void main() { test("connectionsInfo sums the values for all servers", () { var pendingRequests = 0; - var awaitingResponseCompleter = new Completer(); - var sendResponseCompleter = new Completer(); + var awaitingResponseCompleter = Completer(); + var sendResponseCompleter = Completer(); multiServer.listen((request) { sendResponseCompleter.future.then((_) { request.response.write("got request"); @@ -159,7 +159,7 @@ void main() { group("HttpMultiServer.loopback", () { var server; setUp(() { - return HttpMultiServer.loopback(0).then((server_) => server = server_); + return HttpMultiServer.loopback(0).then((s) => server = s); }); tearDown(() => server.close()); From 44177a31985a9cb94babea1c0a06bac9196df3f9 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Thu, 25 Apr 2019 12:28:40 -0700 Subject: [PATCH 038/107] Close Ipv4 server when failing to start Ipv6 (dart-lang/http_multi_server#12) Fixes a bug that could prevent the VM from shutting down if there is a port conflict with Ipv6 but not Ipv4. --- pkgs/http_multi_server/CHANGELOG.md | 5 +++++ pkgs/http_multi_server/lib/http_multi_server.dart | 5 ++++- pkgs/http_multi_server/pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 84a9e21955..c03d6364e8 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.6 + +* If there is a problem starting a loopback Ipv6 server, don't keep the Ipv4 + server open when throwing the exception. + ## 2.0.5 * Update SDK constraints to `>=2.0.0-dev <3.0.0`. diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 22c6d62718..562092d1f2 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -145,6 +145,10 @@ class HttpMultiServer extends StreamView implements HttpServer { var v6Server = await bind(InternetAddress.loopbackIPv6, v4Server.port); return HttpMultiServer([v4Server, v6Server]); } on SocketException catch (error) { + // If there is already a server listening we'll lose the reference on a + // rethrow. + await v4Server.close(); + if (error.osError.errorCode != _addressInUseErrno) rethrow; if (port != 0) rethrow; if (remainingRetries == 0) rethrow; @@ -152,7 +156,6 @@ class HttpMultiServer extends StreamView implements HttpServer { // A port being available on IPv4 doesn't necessarily mean that the same // port is available on IPv6. If it's not (which is rare in practice), // we try again until we find one that's available on both. - await v4Server.close(); return await _loopback(port, bind, remainingRetries - 1); } } diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 01fd07a5ac..175c5bc6c8 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 2.0.6-dev +version: 2.0.6 description: A dart:io HttpServer wrapper that handles requests from multiple servers. author: Dart Team From 42504c7b08fbfc2462e33209ca180d36fe7c62f5 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 15 May 2019 11:40:01 -0600 Subject: [PATCH 039/107] Test on oldest supported SDK, bump min SDK to stable release (dart-lang/http_multi_server#13) Delete codereview.settings Delete dead lint bump to 2.1.0 - because pkg test --- pkgs/http_multi_server/.travis.yml | 10 ++++++++-- pkgs/http_multi_server/CHANGELOG.md | 4 ++++ pkgs/http_multi_server/analysis_options.yaml | 1 - pkgs/http_multi_server/codereview.settings | 3 --- pkgs/http_multi_server/pubspec.yaml | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) delete mode 100644 pkgs/http_multi_server/codereview.settings diff --git a/pkgs/http_multi_server/.travis.yml b/pkgs/http_multi_server/.travis.yml index 9c44c0b35b..47f62b8ff9 100644 --- a/pkgs/http_multi_server/.travis.yml +++ b/pkgs/http_multi_server/.travis.yml @@ -1,13 +1,19 @@ language: dart -sudo: false + dart: + - 2.1.0 - dev dart_task: - test - - dartfmt - dartanalyzer +matrix: + include: + # Only validate formatting using the dev release + - dart: dev + dart_task: dartfmt + # Only building master means that we don't run two builds for each pull request. branches: only: [master] diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index c03d6364e8..7a85e02ba8 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.7 + +- Update SDK constraints to `>=2.1.0 <3.0.0`. + ## 2.0.6 * If there is a problem starting a loopback Ipv6 server, don't keep the Ipv4 diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml index 6f476fe9c5..0711acad5d 100644 --- a/pkgs/http_multi_server/analysis_options.yaml +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -33,7 +33,6 @@ linter: - prefer_generic_function_type_aliases - prefer_is_not_empty - slash_for_doc_comments - - super_goes_last - test_types_in_equals - throw_in_finally - type_init_formals diff --git a/pkgs/http_multi_server/codereview.settings b/pkgs/http_multi_server/codereview.settings deleted file mode 100644 index 23d9fd4ded..0000000000 --- a/pkgs/http_multi_server/codereview.settings +++ /dev/null @@ -1,3 +0,0 @@ -CODE_REVIEW_SERVER: http://codereview.chromium.org/ -VIEW_VC: https://github.com/dart-lang/http_multi_server/commit/ -CC_LIST: reviews@dartlang.org \ No newline at end of file diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 175c5bc6c8..5be68b0f0f 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,12 +1,12 @@ name: http_multi_server -version: 2.0.6 +version: 2.0.7-dev description: A dart:io HttpServer wrapper that handles requests from multiple servers. author: Dart Team homepage: https://github.com/dart-lang/http_multi_server environment: - sdk: '>=2.0.0-dev.55.0 <3.0.0' + sdk: '>=2.1.0 <3.0.0' dependencies: async: '>=1.2.0 <3.0.0' From f704a00869ce2670301dd9b58a99b7c4e12fba9c Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Mon, 3 Jun 2019 13:35:23 -0700 Subject: [PATCH 040/107] Enforce override annotations (dart-lang/http_multi_server#14) --- pkgs/http_multi_server/analysis_options.yaml | 1 + .../lib/http_multi_server.dart | 12 +++++++++ .../lib/src/multi_headers.dart | 27 +++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml index 0711acad5d..8dfb3d0591 100644 --- a/pkgs/http_multi_server/analysis_options.yaml +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -8,6 +8,7 @@ linter: - avoid_init_to_null - avoid_null_checks_in_equality_operators - avoid_unused_constructor_parameters + - annotate_overrides - await_only_futures - camel_case_types - cancel_subscriptions diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 562092d1f2..d54022b25d 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -35,7 +35,9 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// If the wrapped servers have different default values, it's not defined /// which value is returned. + @override String get serverHeader => _servers.first.serverHeader; + @override set serverHeader(String value) { for (var server in _servers) { server.serverHeader = value; @@ -46,16 +48,21 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// If the wrapped servers have different default headers, it's not defined /// which header is returned for accessor methods. + @override final HttpHeaders defaultResponseHeaders; + @override Duration get idleTimeout => _servers.first.idleTimeout; + @override set idleTimeout(Duration value) { for (var server in _servers) { server.idleTimeout = value; } } + @override bool get autoCompress => _servers.first.autoCompress; + @override set autoCompress(bool value) { for (var server in _servers) { server.autoCompress = value; @@ -66,14 +73,17 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// If the wrapped servers are listening on different ports, it's not defined /// which port is returned. + @override int get port => _servers.first.port; /// Returns the address that one of the wrapped servers is listening on. /// /// If the wrapped servers are listening on different addresses, it's not /// defined which address is returned. + @override InternetAddress get address => _servers.first.address; + @override set sessionTimeout(int value) { for (var server in _servers) { server.sessionTimeout = value; @@ -160,11 +170,13 @@ class HttpMultiServer extends StreamView implements HttpServer { } } + @override Future close({bool force = false}) => Future.wait(_servers.map((server) => server.close(force: force))); /// Returns an HttpConnectionsInfo object summarizing the total number of /// current connections handled by all the servers. + @override HttpConnectionsInfo connectionsInfo() { var info = HttpConnectionsInfo(); for (var server in _servers) { diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart index 9267aee196..d1dd93ffe4 100644 --- a/pkgs/http_multi_server/lib/src/multi_headers.dart +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -10,63 +10,81 @@ class MultiHeaders implements HttpHeaders { /// The wrapped headers. final Set _headers; + @override bool get chunkedTransferEncoding => _headers.first.chunkedTransferEncoding; + @override set chunkedTransferEncoding(bool value) { for (var headers in _headers) { headers.chunkedTransferEncoding = value; } } + @override int get contentLength => _headers.first.contentLength; + @override set contentLength(int value) { for (var headers in _headers) { headers.contentLength = value; } } + @override ContentType get contentType => _headers.first.contentType; + @override set contentType(ContentType value) { for (var headers in _headers) { headers.contentType = value; } } + @override DateTime get date => _headers.first.date; + @override set date(DateTime value) { for (var headers in _headers) { headers.date = value; } } + @override DateTime get expires => _headers.first.expires; + @override set expires(DateTime value) { for (var headers in _headers) { headers.expires = value; } } + @override String get host => _headers.first.host; + @override set host(String value) { for (var headers in _headers) { headers.host = value; } } + @override DateTime get ifModifiedSince => _headers.first.ifModifiedSince; + @override set ifModifiedSince(DateTime value) { for (var headers in _headers) { headers.ifModifiedSince = value; } } + @override bool get persistentConnection => _headers.first.persistentConnection; + @override set persistentConnection(bool value) { for (var headers in _headers) { headers.persistentConnection = value; } } + @override int get port => _headers.first.port; + @override set port(int value) { for (var headers in _headers) { headers.port = value; @@ -75,43 +93,52 @@ class MultiHeaders implements HttpHeaders { MultiHeaders(Iterable headers) : _headers = headers.toSet(); + @override void add(String name, Object value) { for (var headers in _headers) { headers.add(name, value); } } + @override void forEach(void f(String name, List values)) => _headers.first.forEach(f); + @override void noFolding(String name) { for (var headers in _headers) { headers.noFolding(name); } } + @override void remove(String name, Object value) { for (var headers in _headers) { headers.remove(name, value); } } + @override void removeAll(String name) { for (var headers in _headers) { headers.removeAll(name); } } + @override void set(String name, Object value) { for (var headers in _headers) { headers.set(name, value); } } + @override String value(String name) => _headers.first.value(name); + @override List operator [](String name) => _headers.first[name]; + @override void clear() { for (var headers in _headers) { headers.clear(); From 94bc5bdafa508822389d3559a40bbd17fd9bd487 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Mon, 3 Jun 2019 14:01:18 -0700 Subject: [PATCH 041/107] Wrap description to stay under 80 chars. (dart-lang/http_multi_server#15) --- pkgs/http_multi_server/pubspec.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 5be68b0f0f..b058fbe1b5 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,7 +1,8 @@ name: http_multi_server version: 2.0.7-dev -description: A dart:io HttpServer wrapper that handles requests from multiple servers. +description: >- + A dart:io HttpServer wrapper that handles requests from multiple servers. author: Dart Team homepage: https://github.com/dart-lang/http_multi_server From e0b2b27a661343930c1b7e07a9d76ab28f69d065 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 4 Jun 2019 14:51:29 -0700 Subject: [PATCH 042/107] Add HttpMultiServer.bind utility (dart-lang/http_multi_server#16) We have a few places where we want to allow listening on 'any' hostname for the case where the server may be both access locally with something like "localhost" and externally with something like the servers hostname. --- pkgs/http_multi_server/CHANGELOG.md | 6 +- .../lib/http_multi_server.dart | 23 ++++++++ pkgs/http_multi_server/pubspec.yaml | 2 +- .../test/http_multi_server_test.dart | 56 +++++++++++++++++++ 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 7a85e02ba8..181b4bd4dc 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,7 +1,11 @@ -## 2.0.7 +## 2.1.0 +- Add `HttpMultiServer.bind` static which centralizes logic around common local + serving scenarios - handling a more flexible 'localhost' and listening on + 'any' hostname. - Update SDK constraints to `>=2.1.0 <3.0.0`. + ## 2.0.6 * If there is a problem starting a loopback Ipv6 server, don't keep the Ipv4 diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index d54022b25d..1f10215f6c 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -133,6 +133,29 @@ class HttpMultiServer extends StreamView implements HttpServer { requestClientCertificate: requestClientCertificate)); } + /// Bind an [HttpServer] with handling for special addresses 'localhost' and + /// 'any'. + /// + /// For address 'localhost' behaves like [loopback]. For 'any' listens on + /// [InternetAddress.anyIPv6] which listens on all hostnames for both IPv4 and + /// IPV6. For any other address forwards directly to `HttpServer.bind` where + /// the IPvX support may vary. + /// + /// See [HttpServer.bind]. + static Future bind(dynamic address, int port, + {int backlog = 0, bool v6Only = false, bool shared = false}) { + if (address == 'localhost') { + return HttpMultiServer.loopback(port, + backlog: backlog, v6Only: v6Only, shared: shared); + } + if (address == 'any') { + return HttpServer.bind(InternetAddress.anyIPv6, port, + backlog: backlog, v6Only: v6Only, shared: shared); + } + return HttpServer.bind(address, port, + backlog: backlog, v6Only: v6Only, shared: shared); + } + /// A helper method for initializing loopback servers. /// /// [bind] should forward to either [HttpServer.bind] or diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index b058fbe1b5..7249a60f46 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 2.0.7-dev +version: 2.1.0 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index a61212ea8a..65cfd5757b 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -181,6 +181,62 @@ void main() { } }); }); + + group("HttpMultiServer.bind", () { + test("listens on all localhost interfaces for 'localhost'", () async { + final server = await HttpMultiServer.bind("localhost", 0); + server.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + if (await supportsIPv4) { + expect(http.read("http://127.0.0.1:${server.port}/"), + completion(equals("got request"))); + } + + if (await supportsIPv6) { + expect(http.read("http://[::1]:${server.port}/"), + completion(equals("got request"))); + } + }); + + test("listens on all localhost interfaces for 'any'", () async { + final server = await HttpMultiServer.bind("any", 0); + server.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + if (await supportsIPv4) { + expect(http.read("http://127.0.0.1:${server.port}/"), + completion(equals("got request"))); + } + + if (await supportsIPv6) { + expect(http.read("http://[::1]:${server.port}/"), + completion(equals("got request"))); + } + }); + + test("listens on specified hostname", () async { + final server = await HttpMultiServer.bind(InternetAddress.anyIPv4, 0); + server.listen((request) { + request.response.write("got request"); + request.response.close(); + }); + + if (await supportsIPv4) { + expect(http.read("http://127.0.0.1:${server.port}/"), + completion(equals("got request"))); + } + + if (await supportsIPv6) { + expect(http.read("http://[::1]:${server.port}/"), + throwsA(isA())); + } + }); + }); } /// Makes a GET request to the root of [server] and returns the response. From 7a48a66e87923613bbb0bd18a42de00fa63e71ac Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 16 Sep 2019 12:59:54 -0700 Subject: [PATCH 043/107] Add example; bump pedantic --- pkgs/http_multi_server/README.md | 2 +- pkgs/http_multi_server/analysis_options.yaml | 14 -------------- pkgs/http_multi_server/example/main.dart | 13 +++++++++++++ pkgs/http_multi_server/pubspec.yaml | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 pkgs/http_multi_server/example/main.dart diff --git a/pkgs/http_multi_server/README.md b/pkgs/http_multi_server/README.md index e12c8d1cce..b06d3f8c04 100644 --- a/pkgs/http_multi_server/README.md +++ b/pkgs/http_multi_server/README.md @@ -14,7 +14,7 @@ void main() { // server. HttpMultiServer.loopback(8080).then((server) { shelf_io.serveRequests(server, (request) { - return new shelf.Response.ok("Hello, world!"); + return shelf.Response.ok("Hello, world!"); }); }); } diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml index 8dfb3d0591..027be6fee2 100644 --- a/pkgs/http_multi_server/analysis_options.yaml +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -4,8 +4,6 @@ analyzer: implicit-casts: false linter: rules: - - avoid_empty_else - - avoid_init_to_null - avoid_null_checks_in_equality_operators - avoid_unused_constructor_parameters - annotate_overrides @@ -15,30 +13,18 @@ linter: - constant_identifier_names - control_flow_in_finally - directives_ordering - - empty_catches - - empty_constructor_bodies - empty_statements - hash_and_equals - implementation_imports - iterable_contains_unrelated_type - - library_names - - library_prefixes - list_remove_unrelated_type - non_constant_identifier_names - overridden_fields - package_api_docs - package_names - package_prefixed_library_names - - prefer_equal_for_default_values - prefer_final_fields - prefer_generic_function_type_aliases - - prefer_is_not_empty - - slash_for_doc_comments - test_types_in_equals - throw_in_finally - - type_init_formals - unnecessary_brace_in_string_interps - - unnecessary_const - - unnecessary_new - - unrelated_type_equality_checks - - valid_regexps diff --git a/pkgs/http_multi_server/example/main.dart b/pkgs/http_multi_server/example/main.dart new file mode 100644 index 0000000000..3bc42b0f7d --- /dev/null +++ b/pkgs/http_multi_server/example/main.dart @@ -0,0 +1,13 @@ +import 'package:http_multi_server/http_multi_server.dart'; +import 'package:shelf/shelf.dart' as shelf; +import 'package:shelf/shelf_io.dart' as shelf_io; + +void main() { + // Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same + // server. + HttpMultiServer.loopback(8080).then((server) { + shelf_io.serveRequests(server, (request) { + return shelf.Response.ok("Hello, world!"); + }); + }); +} diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 7249a60f46..52b6f0fa5c 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -14,5 +14,5 @@ dependencies: dev_dependencies: http: ^0.12.0 - pedantic: ^1.4.0 + pedantic: ^1.8.0 test: ^1.5.2 From 8c5b38503b0eb9f43c5b2fc2bdfea61acc445748 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 16 Sep 2019 13:16:31 -0700 Subject: [PATCH 044/107] Async/await --- pkgs/http_multi_server/README.md | 9 ++++----- pkgs/http_multi_server/example/main.dart | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pkgs/http_multi_server/README.md b/pkgs/http_multi_server/README.md index b06d3f8c04..ac6927e509 100644 --- a/pkgs/http_multi_server/README.md +++ b/pkgs/http_multi_server/README.md @@ -9,13 +9,12 @@ import 'package:http_multi_server/http_multi_server.dart'; import 'package:shelf/shelf.dart' as shelf; import 'package:shelf/shelf_io.dart' as shelf_io; -void main() { +void main() async { // Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same // server. - HttpMultiServer.loopback(8080).then((server) { - shelf_io.serveRequests(server, (request) { - return shelf.Response.ok("Hello, world!"); - }); + var server = await HttpMultiServer.loopback(8080); + shelf_io.serveRequests(server, (request) { + return shelf.Response.ok("Hello, world!"); }); } ``` diff --git a/pkgs/http_multi_server/example/main.dart b/pkgs/http_multi_server/example/main.dart index 3bc42b0f7d..bf78a51c57 100644 --- a/pkgs/http_multi_server/example/main.dart +++ b/pkgs/http_multi_server/example/main.dart @@ -2,12 +2,11 @@ import 'package:http_multi_server/http_multi_server.dart'; import 'package:shelf/shelf.dart' as shelf; import 'package:shelf/shelf_io.dart' as shelf_io; -void main() { +void main() async { // Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same // server. - HttpMultiServer.loopback(8080).then((server) { - shelf_io.serveRequests(server, (request) { - return shelf.Response.ok("Hello, world!"); - }); + var server = await HttpMultiServer.loopback(8080); + shelf_io.serveRequests(server, (request) { + return shelf.Response.ok("Hello, world!"); }); } From 6b4127d068fdccd1b723ba4fe3c0376e05b73e3c Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 16 Sep 2019 14:03:44 -0700 Subject: [PATCH 045/107] Bump minimum to 2.1.1, for pedantic --- pkgs/http_multi_server/.travis.yml | 2 +- pkgs/http_multi_server/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.travis.yml b/pkgs/http_multi_server/.travis.yml index 47f62b8ff9..5ba507630c 100644 --- a/pkgs/http_multi_server/.travis.yml +++ b/pkgs/http_multi_server/.travis.yml @@ -1,7 +1,7 @@ language: dart dart: - - 2.1.0 + - 2.1.1 - dev dart_task: diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 52b6f0fa5c..dc78335ce9 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -7,7 +7,7 @@ author: Dart Team homepage: https://github.com/dart-lang/http_multi_server environment: - sdk: '>=2.1.0 <3.0.0' + sdk: '>=2.1.1 <3.0.0' dependencies: async: '>=1.2.0 <3.0.0' From 17245f9683b472c51e0f4e9188390097aa381ed4 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Mon, 9 Dec 2019 15:57:19 -0800 Subject: [PATCH 046/107] Fix newly enforced package:pedantic lints (dart-lang/http_multi_server#20) - prefer_conditional_assignment - prefer_single_quotes - use_function_type_syntax_for_parameters --- pkgs/http_multi_server/example/main.dart | 2 +- .../lib/http_multi_server.dart | 6 +- .../lib/src/multi_headers.dart | 2 +- pkgs/http_multi_server/pubspec.yaml | 2 +- .../test/http_multi_server_test.dart | 108 +++++++++--------- 5 files changed, 60 insertions(+), 60 deletions(-) diff --git a/pkgs/http_multi_server/example/main.dart b/pkgs/http_multi_server/example/main.dart index bf78a51c57..00f9515162 100644 --- a/pkgs/http_multi_server/example/main.dart +++ b/pkgs/http_multi_server/example/main.dart @@ -7,6 +7,6 @@ void main() async { // server. var server = await HttpMultiServer.loopback(8080); shelf_io.serveRequests(server, (request) { - return shelf.Response.ok("Hello, world!"); + return shelf.Response.ok('Hello, world!'); }); } diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 1f10215f6c..1ba0a2b96f 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -106,7 +106,7 @@ class HttpMultiServer extends StreamView implements HttpServer { /// See [HttpServer.bind]. static Future loopback(int port, {int backlog, bool v6Only = false, bool shared = false}) { - if (backlog == null) backlog = 0; + backlog ??= 0; return _loopback( port, @@ -122,7 +122,7 @@ class HttpMultiServer extends StreamView implements HttpServer { bool v6Only = false, bool requestClientCertificate = false, bool shared = false}) { - if (backlog == null) backlog = 0; + backlog ??= 0; return _loopback( port, @@ -161,7 +161,7 @@ class HttpMultiServer extends StreamView implements HttpServer { /// [bind] should forward to either [HttpServer.bind] or /// [HttpServer.bindSecure]. static Future _loopback( - int port, Future bind(InternetAddress address, int port), + int port, Future Function(InternetAddress, int port) bind, [int remainingRetries]) async { remainingRetries ??= 5; diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart index d1dd93ffe4..f88aa317dc 100644 --- a/pkgs/http_multi_server/lib/src/multi_headers.dart +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -101,7 +101,7 @@ class MultiHeaders implements HttpHeaders { } @override - void forEach(void f(String name, List values)) => + void forEach(void Function(String name, List values) f) => _headers.first.forEach(f); @override diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index dc78335ce9..6ccb01c43b 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 2.1.0 +version: 2.1.1-dev description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 65cfd5757b..00405f8038 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -11,127 +11,127 @@ import 'package:http_multi_server/src/utils.dart'; import 'package:test/test.dart'; void main() { - group("with multiple HttpServers", () { + group('with multiple HttpServers', () { var multiServer; HttpServer subServer1; HttpServer subServer2; HttpServer subServer3; setUp(() { return Future.wait([ - HttpServer.bind("localhost", 0).then((server) => subServer1 = server), - HttpServer.bind("localhost", 0).then((server) => subServer2 = server), - HttpServer.bind("localhost", 0).then((server) => subServer3 = server) + HttpServer.bind('localhost', 0).then((server) => subServer1 = server), + HttpServer.bind('localhost', 0).then((server) => subServer2 = server), + HttpServer.bind('localhost', 0).then((server) => subServer3 = server) ]).then((servers) => multiServer = HttpMultiServer(servers)); }); tearDown(() => multiServer.close()); - test("listen listens to all servers", () { + test('listen listens to all servers', () { multiServer.listen((request) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); - expect(_read(subServer1), completion(equals("got request"))); - expect(_read(subServer2), completion(equals("got request"))); - expect(_read(subServer3), completion(equals("got request"))); + expect(_read(subServer1), completion(equals('got request'))); + expect(_read(subServer2), completion(equals('got request'))); + expect(_read(subServer3), completion(equals('got request'))); }); - test("serverHeader= sets the value for all servers", () { - multiServer.serverHeader = "http_multi_server test"; + test('serverHeader= sets the value for all servers', () { + multiServer.serverHeader = 'http_multi_server test'; multiServer.listen((request) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); expect( _get(subServer1).then((response) { expect( - response.headers['server'], equals("http_multi_server test")); + response.headers['server'], equals('http_multi_server test')); }), completes); expect( _get(subServer2).then((response) { expect( - response.headers['server'], equals("http_multi_server test")); + response.headers['server'], equals('http_multi_server test')); }), completes); expect( _get(subServer3).then((response) { expect( - response.headers['server'], equals("http_multi_server test")); + response.headers['server'], equals('http_multi_server test')); }), completes); }); - test("autoCompress= sets the value for all servers", () { + test('autoCompress= sets the value for all servers', () { multiServer.autoCompress = true; multiServer.listen((request) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); expect( _get(subServer1).then((response) { - expect(response.headers['content-encoding'], equals("gzip")); + expect(response.headers['content-encoding'], equals('gzip')); }), completes); expect( _get(subServer2).then((response) { - expect(response.headers['content-encoding'], equals("gzip")); + expect(response.headers['content-encoding'], equals('gzip')); }), completes); expect( _get(subServer3).then((response) { - expect(response.headers['content-encoding'], equals("gzip")); + expect(response.headers['content-encoding'], equals('gzip')); }), completes); }); - test("headers.set sets the value for all servers", () { + test('headers.set sets the value for all servers', () { multiServer.defaultResponseHeaders - .set("server", "http_multi_server test"); + .set('server', 'http_multi_server test'); multiServer.listen((request) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); expect( _get(subServer1).then((response) { expect( - response.headers['server'], equals("http_multi_server test")); + response.headers['server'], equals('http_multi_server test')); }), completes); expect( _get(subServer2).then((response) { expect( - response.headers['server'], equals("http_multi_server test")); + response.headers['server'], equals('http_multi_server test')); }), completes); expect( _get(subServer3).then((response) { expect( - response.headers['server'], equals("http_multi_server test")); + response.headers['server'], equals('http_multi_server test')); }), completes); }); - test("connectionsInfo sums the values for all servers", () { + test('connectionsInfo sums the values for all servers', () { var pendingRequests = 0; var awaitingResponseCompleter = Completer(); var sendResponseCompleter = Completer(); multiServer.listen((request) { sendResponseCompleter.future.then((_) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); @@ -156,7 +156,7 @@ void main() { }); }); - group("HttpMultiServer.loopback", () { + group('HttpMultiServer.loopback', () { var server; setUp(() { return HttpMultiServer.loopback(0).then((s) => server = s); @@ -164,75 +164,75 @@ void main() { tearDown(() => server.close()); - test("listens on all localhost interfaces", () async { + test('listens on all localhost interfaces', () async { server.listen((request) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); if (await supportsIPv4) { - expect(http.read("http://127.0.0.1:${server.port}/"), - completion(equals("got request"))); + expect(http.read('http://127.0.0.1:${server.port}/'), + completion(equals('got request'))); } if (await supportsIPv6) { - expect(http.read("http://[::1]:${server.port}/"), - completion(equals("got request"))); + expect(http.read('http://[::1]:${server.port}/'), + completion(equals('got request'))); } }); }); - group("HttpMultiServer.bind", () { + group('HttpMultiServer.bind', () { test("listens on all localhost interfaces for 'localhost'", () async { - final server = await HttpMultiServer.bind("localhost", 0); + final server = await HttpMultiServer.bind('localhost', 0); server.listen((request) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); if (await supportsIPv4) { - expect(http.read("http://127.0.0.1:${server.port}/"), - completion(equals("got request"))); + expect(http.read('http://127.0.0.1:${server.port}/'), + completion(equals('got request'))); } if (await supportsIPv6) { - expect(http.read("http://[::1]:${server.port}/"), - completion(equals("got request"))); + expect(http.read('http://[::1]:${server.port}/'), + completion(equals('got request'))); } }); test("listens on all localhost interfaces for 'any'", () async { - final server = await HttpMultiServer.bind("any", 0); + final server = await HttpMultiServer.bind('any', 0); server.listen((request) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); if (await supportsIPv4) { - expect(http.read("http://127.0.0.1:${server.port}/"), - completion(equals("got request"))); + expect(http.read('http://127.0.0.1:${server.port}/'), + completion(equals('got request'))); } if (await supportsIPv6) { - expect(http.read("http://[::1]:${server.port}/"), - completion(equals("got request"))); + expect(http.read('http://[::1]:${server.port}/'), + completion(equals('got request'))); } }); - test("listens on specified hostname", () async { + test('listens on specified hostname', () async { final server = await HttpMultiServer.bind(InternetAddress.anyIPv4, 0); server.listen((request) { - request.response.write("got request"); + request.response.write('got request'); request.response.close(); }); if (await supportsIPv4) { - expect(http.read("http://127.0.0.1:${server.port}/"), - completion(equals("got request"))); + expect(http.read('http://127.0.0.1:${server.port}/'), + completion(equals('got request'))); } if (await supportsIPv6) { - expect(http.read("http://[::1]:${server.port}/"), + expect(http.read('http://[::1]:${server.port}/'), throwsA(isA())); } }); @@ -247,4 +247,4 @@ Future _read(HttpServer server) => http.read(_urlFor(server)); /// Returns the URL for the root of [server]. String _urlFor(HttpServer server) => - "http://${server.address.host}:${server.port}/"; + 'http://${server.address.host}:${server.port}/'; From 5efb0047c70efefcd27e835149a2005eca2e9c58 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Wed, 29 Jan 2020 10:04:05 -0800 Subject: [PATCH 047/107] Add preserveHeaderCase argument (dart-lang/http_multi_server#22) An upcoming SDK release will add a named argument which must be included for any class which `implements` the interface. Pre-emptively add the argument to the signature so that we have a version of this package which is forward compatible with the SDK. We will properly forward the argument once we have an SDK release with the change. --- pkgs/http_multi_server/CHANGELOG.md | 8 ++++++++ pkgs/http_multi_server/lib/src/multi_headers.dart | 4 ++-- pkgs/http_multi_server/pubspec.yaml | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 181b4bd4dc..6bce625a19 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2.2.0-dev + +- Preparation for [HttpHeaders change]. Update signature of `MultiHeaders.add()` + and `MultiHeaders.set()` to match new signature of `HttpHeaders`. The + parameter is not yet forwarded and will not behave as expected. + + [HttpHeaders change]: https://github.com/dart-lang/sdk/issues/39657 + ## 2.1.0 - Add `HttpMultiServer.bind` static which centralizes logic around common local diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart index f88aa317dc..25807b00b3 100644 --- a/pkgs/http_multi_server/lib/src/multi_headers.dart +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -94,7 +94,7 @@ class MultiHeaders implements HttpHeaders { MultiHeaders(Iterable headers) : _headers = headers.toSet(); @override - void add(String name, Object value) { + void add(String name, Object value, {bool preserveHeaderCase = false}) { for (var headers in _headers) { headers.add(name, value); } @@ -126,7 +126,7 @@ class MultiHeaders implements HttpHeaders { } @override - void set(String name, Object value) { + void set(String name, Object value, {bool preserveHeaderCase = false}) { for (var headers in _headers) { headers.set(name, value); } diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 6ccb01c43b..ad3b92a5f4 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,6 @@ name: http_multi_server -version: 2.1.1-dev +version: 2.2.0-dev +publish_to: none # https://github.com/dart-lang/http_multi_server/issues/23 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. From 3fcc0c8825accfafbaa424437823cebfeb0662c5 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 31 Jan 2020 10:48:53 -0800 Subject: [PATCH 048/107] Prepare to publish (dart-lang/http_multi_server#24) We want a forwards compatible package available. The SDK change has been merged and the name is finalized. --- pkgs/http_multi_server/CHANGELOG.md | 2 +- pkgs/http_multi_server/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 6bce625a19..eed6fabeaa 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.2.0-dev +## 2.2.0 - Preparation for [HttpHeaders change]. Update signature of `MultiHeaders.add()` and `MultiHeaders.set()` to match new signature of `HttpHeaders`. The diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index ad3b92a5f4..9f842476f2 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 2.2.0-dev +version: 2.2.0 publish_to: none # https://github.com/dart-lang/http_multi_server/issues/23 description: >- From 4e146400d95e0b42d7ebd9d7a86913fad5d3f45c Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 31 Jan 2020 10:52:47 -0800 Subject: [PATCH 049/107] Drop the publish_to: none (dart-lang/http_multi_server#25) Towards dart-lang/http_multi_server#23 Drop unused author field from pubspec --- pkgs/http_multi_server/pubspec.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 9f842476f2..4003faa317 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,10 +1,8 @@ name: http_multi_server version: 2.2.0 -publish_to: none # https://github.com/dart-lang/http_multi_server/issues/23 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. -author: Dart Team homepage: https://github.com/dart-lang/http_multi_server environment: From 45e59019c6317ad9c26bb6f3e7cba1f7eaf4cec8 Mon Sep 17 00:00:00 2001 From: Michael R Fairhurst Date: Fri, 25 Sep 2020 12:23:09 -0700 Subject: [PATCH 050/107] Remove unused dart:async import (dart-lang/http_multi_server#28) Since Dart 2.1, Future/Stream have been exported from dart:core --- pkgs/http_multi_server/CHANGELOG.md | 2 ++ pkgs/http_multi_server/lib/src/utils.dart | 1 - pkgs/http_multi_server/pubspec.yaml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index eed6fabeaa..7bf1bfbe17 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.2.1-dev + ## 2.2.0 - Preparation for [HttpHeaders change]. Update signature of `MultiHeaders.add()` diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index 2709dabec8..e9fb3b4d27 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:io'; /// Returns whether this computer supports binding to IPv6 addresses. diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 4003faa317..e93015c195 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 2.2.0 +version: 2.2.1-dev description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. From 695c8195179cecc920abb3793c7bc82fd612cdcb Mon Sep 17 00:00:00 2001 From: AmitB Date: Sat, 26 Sep 2020 00:55:27 +0530 Subject: [PATCH 051/107] Change issue link to https. (dart-lang/http_multi_server#27) Links in `CHANGELOG.md` should be secure. --- pkgs/http_multi_server/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 7bf1bfbe17..49d648b687 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -87,4 +87,4 @@ particular, this works around [issue 19815][] on some Windows machines where IPv6 failure isn't discovered until we try to connect to the socket. -[issue 19815]: http://code.google.com/p/dart/issues/detail?id=19815 +[issue 19815]: https://code.google.com/p/dart/issues/detail?id=19815 From 4ba71c3aeed293c1c53b1ebf44b2c62be1a6803c Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 8 Dec 2020 16:16:09 -0800 Subject: [PATCH 052/107] Pass a Uri to package:http APIs (dart-lang/http_multi_server#29) Prepare for https://github.com/dart-lang/http/issues/375 --- .../test/http_multi_server_test.dart | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 00405f8038..65d153630f 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -171,12 +171,12 @@ void main() { }); if (await supportsIPv4) { - expect(http.read('http://127.0.0.1:${server.port}/'), + expect(http.read(Uri.http('127.0.0.1:${server.port}', '/')), completion(equals('got request'))); } if (await supportsIPv6) { - expect(http.read('http://[::1]:${server.port}/'), + expect(http.read(Uri.http('[::1]:${server.port}', '/')), completion(equals('got request'))); } }); @@ -191,12 +191,12 @@ void main() { }); if (await supportsIPv4) { - expect(http.read('http://127.0.0.1:${server.port}/'), + expect(http.read(Uri.http('127.0.0.1:${server.port}', '/')), completion(equals('got request'))); } if (await supportsIPv6) { - expect(http.read('http://[::1]:${server.port}/'), + expect(http.read(Uri.http('[::1]:${server.port}', '/')), completion(equals('got request'))); } }); @@ -209,12 +209,12 @@ void main() { }); if (await supportsIPv4) { - expect(http.read('http://127.0.0.1:${server.port}/'), + expect(http.read(Uri.http('127.0.0.1:${server.port}', '/')), completion(equals('got request'))); } if (await supportsIPv6) { - expect(http.read('http://[::1]:${server.port}/'), + expect(http.read(Uri.http('[::1]:${server.port}', '/')), completion(equals('got request'))); } }); @@ -227,12 +227,12 @@ void main() { }); if (await supportsIPv4) { - expect(http.read('http://127.0.0.1:${server.port}/'), + expect(http.read(Uri.http('127.0.0.1:${server.port}', '/')), completion(equals('got request'))); } if (await supportsIPv6) { - expect(http.read('http://[::1]:${server.port}/'), + expect(http.read(Uri.http('[::1]:${server.port}', '/')), throwsA(isA())); } }); @@ -246,5 +246,5 @@ Future _get(HttpServer server) => http.get(_urlFor(server)); Future _read(HttpServer server) => http.read(_urlFor(server)); /// Returns the URL for the root of [server]. -String _urlFor(HttpServer server) => - 'http://${server.address.host}:${server.port}/'; +Uri _urlFor(HttpServer server) => + Uri.http('${server.address.host}:${server.port}', '/'); From e7d065c35fe3e066cc18fb29a46d27abc4484372 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 8 Dec 2020 20:47:01 -0800 Subject: [PATCH 053/107] Skip test binding to IPv4 without support (dart-lang/http_multi_server#30) Bail out of a test early if the host does not support IPv4. This cannot use the `skip` mechanism since the condition is async. --- pkgs/http_multi_server/test/http_multi_server_test.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 65d153630f..2cbb98494b 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -220,16 +220,15 @@ void main() { }); test('listens on specified hostname', () async { + if (!await supportsIPv4) return; final server = await HttpMultiServer.bind(InternetAddress.anyIPv4, 0); server.listen((request) { request.response.write('got request'); request.response.close(); }); - if (await supportsIPv4) { - expect(http.read(Uri.http('127.0.0.1:${server.port}', '/')), - completion(equals('got request'))); - } + expect(http.read(Uri.http('127.0.0.1:${server.port}', '/')), + completion(equals('got request'))); if (await supportsIPv6) { expect(http.read(Uri.http('[::1]:${server.port}', '/')), From 32e9ac7ebd1281bde2c96ec868a2ae353a4a57bb Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Mon, 1 Feb 2021 17:57:32 +0100 Subject: [PATCH 054/107] Migrate to GitHub Actions (dart-lang/http_multi_server#31) * Migrate to GitHub Actions * Delete .travis.yml --- .../.github/workflows/test-package.yml | 85 +++++++++++++++++++ pkgs/http_multi_server/.travis.yml | 23 ----- 2 files changed, 85 insertions(+), 23 deletions(-) create mode 100644 pkgs/http_multi_server/.github/workflows/test-package.yml delete mode 100644 pkgs/http_multi_server/.travis.yml diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml new file mode 100644 index 0000000000..62d0d01e43 --- /dev/null +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -0,0 +1,85 @@ +name: Dart CI + +on: + # Run on PRs and pushes to the default branch. + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: "0 0 * * 0" + +env: + PUB_ENVIRONMENT: bot.github + +jobs: + # Check code formatting and static analysis on a single OS (linux) + # against Dart dev. + analyze: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [dev] + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v0.3 + with: + sdk: ${{ matrix.sdk }} + - id: install + name: Install dependencies + run: dart pub get + - name: Check formatting + run: dart format --output=none --set-exit-if-changed . + if: always() && steps.install.outcome == 'success' + - name: Analyze code + run: dart analyze --fatal-infos + if: always() && steps.install.outcome == 'success' + + # Run tests on a matrix consisting of two dimensions: + # 1. OS: ubuntu-latest, (macos-latest, windows-latest) + # 2. release channel: dev + test: + needs: analyze + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # Add macos-latest and/or windows-latest if relevant for this package. + os: [ubuntu-latest] + sdk: [dev] + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v0.3 + with: + sdk: ${{ matrix.sdk }} + - id: install + name: Install dependencies + run: dart pub get + - name: Run VM tests + run: dart test --platform vm + if: always() && steps.install.outcome == 'success' + + # Run tests on a matrix consisting of two dimensions: + # 1. OS: ubuntu-latest, (macos-latest, windows-latest) + # 2. release: 2.1.1 + test-legacy-sdk: + needs: analyze + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # Add macos-latest and/or windows-latest if relevant for this package. + os: [ubuntu-latest] + sdk: [2.1.1] + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v0.3 + with: + sdk: ${{ matrix.sdk }} + - id: install + name: Install dependencies + run: pub get + - name: Run VM tests + run: pub run test --platform vm + if: always() && steps.install.outcome == 'success' diff --git a/pkgs/http_multi_server/.travis.yml b/pkgs/http_multi_server/.travis.yml deleted file mode 100644 index 5ba507630c..0000000000 --- a/pkgs/http_multi_server/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: dart - -dart: - - 2.1.1 - - dev - -dart_task: - - test - - dartanalyzer - -matrix: - include: - # Only validate formatting using the dev release - - dart: dev - dart_task: dartfmt - -# Only building master means that we don't run two builds for each pull request. -branches: - only: [master] - -cache: - directories: - - $HOME/.pub-cache From d0528736fa8af72ee429fd87df2fd2987f2ef780 Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Thu, 25 Feb 2021 11:52:55 -0800 Subject: [PATCH 055/107] migrate to null safety (dart-lang/http_multi_server#32) --- .../.github/workflows/test-package.yml | 24 ---------------- pkgs/http_multi_server/CHANGELOG.md | 11 ++++---- .../lib/http_multi_server.dart | 23 ++++++--------- .../lib/src/multi_headers.dart | 28 +++++++++---------- pkgs/http_multi_server/pubspec.yaml | 15 ++++++---- .../test/http_multi_server_test.dart | 6 ++-- 6 files changed, 41 insertions(+), 66 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 62d0d01e43..21a3c50b68 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -59,27 +59,3 @@ jobs: - name: Run VM tests run: dart test --platform vm if: always() && steps.install.outcome == 'success' - - # Run tests on a matrix consisting of two dimensions: - # 1. OS: ubuntu-latest, (macos-latest, windows-latest) - # 2. release: 2.1.1 - test-legacy-sdk: - needs: analyze - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - # Add macos-latest and/or windows-latest if relevant for this package. - os: [ubuntu-latest] - sdk: [2.1.1] - steps: - - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v0.3 - with: - sdk: ${{ matrix.sdk }} - - id: install - name: Install dependencies - run: pub get - - name: Run VM tests - run: pub run test --platform vm - if: always() && steps.install.outcome == 'success' diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 49d648b687..5d90eaf401 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,8 +1,10 @@ -## 2.2.1-dev +## 3.0.0-dev + +* Migrate to null safety. ## 2.2.0 -- Preparation for [HttpHeaders change]. Update signature of `MultiHeaders.add()` +* Preparation for [HttpHeaders change]. Update signature of `MultiHeaders.add()` and `MultiHeaders.set()` to match new signature of `HttpHeaders`. The parameter is not yet forwarded and will not behave as expected. @@ -10,11 +12,10 @@ ## 2.1.0 -- Add `HttpMultiServer.bind` static which centralizes logic around common local +* Add `HttpMultiServer.bind` static which centralizes logic around common local serving scenarios - handling a more flexible 'localhost' and listening on 'any' hostname. -- Update SDK constraints to `>=2.1.0 <3.0.0`. - +* Update SDK constraints to `>=2.1.0 <3.0.0`. ## 2.0.6 diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 1ba0a2b96f..bd8a6a7bd5 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -36,9 +36,10 @@ class HttpMultiServer extends StreamView implements HttpServer { /// If the wrapped servers have different default values, it's not defined /// which value is returned. @override - String get serverHeader => _servers.first.serverHeader; + String? get serverHeader => _servers.first.serverHeader; + @override - set serverHeader(String value) { + set serverHeader(String? value) { for (var server in _servers) { server.serverHeader = value; } @@ -52,9 +53,9 @@ class HttpMultiServer extends StreamView implements HttpServer { final HttpHeaders defaultResponseHeaders; @override - Duration get idleTimeout => _servers.first.idleTimeout; + Duration? get idleTimeout => _servers.first.idleTimeout; @override - set idleTimeout(Duration value) { + set idleTimeout(Duration? value) { for (var server in _servers) { server.idleTimeout = value; } @@ -105,9 +106,7 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// See [HttpServer.bind]. static Future loopback(int port, - {int backlog, bool v6Only = false, bool shared = false}) { - backlog ??= 0; - + {int backlog = 0, bool v6Only = false, bool shared = false}) { return _loopback( port, (address, port) => HttpServer.bind(address, port, @@ -118,12 +117,10 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// See [HttpServer.bindSecure]. static Future loopbackSecure(int port, SecurityContext context, - {int backlog, + {int backlog = 0, bool v6Only = false, bool requestClientCertificate = false, bool shared = false}) { - backlog ??= 0; - return _loopback( port, (address, port) => HttpServer.bindSecure(address, port, context, @@ -162,9 +159,7 @@ class HttpMultiServer extends StreamView implements HttpServer { /// [HttpServer.bindSecure]. static Future _loopback( int port, Future Function(InternetAddress, int port) bind, - [int remainingRetries]) async { - remainingRetries ??= 5; - + [int remainingRetries = 5]) async { if (!await supportsIPv4) { return await bind(InternetAddress.loopbackIPv6, port); } @@ -182,7 +177,7 @@ class HttpMultiServer extends StreamView implements HttpServer { // rethrow. await v4Server.close(); - if (error.osError.errorCode != _addressInUseErrno) rethrow; + if (error.osError?.errorCode != _addressInUseErrno) rethrow; if (port != 0) rethrow; if (remainingRetries == 0) rethrow; diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart index 25807b00b3..92bfd649dc 100644 --- a/pkgs/http_multi_server/lib/src/multi_headers.dart +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -29,45 +29,45 @@ class MultiHeaders implements HttpHeaders { } @override - ContentType get contentType => _headers.first.contentType; + ContentType? get contentType => _headers.first.contentType; @override - set contentType(ContentType value) { + set contentType(ContentType? value) { for (var headers in _headers) { headers.contentType = value; } } @override - DateTime get date => _headers.first.date; + DateTime? get date => _headers.first.date; @override - set date(DateTime value) { + set date(DateTime? value) { for (var headers in _headers) { headers.date = value; } } @override - DateTime get expires => _headers.first.expires; + DateTime? get expires => _headers.first.expires; @override - set expires(DateTime value) { + set expires(DateTime? value) { for (var headers in _headers) { headers.expires = value; } } @override - String get host => _headers.first.host; + String? get host => _headers.first.host; @override - set host(String value) { + set host(String? value) { for (var headers in _headers) { headers.host = value; } } @override - DateTime get ifModifiedSince => _headers.first.ifModifiedSince; + DateTime? get ifModifiedSince => _headers.first.ifModifiedSince; @override - set ifModifiedSince(DateTime value) { + set ifModifiedSince(DateTime? value) { for (var headers in _headers) { headers.ifModifiedSince = value; } @@ -83,9 +83,9 @@ class MultiHeaders implements HttpHeaders { } @override - int get port => _headers.first.port; + int? get port => _headers.first.port; @override - set port(int value) { + set port(int? value) { for (var headers in _headers) { headers.port = value; } @@ -133,10 +133,10 @@ class MultiHeaders implements HttpHeaders { } @override - String value(String name) => _headers.first.value(name); + String? value(String name) => _headers.first.value(name); @override - List operator [](String name) => _headers.first[name]; + List? operator [](String name) => _headers.first[name]; @override void clear() { diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index e93015c195..3593fc1cdb 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,17 +1,20 @@ name: http_multi_server -version: 2.2.1-dev +version: 3.0.0-dev description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. homepage: https://github.com/dart-lang/http_multi_server environment: - sdk: '>=2.1.1 <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' dependencies: - async: '>=1.2.0 <3.0.0' + async: ^2.5.0 dev_dependencies: - http: ^0.12.0 - pedantic: ^1.8.0 - test: ^1.5.2 + http: ^0.13.0 + pedantic: ^1.10.0 + test: ^1.16.0 + +dependency_overrides: + test: ^1.16.0 diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 2cbb98494b..749980e574 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -13,9 +13,9 @@ import 'package:test/test.dart'; void main() { group('with multiple HttpServers', () { var multiServer; - HttpServer subServer1; - HttpServer subServer2; - HttpServer subServer3; + late HttpServer subServer1; + late HttpServer subServer2; + late HttpServer subServer3; setUp(() { return Future.wait([ HttpServer.bind('localhost', 0).then((server) => subServer1 = server), From c3a9371fab92b16f7ea44d8c14a656dc94fd4abe Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Thu, 25 Feb 2021 14:06:20 -0800 Subject: [PATCH 056/107] stable null safety release (dart-lang/http_multi_server#33) --- pkgs/http_multi_server/CHANGELOG.md | 2 +- pkgs/http_multi_server/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 5d90eaf401..3368ca3499 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,4 +1,4 @@ -## 3.0.0-dev +## 3.0.0 * Migrate to null safety. diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 3593fc1cdb..33f2f91013 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 3.0.0-dev +version: 3.0.0 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. From f4546e67b919d48df9df756a4380c950f5c6e6db Mon Sep 17 00:00:00 2001 From: Franklin Yow <58489007+franklinyow@users.noreply.github.com> Date: Tue, 6 Apr 2021 15:48:22 -0700 Subject: [PATCH 057/107] Update LICENSE Changes to comply with internal review --- pkgs/http_multi_server/LICENSE | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/LICENSE b/pkgs/http_multi_server/LICENSE index 5c60afea39..162572a442 100644 --- a/pkgs/http_multi_server/LICENSE +++ b/pkgs/http_multi_server/LICENSE @@ -1,4 +1,5 @@ -Copyright 2014, the Dart project authors. All rights reserved. +Copyright 2014, the Dart project authors. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -9,7 +10,7 @@ met: copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. From 264d705391191777f323499e3d8c24dc89479553 Mon Sep 17 00:00:00 2001 From: Gary Roumanis Date: Mon, 12 Apr 2021 12:52:37 -0700 Subject: [PATCH 058/107] Bind to the correct address for --- .../lib/http_multi_server.dart | 22 ++++++++++++++----- .../test/http_multi_server_test.dart | 12 ++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index bd8a6a7bd5..1a8be3b0b9 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -133,21 +133,31 @@ class HttpMultiServer extends StreamView implements HttpServer { /// Bind an [HttpServer] with handling for special addresses 'localhost' and /// 'any'. /// - /// For address 'localhost' behaves like [loopback]. For 'any' listens on - /// [InternetAddress.anyIPv6] which listens on all hostnames for both IPv4 and - /// IPV6. For any other address forwards directly to `HttpServer.bind` where + /// For address 'localhost' behaves like [loopback]. + /// + /// For 'any' listens on [InternetAddress.anyIPv6] if the system supports IPv6 + /// otherwise [InternetAddress.anyIPv4]. Note [InternetAddress.anyIPv6] + /// listens on all hostnames for both IPv4 and IPV6. + /// + /// For any other address forwards directly to `HttpServer.bind` where /// the IPvX support may vary. /// /// See [HttpServer.bind]. static Future bind(dynamic address, int port, - {int backlog = 0, bool v6Only = false, bool shared = false}) { + {int backlog = 0, bool v6Only = false, bool shared = false}) async { if (address == 'localhost') { return HttpMultiServer.loopback(port, backlog: backlog, v6Only: v6Only, shared: shared); } if (address == 'any') { - return HttpServer.bind(InternetAddress.anyIPv6, port, - backlog: backlog, v6Only: v6Only, shared: shared); + return HttpServer.bind( + await supportsIPv6 + ? InternetAddress.anyIPv6 + : InternetAddress.anyIPv4, + port, + backlog: backlog, + v6Only: v6Only, + shared: shared); } return HttpServer.bind(address, port, backlog: backlog, v6Only: v6Only, shared: shared); diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 749980e574..95f0b4037d 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -219,6 +219,18 @@ void main() { } }); + test("uses the correct server address for 'any'", () async { + final server = await HttpMultiServer.bind('any', 0); + + if (await supportsIPv4) { + expect(server.address, InternetAddress.anyIPv4); + } + + if (await supportsIPv6) { + expect(server.address, InternetAddress.anyIPv6); + } + }); + test('listens on specified hostname', () async { if (!await supportsIPv4) return; final server = await HttpMultiServer.bind(InternetAddress.anyIPv4, 0); From e421e9c14401ae5dbbfffc2d375bd15c3030e638 Mon Sep 17 00:00:00 2001 From: Gary Roumanis Date: Mon, 12 Apr 2021 12:54:36 -0700 Subject: [PATCH 059/107] doc --- pkgs/http_multi_server/lib/http_multi_server.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 1a8be3b0b9..7fdc2d6dc9 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -137,7 +137,7 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// For 'any' listens on [InternetAddress.anyIPv6] if the system supports IPv6 /// otherwise [InternetAddress.anyIPv4]. Note [InternetAddress.anyIPv6] - /// listens on all hostnames for both IPv4 and IPV6. + /// listens on all hostnames for both IPv4 and IPv6. /// /// For any other address forwards directly to `HttpServer.bind` where /// the IPvX support may vary. From dd1814ff5a66f34dffc3236827f7907571997691 Mon Sep 17 00:00:00 2001 From: Gary Roumanis Date: Mon, 12 Apr 2021 13:02:12 -0700 Subject: [PATCH 060/107] fix test --- pkgs/http_multi_server/test/http_multi_server_test.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 95f0b4037d..29c624fb84 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -222,11 +222,9 @@ void main() { test("uses the correct server address for 'any'", () async { final server = await HttpMultiServer.bind('any', 0); - if (await supportsIPv4) { + if (!await supportsIPv6) { expect(server.address, InternetAddress.anyIPv4); - } - - if (await supportsIPv6) { + } else { expect(server.address, InternetAddress.anyIPv6); } }); From 28d39ccba14443fe0876e3a46d7f24fe5118b656 Mon Sep 17 00:00:00 2001 From: Gary Roumanis Date: Mon, 12 Apr 2021 13:03:35 -0700 Subject: [PATCH 061/107] changelog --- pkgs/http_multi_server/CHANGELOG.md | 5 +++++ pkgs/http_multi_server/pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 3368ca3499..1f0072deab 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.0.1 + +* Fix an issue where `bind` would bind to the `anyIPv6` address in unsupported + environments. + ## 3.0.0 * Migrate to null safety. diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 33f2f91013..1f0c3013e6 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 3.0.0 +version: 3.0.1 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. From 007b3d3e6d78ea49b885eea9841aaba9782c18c4 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Mon, 12 Apr 2021 16:29:27 -0700 Subject: [PATCH 062/107] Add a bindSecure method (dart-lang/http_multi_server#19) Closes dart-lang/http_multi_server#17 Add tests with a secure server and requests. The SSL certificate and key are copied from shelf. https://github.com/dart-lang/shelf/blob/df794c652ece4ac831b3518319bf6de5d7496126/test/ssl_certs.dart --- pkgs/http_multi_server/CHANGELOG.md | 4 + .../lib/http_multi_server.dart | 32 ++++ pkgs/http_multi_server/pubspec.yaml | 2 +- .../test/http_multi_server_test.dart | 162 ++++++++++++++++++ 4 files changed, 199 insertions(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 1f0072deab..f4e4dc1675 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.1.0 + +* Add `HttpMultiServer.bindSecure` to match `HttpMultiServer.bind`. + ## 3.0.1 * Fix an issue where `bind` would bind to the `anyIPv6` address in unsupported diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 7fdc2d6dc9..5f23947ea5 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -163,6 +163,38 @@ class HttpMultiServer extends StreamView implements HttpServer { backlog: backlog, v6Only: v6Only, shared: shared); } + /// Bind a secure [HttpServer] with handling for special addresses 'localhost' + /// and 'any'. + /// + /// For address 'localhost' behaves like [loopback]. + /// + /// For 'any' listens on [InternetAddress.anyIPv6] if the system supports IPv6 + /// otherwise [InternetAddress.anyIPv4]. Note [InternetAddress.anyIPv6] + /// listens on all hostnames for both IPv4 and IPv6. + /// + /// See [HttpServer.bindSecure]. + static Future bindSecure( + dynamic address, int port, SecurityContext context, + {int backlog = 0, bool v6Only = false, bool shared = false}) async { + if (address == 'localhost') { + return await HttpMultiServer.loopbackSecure(port, context, + backlog: backlog, v6Only: v6Only, shared: shared); + } + if (address == 'any') { + return await HttpServer.bindSecure( + await supportsIPv6 + ? InternetAddress.anyIPv6 + : InternetAddress.anyIPv4, + port, + context, + backlog: backlog, + v6Only: v6Only, + shared: shared); + } + return await HttpServer.bindSecure(address, port, context, + backlog: backlog, v6Only: v6Only, shared: shared); + } + /// A helper method for initializing loopback servers. /// /// [bind] should forward to either [HttpServer.bind] or diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 1f0c3013e6..af58e87e93 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 3.0.1 +version: 3.1.0 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 29c624fb84..96ffa2341c 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -3,9 +3,11 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; +import 'dart:convert'; import 'dart:io'; import 'package:http/http.dart' as http; +import 'package:http/io_client.dart' as http; import 'package:http_multi_server/http_multi_server.dart'; import 'package:http_multi_server/src/utils.dart'; import 'package:test/test.dart'; @@ -246,6 +248,72 @@ void main() { } }); }); + + group('HttpMultiServer.bindSecure', () { + late http.Client client; + late SecurityContext context; + setUp(() async { + context = SecurityContext() + ..setTrustedCertificatesBytes(_sslCert) + ..useCertificateChainBytes(_sslCert) + ..usePrivateKeyBytes(_sslKey, password: 'dartdart'); + client = http.IOClient(HttpClient(context: context)); + }); + test('listens on all localhost interfaces for "localhost"', () async { + final server = await HttpMultiServer.bindSecure('localhost', 0, context); + server.listen((request) { + request.response.write('got request'); + request.response.close(); + }); + + if (await supportsIPv4) { + expect(client.read(Uri.https('127.0.0.1:${server.port}', '')), + completion(equals('got request'))); + } + + if (await supportsIPv6) { + expect(client.read(Uri.https('[::1]:${server.port}', '')), + completion(equals('got request'))); + } + }); + + test('listens on all localhost interfaces for "any"', () async { + final server = await HttpMultiServer.bindSecure('any', 0, context); + server.listen((request) { + request.response.write('got request'); + request.response.close(); + }); + + if (await supportsIPv4) { + expect(client.read(Uri.https('127.0.0.1:${server.port}', '')), + completion(equals('got request'))); + } + + if (await supportsIPv6) { + expect(client.read(Uri.https('[::1]:${server.port}', '')), + completion(equals('got request'))); + } + }); + + test('listens on specified hostname', () async { + final server = + await HttpMultiServer.bindSecure(InternetAddress.anyIPv4, 0, context); + server.listen((request) { + request.response.write('got request'); + request.response.close(); + }); + + if (await supportsIPv4) { + expect(client.read(Uri.https('127.0.0.1:${server.port}', '')), + completion(equals('got request'))); + } + + if (await supportsIPv6) { + expect(client.read(Uri.https('[::1]:${server.port}', '')), + throwsA(isA())); + } + }); + }); } /// Makes a GET request to the root of [server] and returns the response. @@ -257,3 +325,97 @@ Future _read(HttpServer server) => http.read(_urlFor(server)); /// Returns the URL for the root of [server]. Uri _urlFor(HttpServer server) => Uri.http('${server.address.host}:${server.port}', '/'); + +final _sslCert = utf8.encode(''' +-----BEGIN CERTIFICATE----- +MIIDZDCCAkygAwIBAgIBATANBgkqhkiG9w0BAQsFADAgMR4wHAYDVQQDDBVpbnRl +cm1lZGlhdGVhdXRob3JpdHkwHhcNMTUxMDI3MTAyNjM1WhcNMjUxMDI0MTAyNjM1 +WjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQCkg/Qr8RQeLTOSgCkyiEX2ztgkgscX8hKGHEHdvlkmVK3JVEIIwkvu +/Y9LtHZUia3nPAgqEEbexzTENZjSCcC0V6I2XW/e5tIE3rO0KLZyhtZhN/2SfJ6p +KbOh0HLr1VtkKJGp1tzUmHW/aZI32pK60ZJ/N917NLPCJpCaL8+wHo3+w3oNqln6 +oJsfgxy9SUM8Bsc9WMYKMUdqLO1QKs1A5YwqZuO7Mwj+4LY2QDixC7Ua7V9YAPo2 +1SBeLvMCHbYxSPCuxcZ/kDkgax/DF9u7aZnGhMImkwBka0OQFvpfjKtTIuoobTpe +PAG7MQYXk4RjnjdyEX/9XAQzvNo1CDObAgMBAAGjgbQwgbEwPAYDVR0RBDUwM4IJ +bG9jYWxob3N0ggkxMjcuMC4wLjGCAzo6MYcEfwAAAYcQAAAAAAAAAAAAAAAAAAAA +ATAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBSvhJo6taTggJQBukEvMo/PDk8tKTAf +BgNVHSMEGDAWgBS98L4T5RaIToE3DkBRsoeWPil0eDAOBgNVHQ8BAf8EBAMCA6gw +EwYDVR0lBAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggEBAHLOt0mL2S4A +B7vN7KsfQeGlVgZUVlEjem6kqBh4fIzl4CsQuOO8oJ0FlO1z5JAIo98hZinymJx1 +phBVpyGIKakT/etMH0op5evLe9dD36VA3IM/FEv5ibk35iGnPokiJXIAcdHd1zam +YaTHRAnZET5S03+7BgRTKoRuszhbvuFz/vKXaIAnVNOF4Gf2NUJ/Ax7ssJtRkN+5 +UVxe8TZVxzgiRv1uF6NTr+J8PDepkHCbJ6zEQNudcFKAuC56DN1vUe06gRDrNbVq +2JHEh4pRfMpdsPCrS5YHBjVq/XHtFHgwDR6g0WTwSUJvDeM4OPQY5f61FB0JbFza +PkLkXmoIod8= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDLjCCAhagAwIBAgIBAjANBgkqhkiG9w0BAQsFADAYMRYwFAYDVQQDDA1yb290 +YXV0aG9yaXR5MB4XDTE1MTAyNzEwMjYzNVoXDTI1MTAyNDEwMjYzNVowIDEeMBwG +A1UEAwwVaW50ZXJtZWRpYXRlYXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA6GndRFiXk+2q+Ig7ZOWKKGta+is8137qyXz+eVFs5sA0ajMN +ZBAMWS0TIXw/Yks+y6fEcV/tfv91k1eUN4YXPcoxTdDF97d2hO9wxumeYOMnQeDy +VZVDKQBZ+jFMeI+VkNpMEdmsLErpZDGob/1dC8tLEuR6RuRR8X6IDGMPOCMw1jLK +V1bQjPtzqKadTscfjLuKxuLgspJdTrzsu6hdcl1mm8K6CjTY2HNXWxs1yYmwfuQ2 +Z4/8sOMNqFqLjN+ChD7pksTMq7IosqGiJzi2bpd5f44ek/k822Y0ATncJHk4h1Z+ +kZBnW6kgcLna1gDri9heRwSZ+M8T8nlHgIMZIQIDAQABo3sweTASBgNVHRMBAf8E +CDAGAQH/AgEAMB0GA1UdDgQWBBS98L4T5RaIToE3DkBRsoeWPil0eDAfBgNVHSME +GDAWgBRxD5DQHTmtpDFKDOiMf5FAi6vfbzAOBgNVHQ8BAf8EBAMCAgQwEwYDVR0l +BAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQELBQADggEBAD+4KpUeV5mUPw5IG/7w +eOXnUpeS96XFGuS1JuFo/TbgntPWSPyo+rD4GrPIkUXyoHaMCDd2UBEjyGbBIKlB +NZA3RJOAEp7DTkLNK4RFn/OEcLwG0J5brL7kaLRO4vwvItVIdZ2XIqzypRQTc0MG +MmF08zycnSlaN01ryM67AsMhwdHqVa+uXQPo8R8sdFGnZ33yywTYD73FeImXilQ2 +rDnFUVqmrW1fjl0Fi4rV5XI0EQiPrzKvRtmF8ZqjGATPOsRd64cwQX6V+P5hNeIR +9pba6td7AbNGausHfacRYMyoGJWWWkFPd+7jWOCPqW7Fk1tmBgdB8GzXa3inWIRM +RUE= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC+zCCAeOgAwIBAgIBATANBgkqhkiG9w0BAQsFADAYMRYwFAYDVQQDDA1yb290 +YXV0aG9yaXR5MB4XDTE1MTAyNzEwMjYzNFoXDTI1MTAyNDEwMjYzNFowGDEWMBQG +A1UEAwwNcm9vdGF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAMl+dcraUM/E7E6zl7+7hK9oUJYXJLnfiMtP/TRFVbH4+2aEN8vXzPbzKdR3 +FfaHczXQTwnTCaYA4u4uSDvSOsFFEfxEwYORsdKmQEM8nGpVX2NVvKsMcGIhh8kh +ZwJfkMIOcAxmGIHGdMhF8VghonJ8uGiuqktxdfpARq0g3fqIjDHsF9/LpfshUfk9 +wsRyTF0yr90U/dsfnE+u8l7GvVl8j2Zegp0sagAGtLaNv7tP17AibqEGg2yDBrBN +9r9ihe4CqMjx+Q2kQ2S9Gz2V2ReO/n6vm2VQxsPRB/lV/9jh7cUcS0/9mggLYrDy +cq1v7rLLQrWuxMz1E3gOhyCYJ38CAwEAAaNQME4wHQYDVR0OBBYEFHEPkNAdOa2k +MUoM6Ix/kUCLq99vMB8GA1UdIwQYMBaAFHEPkNAdOa2kMUoM6Ix/kUCLq99vMAwG +A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBABrhjnWC6b+z9Kw73C/niOwo +9sPdufjS6tb0sCwDjt3mjvE4NdNWt+/+ZOugW6dqtvqhtqZM1q0u9pJkNwIrqgFD +ZHcfNaf31G6Z2YE+Io7woTVw6fFobg/EFo+a/qwbvWL26McmiRL5yiSBjVjpX4a5 +kdZ+aPQUCBaLrTWwlCDqzSVIULWUQvveRWbToMFKPNID58NtEpymAx3Pgir7YjV9 +UnlU2l5vZrh1PTCqZxvC/IdRESUfW80LdHaeyizRUP+6vKxGgSz2MRuYINjbd6GO +hGiCpWlwziW2xLV1l2qSRLko2kIafLZP18N0ThM9zKbU5ps9NgFOf//wqSGtLaE= +-----END CERTIFICATE----- +'''); + +List _sslKey = utf8.encode(''' +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIE4zAcBgoqhkiG9w0BDAEBMA4ECBMCjlg8JYZ4AgIIAASCBMFd9cBoZ5xcTock +AVQcg/HzYJtMceKn1gtMDdC7mmXuyN0shoxhG4BpQInHkFARL+nenesXFxEm4X5e +L603Pcgw72/ratxVpTW7hPMjiLTEBqza0GjQm7Sarbdy+Vzdp/6XFrAcPfFl1juY +oyYzbozPsvFHz3Re44y1KmI4HAzU/qkjJUbNTTiPPVI2cDP6iYN2XXxBb1wwp8jR +iqdZqFG7lU/wvPEbD7BVPpmJBHWNG681zb4ea5Zn4hW8UaxpiIBiaH0/IWc2SVZd +RliAFo3NEsGxCcsnBo/n00oudGbOJxdOp7FbH5hJpeqX2WhCyJRxIeHOWmeuMAet +03HFriiEmJ99m2nEJN1x0A3QUUM7ji6vZAb4qb1dyq7LlX4M2aaqixRnaTcQkapf +DOxX35DEBXSKrDpyWp6Rx4wNpUyi1TKyhaVnYgD3Gn0VfC/2w86gSFlrf9PMYGM0 +PvFxTDzTyjOuPBRa728gZOGXgDOL7qvdInU/opVew7kFeRQHXxHzFCLK5dD+Vrig +5fS3m0++f55ODkxqHXB8gbXbd3GMmsW6MrGpU7VsCNtbVPdSMW0FalovEB0M+2lj +1VfuvL+0F5huTe+BgZAt6xgET/CIcZXdNMRPVhraqUjqWtI9Rdk4STPCpU1rDkjG +YDl/fo4W2T6qQWFUpiC9IvVVGkVxaqfZZ4Qu+V5xPUi6vk95QiTNkN1t+m+sCCgS +Llkea8Um0aHMy33Lj3NsfL0LMrnpniqcAks8BvcgIZwk1VRqcj7BQVCygJSYrmAR +DBhMpjWlXuSggnyVPuduZDtnTN+8lCHLOKL3a3bDb6ySaKX49Km6GutDLfpDtEA0 +3mQvmEG4XVm7zy+AlN72qFbtSLDRi/D/uQh2q/ZrFQLOBQBQB56TvEbKouLimUDM +ascQA3aUyhOE7e+d02NOFIFTozwc/C//CIFeA+ZEwxyfha/3Bor6Jez7PC/eHNxZ +w7YMXzPW9NhcCcerhYGebuCJxLwzqJ+IGdukjKsGV2ytWDoB2xZiJNu096j4RKcq +YSJoen0R7IH8N4eDujXR8m9kAl724Uqs1OoAs4VNICvzTutbsgVZ6Z+NMOcfnPw9 +jZkFhot16w8znD+OmhBR7/bzOLpaeUhk7EhNq5M6U0NNWx3WwkDlvU/jx+6/EQe3 +iLEHptH2HYBF1xscaKGbtKNtuQsfdzgWpOX0qK2YbK3yCKvL/xIm1DQmDZDKkWdW +VNh8oGV1H96CivWlvxhAgXKz9F/83CjMw8YXRk7RJvWR4vtNvXFAvGkFIYCN9Jv9 +p+1ukaYoxSLGBik907I6gWSHqumJiCprUyAX/bVfZfNiYh4hzeA3lhwxZSax3JG4 +7QFPvyepOmF/3AAzS/Pusx6jOZnuCMCkfQi6Wpem1o3s4x+fP7kz00Xuj01ErucM +S10ixfIh84kXBN3dTRDtDdeCyoMsBKO0W5jDBBlWL02YfdF6Opo1Q4cPh2DYgXMh +XEszNZSK5LB0y+f3A6Kdx/hkZzHVvMONA70OyrkoZzGyWENhcB0c7ntTJyPPD2qM +s0HRA2VwF/0ypU3OKERM1Ua5NSkTgvnnVTlV9GO90Tkn5v4fxdl8NzIuJLyGguTP +Xc0tRM34Lg== +-----END ENCRYPTED PRIVATE KEY----- +'''); From bcdc341a911a5b7b9a1d882301ee5506f2a96502 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 30 Apr 2021 10:51:13 -0700 Subject: [PATCH 063/107] Avoid IPv4 when unsupported (dart-lang/http_multi_server#37) Skip a test which checks that binding to `anyIPv4` doesn't bind to an IPv6 address when IPv4 isn't supported. --- pkgs/http_multi_server/CHANGELOG.md | 2 ++ pkgs/http_multi_server/pubspec.yaml | 2 +- pkgs/http_multi_server/test/http_multi_server_test.dart | 7 +++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index f4e4dc1675..32eca00ace 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,5 @@ +## 3.1.1-dev + ## 3.1.0 * Add `HttpMultiServer.bindSecure` to match `HttpMultiServer.bind`. diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index af58e87e93..c03d3587bc 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 3.1.0 +version: 3.1.1-dev description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 96ffa2341c..3a0bdcfaa7 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -296,6 +296,7 @@ void main() { }); test('listens on specified hostname', () async { + if (!await supportsIPv4) return; final server = await HttpMultiServer.bindSecure(InternetAddress.anyIPv4, 0, context); server.listen((request) { @@ -303,10 +304,8 @@ void main() { request.response.close(); }); - if (await supportsIPv4) { - expect(client.read(Uri.https('127.0.0.1:${server.port}', '')), - completion(equals('got request'))); - } + expect(client.read(Uri.https('127.0.0.1:${server.port}', '')), + completion(equals('got request'))); if (await supportsIPv6) { expect(client.read(Uri.https('[::1]:${server.port}', '')), From ec3b3e43d88d0d1431492aebfbcbad28d43dc1b6 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Sat, 5 Jun 2021 13:26:36 -0700 Subject: [PATCH 064/107] Add dependabot --- pkgs/http_multi_server/.github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 pkgs/http_multi_server/.github/dependabot.yml diff --git a/pkgs/http_multi_server/.github/dependabot.yml b/pkgs/http_multi_server/.github/dependabot.yml new file mode 100644 index 0000000000..430a85e7d0 --- /dev/null +++ b/pkgs/http_multi_server/.github/dependabot.yml @@ -0,0 +1,11 @@ +# Set update schedule for GitHub Actions +# See https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot + +version: 2 +updates: + +- package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "daily" From d28e78eeb16037cbab8593f8c95646037cd44732 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 5 Jun 2021 13:40:11 -0700 Subject: [PATCH 065/107] Bump dart-lang/setup-dart from 0.3 to 1 (dart-lang/http_multi_server#38) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 0.3 to 1. - [Release notes](https://github.com/dart-lang/setup-dart/releases) - [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/setup-dart/compare/v0.3...v1) --- updated-dependencies: - dependency-name: dart-lang/setup-dart dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kevin Moore --- pkgs/http_multi_server/.github/workflows/test-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 21a3c50b68..cecfdde6f9 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v0.3 + - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} - id: install @@ -47,10 +47,10 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [dev] + sdk: [2.12.0, dev] steps: - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v0.3 + - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} - id: install From d2820edf36828bd113372f922fd8b2e0c89ecbaf Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 1 Feb 2022 18:04:50 -0800 Subject: [PATCH 066/107] Forward the preserveHeaderCase argument (dart-lang/http_multi_server#39) Closes dart-lang/http_multi_server#23 The min SDK constraint is already higher than 2.8 which is the version which introduced this argument. --- pkgs/http_multi_server/CHANGELOG.md | 4 +++- pkgs/http_multi_server/lib/src/multi_headers.dart | 4 ++-- pkgs/http_multi_server/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 32eca00ace..a6ec3d9868 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,4 +1,6 @@ -## 3.1.1-dev +## 3.2.0 + +* Honor the `preserveHeaderCase` argument to `MultiHeaders.set` and `.add`. ## 3.1.0 diff --git a/pkgs/http_multi_server/lib/src/multi_headers.dart b/pkgs/http_multi_server/lib/src/multi_headers.dart index 92bfd649dc..c5ee3d2ae8 100644 --- a/pkgs/http_multi_server/lib/src/multi_headers.dart +++ b/pkgs/http_multi_server/lib/src/multi_headers.dart @@ -96,7 +96,7 @@ class MultiHeaders implements HttpHeaders { @override void add(String name, Object value, {bool preserveHeaderCase = false}) { for (var headers in _headers) { - headers.add(name, value); + headers.add(name, value, preserveHeaderCase: preserveHeaderCase); } } @@ -128,7 +128,7 @@ class MultiHeaders implements HttpHeaders { @override void set(String name, Object value, {bool preserveHeaderCase = false}) { for (var headers in _headers) { - headers.set(name, value); + headers.set(name, value, preserveHeaderCase: preserveHeaderCase); } } diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index c03d3587bc..02f9ebe23b 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 3.1.1-dev +version: 3.2.0 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. From 8d07869dd84cb92921c166b6d3dda2502606892d Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Wed, 9 Feb 2022 19:49:10 -0800 Subject: [PATCH 067/107] Drop unnecessary SDK constraint suffix (dart-lang/http_multi_server#40) The `-0` suffix allowed pre-stable SDKs before the launch of null safety, but with the stable release available it is not necessary. --- pkgs/http_multi_server/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 02f9ebe23b..4b9edf5a32 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -6,7 +6,7 @@ description: >- homepage: https://github.com/dart-lang/http_multi_server environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: async: ^2.5.0 From da60302a2e14cf526255e16b7527dea19c08422e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 11:16:11 -0800 Subject: [PATCH 068/107] Bump actions/checkout from 2 to 3 (dart-lang/http_multi_server#41) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index cecfdde6f9..6c7108d860 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} From f1a3288110d82f90c882e15c42503102ed385931 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 29 Apr 2022 16:22:54 -0700 Subject: [PATCH 069/107] Update pubspec.yaml --- pkgs/http_multi_server/pubspec.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 4b9edf5a32..cdc814e136 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,9 +1,8 @@ name: http_multi_server version: 3.2.0 - description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. -homepage: https://github.com/dart-lang/http_multi_server +repository: https://github.com/dart-lang/http_multi_server environment: sdk: '>=2.12.0 <3.0.0' From 106b7431b7a23759023bed4842cc29944b26ad1f Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 29 Apr 2022 23:24:42 +0000 Subject: [PATCH 070/107] rev to a dev version --- pkgs/http_multi_server/CHANGELOG.md | 2 ++ pkgs/http_multi_server/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index a6ec3d9868..c982ff7591 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,5 @@ +## 3.2.1-dev + ## 3.2.0 * Honor the `preserveHeaderCase` argument to `MultiHeaders.set` and `.add`. diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index cdc814e136..7887732cfd 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 3.2.0 +version: 3.2.1-dev description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. repository: https://github.com/dart-lang/http_multi_server From b69c6f00d605b4a6f9b7088fb32b146253941729 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 12 May 2022 03:11:25 +0000 Subject: [PATCH 071/107] switch to package:lints --- pkgs/http_multi_server/README.md | 4 +++ pkgs/http_multi_server/analysis_options.yaml | 29 ++----------------- pkgs/http_multi_server/pubspec.yaml | 2 +- .../test/http_multi_server_test.dart | 6 ++-- 4 files changed, 11 insertions(+), 30 deletions(-) diff --git a/pkgs/http_multi_server/README.md b/pkgs/http_multi_server/README.md index ac6927e509..da27074155 100644 --- a/pkgs/http_multi_server/README.md +++ b/pkgs/http_multi_server/README.md @@ -1,3 +1,7 @@ +[![Dart CI](https://github.com/dart-lang/http_multi_server/actions/workflows/test-package.yml/badge.svg)](https://github.com/dart-lang/http_multi_server/actions/workflows/test-package.yml) +[![pub package](https://img.shields.io/pub/v/http_multi_server.svg)](https://pub.dev/packages/http_multi_server) +[![package publisher](https://img.shields.io/pub/publisher/http_multi_server.svg)](https://pub.dev/packages/http_multi_server/publisher) + An implementation of `dart:io`'s [HttpServer][] that wraps multiple servers and forwards methods to all of them. It's useful for serving the same application on multiple network interfaces while still having a unified way of controlling the diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml index 027be6fee2..4fa4b8d134 100644 --- a/pkgs/http_multi_server/analysis_options.yaml +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -1,30 +1,5 @@ -include: package:pedantic/analysis_options.yaml +include: package:lints/recommended.yaml + analyzer: strong-mode: implicit-casts: false -linter: - rules: - - avoid_null_checks_in_equality_operators - - avoid_unused_constructor_parameters - - annotate_overrides - - await_only_futures - - camel_case_types - - cancel_subscriptions - - constant_identifier_names - - control_flow_in_finally - - directives_ordering - - empty_statements - - hash_and_equals - - implementation_imports - - iterable_contains_unrelated_type - - list_remove_unrelated_type - - non_constant_identifier_names - - overridden_fields - - package_api_docs - - package_names - - package_prefixed_library_names - - prefer_final_fields - - prefer_generic_function_type_aliases - - test_types_in_equals - - throw_in_finally - - unnecessary_brace_in_string_interps diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 7887732cfd..65c0b0e9be 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: dev_dependencies: http: ^0.13.0 - pedantic: ^1.10.0 + lints: ^1.0.0 test: ^1.16.0 dependency_overrides: diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 3a0bdcfaa7..0591267504 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -14,10 +14,11 @@ import 'package:test/test.dart'; void main() { group('with multiple HttpServers', () { - var multiServer; + late HttpMultiServer multiServer; late HttpServer subServer1; late HttpServer subServer2; late HttpServer subServer3; + setUp(() { return Future.wait([ HttpServer.bind('localhost', 0).then((server) => subServer1 = server), @@ -159,7 +160,8 @@ void main() { }); group('HttpMultiServer.loopback', () { - var server; + late HttpServer server; + setUp(() { return HttpMultiServer.loopback(0).then((s) => server = s); }); From 2555ef5aee5c7b1b40312bfe1279bf0a6175e069 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 15 Jun 2022 11:22:36 -0700 Subject: [PATCH 072/107] 3.2.1 --- pkgs/http_multi_server/CHANGELOG.md | 4 +++- pkgs/http_multi_server/pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index c982ff7591..3988a6a07e 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,4 +1,6 @@ -## 3.2.1-dev +## 3.2.1 + +* Populate the pubspec `repository` field. ## 3.2.0 diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 65c0b0e9be..3d855c0b8b 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 3.2.1-dev +version: 3.2.1 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. repository: https://github.com/dart-lang/http_multi_server From 5f6fbe020e19b12cb7f633dfe5fea1b77a49888b Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 9 Nov 2022 15:47:29 -0800 Subject: [PATCH 073/107] blast_repo fixes (dart-lang/http_multi_server#46) Dependabot GitHub Action --- pkgs/http_multi_server/.github/dependabot.yml | 16 +++++++--------- .../.github/workflows/test-package.yml | 8 ++++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/pkgs/http_multi_server/.github/dependabot.yml b/pkgs/http_multi_server/.github/dependabot.yml index 430a85e7d0..1603cdd9ee 100644 --- a/pkgs/http_multi_server/.github/dependabot.yml +++ b/pkgs/http_multi_server/.github/dependabot.yml @@ -1,11 +1,9 @@ -# Set update schedule for GitHub Actions -# See https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot - +# Dependabot configuration file. +# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates version: 2 -updates: -- package-ecosystem: "github-actions" - directory: "/" - schedule: - # Check for updates to GitHub Actions every weekday - interval: "daily" +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 6c7108d860..81ebfebcd5 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,8 +22,8 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} - id: install @@ -49,8 +49,8 @@ jobs: os: [ubuntu-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} - id: install From b6ae63c02bb2edf21940ea0ffd1a49010c4b82a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 09:33:08 -0800 Subject: [PATCH 074/107] Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/http_multi_server#47) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8...755da8c3cf115ac066823e79a1e1788f8940201b) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 81ebfebcd5..ab056f0b51 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} From d41543429aed32c07398942f515dafc52ef38825 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 9 Jan 2023 14:58:22 -0800 Subject: [PATCH 075/107] Migrate from no-implicit-casts to strict-casts (dart-lang/http_multi_server#48) --- pkgs/http_multi_server/analysis_options.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml index 4fa4b8d134..055ac10871 100644 --- a/pkgs/http_multi_server/analysis_options.yaml +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -1,5 +1,5 @@ include: package:lints/recommended.yaml analyzer: - strong-mode: - implicit-casts: false + language: + strict-casts: true From 076ef46e89fd8c6cf30ff7bb5a44bf5f4df4cf8e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:50:50 -0800 Subject: [PATCH 076/107] Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/http_multi_server#50) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/755da8c3cf115ac066823e79a1e1788f8940201b...ac593985615ec2ede58e132d2e21d2b1cbd6127c) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index ab056f0b51..5d934e8fde 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} From 8a9583e02226da2e2487be97a89b355f09f395e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Feb 2023 14:52:49 -0800 Subject: [PATCH 077/107] Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/http_multi_server#49) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.3 to 1.4. - [Release notes](https://github.com/dart-lang/setup-dart/releases) - [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/setup-dart/compare/6a218f2413a3e78e9087f638a238f6b40893203d...a57a6c04cf7d4840e88432aad6281d1e125f0d46) --- updated-dependencies: - dependency-name: dart-lang/setup-dart dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 5d934e8fde..b552d6ae01 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [2.12.0, dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} - id: install From ae85c13cf9a4fb607845e69e100704d4f13beb09 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 6 Mar 2023 09:12:41 -0800 Subject: [PATCH 078/107] Require Dart 2.19, enable and fix new team lints (dart-lang/http_multi_server#51) --- .../.github/workflows/test-package.yml | 2 +- pkgs/http_multi_server/CHANGELOG.md | 4 ++ pkgs/http_multi_server/analysis_options.yaml | 29 +++++++++- pkgs/http_multi_server/example/main.dart | 9 +-- .../lib/http_multi_server.dart | 51 ++++++++-------- pkgs/http_multi_server/lib/src/utils.dart | 4 +- pkgs/http_multi_server/pubspec.yaml | 10 ++-- .../test/http_multi_server_test.dart | 58 +++++++++---------- 8 files changed, 96 insertions(+), 71 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index b552d6ae01..f8d94daae4 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [2.12.0, dev] + sdk: [2.19.0, dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 3988a6a07e..70b7abdeb1 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.2.2-dev + +* Require Dart 2.19 + ## 3.2.1 * Populate the pubspec `repository` field. diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml index 055ac10871..9076448b3d 100644 --- a/pkgs/http_multi_server/analysis_options.yaml +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -1,5 +1,32 @@ -include: package:lints/recommended.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: strict-casts: true + +linter: + rules: + - avoid_bool_literals_in_conditional_expressions + - avoid_classes_with_only_static_members + - avoid_private_typedef_functions + - avoid_redundant_argument_values + - avoid_returning_null + - avoid_returning_null_for_future + - avoid_returning_this + - avoid_unused_constructor_parameters + - cancel_subscriptions + - cascade_invocations + - comment_references + - join_return_with_assignment + - literal_only_boolean_expressions + - no_adjacent_strings_in_list + - no_runtimeType_toString + - package_api_docs + - prefer_const_constructors + - prefer_const_declarations + - prefer_expression_function_bodies + - prefer_final_locals + - prefer_relative_imports + - test_types_in_equals + - use_string_buffers + - use_super_parameters diff --git a/pkgs/http_multi_server/example/main.dart b/pkgs/http_multi_server/example/main.dart index 00f9515162..661b52e0c1 100644 --- a/pkgs/http_multi_server/example/main.dart +++ b/pkgs/http_multi_server/example/main.dart @@ -5,8 +5,9 @@ import 'package:shelf/shelf_io.dart' as shelf_io; void main() async { // Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same // server. - var server = await HttpMultiServer.loopback(8080); - shelf_io.serveRequests(server, (request) { - return shelf.Response.ok('Hello, world!'); - }); + final server = await HttpMultiServer.loopback(8080); + shelf_io.serveRequests( + server, + (request) => shelf.Response.ok('Hello, world!'), + ); } diff --git a/pkgs/http_multi_server/lib/http_multi_server.dart b/pkgs/http_multi_server/lib/http_multi_server.dart index 5f23947ea5..18fba335e4 100644 --- a/pkgs/http_multi_server/lib/http_multi_server.dart +++ b/pkgs/http_multi_server/lib/http_multi_server.dart @@ -106,29 +106,27 @@ class HttpMultiServer extends StreamView implements HttpServer { /// /// See [HttpServer.bind]. static Future loopback(int port, - {int backlog = 0, bool v6Only = false, bool shared = false}) { - return _loopback( - port, - (address, port) => HttpServer.bind(address, port, - backlog: backlog, v6Only: v6Only, shared: shared)); - } + {int backlog = 0, bool v6Only = false, bool shared = false}) => + _loopback( + port, + (address, port) => HttpServer.bind(address, port, + backlog: backlog, v6Only: v6Only, shared: shared)); /// Like [loopback], but supports HTTPS requests. /// /// See [HttpServer.bindSecure]. static Future loopbackSecure(int port, SecurityContext context, - {int backlog = 0, - bool v6Only = false, - bool requestClientCertificate = false, - bool shared = false}) { - return _loopback( - port, - (address, port) => HttpServer.bindSecure(address, port, context, - backlog: backlog, - v6Only: v6Only, - shared: shared, - requestClientCertificate: requestClientCertificate)); - } + {int backlog = 0, + bool v6Only = false, + bool requestClientCertificate = false, + bool shared = false}) => + _loopback( + port, + (address, port) => HttpServer.bindSecure(address, port, context, + backlog: backlog, + v6Only: v6Only, + shared: shared, + requestClientCertificate: requestClientCertificate)); /// Bind an [HttpServer] with handling for special addresses 'localhost' and /// 'any'. @@ -206,13 +204,13 @@ class HttpMultiServer extends StreamView implements HttpServer { return await bind(InternetAddress.loopbackIPv6, port); } - var v4Server = await bind(InternetAddress.loopbackIPv4, port); + final v4Server = await bind(InternetAddress.loopbackIPv4, port); if (!await supportsIPv6) return v4Server; try { // Reuse the IPv4 server's port so that if [port] is 0, both servers use // the same ephemeral port. - var v6Server = await bind(InternetAddress.loopbackIPv6, v4Server.port); + final v6Server = await bind(InternetAddress.loopbackIPv6, v4Server.port); return HttpMultiServer([v4Server, v6Server]); } on SocketException catch (error) { // If there is already a server listening we'll lose the reference on a @@ -238,13 +236,14 @@ class HttpMultiServer extends StreamView implements HttpServer { /// current connections handled by all the servers. @override HttpConnectionsInfo connectionsInfo() { - var info = HttpConnectionsInfo(); + final info = HttpConnectionsInfo(); for (var server in _servers) { - var subInfo = server.connectionsInfo(); - info.total += subInfo.total; - info.active += subInfo.active; - info.idle += subInfo.idle; - info.closing += subInfo.closing; + final subInfo = server.connectionsInfo(); + info + ..total += subInfo.total + ..active += subInfo.active + ..idle += subInfo.idle + ..closing += subInfo.closing; } return info; } diff --git a/pkgs/http_multi_server/lib/src/utils.dart b/pkgs/http_multi_server/lib/src/utils.dart index e9fb3b4d27..87520fb9cd 100644 --- a/pkgs/http_multi_server/lib/src/utils.dart +++ b/pkgs/http_multi_server/lib/src/utils.dart @@ -7,7 +7,7 @@ import 'dart:io'; /// Returns whether this computer supports binding to IPv6 addresses. final Future supportsIPv6 = () async { try { - var socket = await ServerSocket.bind(InternetAddress.loopbackIPv6, 0); + final socket = await ServerSocket.bind(InternetAddress.loopbackIPv6, 0); await socket.close(); return true; } on SocketException catch (_) { @@ -18,7 +18,7 @@ final Future supportsIPv6 = () async { /// Returns whether this computer supports binding to IPv4 addresses. final Future supportsIPv4 = () async { try { - var socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0); + final socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0); await socket.close(); return true; } on SocketException catch (_) { diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 3d855c0b8b..9220548c17 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,19 +1,17 @@ name: http_multi_server -version: 3.2.1 +version: 3.2.2-dev description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. repository: https://github.com/dart-lang/http_multi_server environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.19.0 <3.0.0' dependencies: async: ^2.5.0 dev_dependencies: + dart_flutter_team_lints: ^1.0.0 http: ^0.13.0 - lints: ^1.0.0 - test: ^1.16.0 - -dependency_overrides: + shelf: ^1.4.0 test: ^1.16.0 diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 0591267504..62f5b772e6 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -19,13 +19,11 @@ void main() { late HttpServer subServer2; late HttpServer subServer3; - setUp(() { - return Future.wait([ - HttpServer.bind('localhost', 0).then((server) => subServer1 = server), - HttpServer.bind('localhost', 0).then((server) => subServer2 = server), - HttpServer.bind('localhost', 0).then((server) => subServer3 = server) - ]).then((servers) => multiServer = HttpMultiServer(servers)); - }); + setUp(() => Future.wait([ + HttpServer.bind('localhost', 0).then((server) => subServer1 = server), + HttpServer.bind('localhost', 0).then((server) => subServer2 = server), + HttpServer.bind('localhost', 0).then((server) => subServer3 = server) + ]).then((servers) => multiServer = HttpMultiServer(servers))); tearDown(() => multiServer.close()); @@ -41,12 +39,12 @@ void main() { }); test('serverHeader= sets the value for all servers', () { - multiServer.serverHeader = 'http_multi_server test'; - - multiServer.listen((request) { - request.response.write('got request'); - request.response.close(); - }); + multiServer + ..serverHeader = 'http_multi_server test' + ..listen((request) { + request.response.write('got request'); + request.response.close(); + }); expect( _get(subServer1).then((response) { @@ -71,12 +69,12 @@ void main() { }); test('autoCompress= sets the value for all servers', () { - multiServer.autoCompress = true; - - multiServer.listen((request) { - request.response.write('got request'); - request.response.close(); - }); + multiServer + ..autoCompress = true + ..listen((request) { + request.response.write('got request'); + request.response.close(); + }); expect( _get(subServer1).then((response) { @@ -130,8 +128,8 @@ void main() { test('connectionsInfo sums the values for all servers', () { var pendingRequests = 0; - var awaitingResponseCompleter = Completer(); - var sendResponseCompleter = Completer(); + final awaitingResponseCompleter = Completer(); + final sendResponseCompleter = Completer(); multiServer.listen((request) { sendResponseCompleter.future.then((_) { request.response.write('got request'); @@ -148,7 +146,7 @@ void main() { expect(_get(subServer2), completes); return awaitingResponseCompleter.future.then((_) { - var info = multiServer.connectionsInfo(); + final info = multiServer.connectionsInfo(); expect(info.total, equals(2)); expect(info.active, equals(2)); expect(info.idle, equals(0)); @@ -162,9 +160,7 @@ void main() { group('HttpMultiServer.loopback', () { late HttpServer server; - setUp(() { - return HttpMultiServer.loopback(0).then((s) => server = s); - }); + setUp(() => HttpMultiServer.loopback(0).then((s) => server = s)); tearDown(() => server.close()); @@ -269,12 +265,12 @@ void main() { }); if (await supportsIPv4) { - expect(client.read(Uri.https('127.0.0.1:${server.port}', '')), + expect(client.read(Uri.https('127.0.0.1:${server.port}')), completion(equals('got request'))); } if (await supportsIPv6) { - expect(client.read(Uri.https('[::1]:${server.port}', '')), + expect(client.read(Uri.https('[::1]:${server.port}')), completion(equals('got request'))); } }); @@ -287,12 +283,12 @@ void main() { }); if (await supportsIPv4) { - expect(client.read(Uri.https('127.0.0.1:${server.port}', '')), + expect(client.read(Uri.https('127.0.0.1:${server.port}')), completion(equals('got request'))); } if (await supportsIPv6) { - expect(client.read(Uri.https('[::1]:${server.port}', '')), + expect(client.read(Uri.https('[::1]:${server.port}')), completion(equals('got request'))); } }); @@ -306,11 +302,11 @@ void main() { request.response.close(); }); - expect(client.read(Uri.https('127.0.0.1:${server.port}', '')), + expect(client.read(Uri.https('127.0.0.1:${server.port}')), completion(equals('got request'))); if (await supportsIPv6) { - expect(client.read(Uri.https('[::1]:${server.port}', '')), + expect(client.read(Uri.https('[::1]:${server.port}')), throwsA(isA())); } }); From 4e98ab8063ef5e4a81459a8b0397c9426b10f08c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 12:03:32 -0700 Subject: [PATCH 079/107] Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/http_multi_server#52) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/dart-lang/setup-dart/releases) - [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/setup-dart/compare/a57a6c04cf7d4840e88432aad6281d1e125f0d46...d6a63dab3335f427404425de0fbfed4686d93c4f) --- updated-dependencies: - dependency-name: dart-lang/setup-dart dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index f8d94daae4..4afb7ad003 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [2.19.0, dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} - id: install From 7e71efb41fd167d8c42d2357f196489984e9e79a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 14:35:13 -0700 Subject: [PATCH 080/107] Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/http_multi_server#53) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.5.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/ac593985615ec2ede58e132d2e21d2b1cbd6127c...8f4b7f84864484a7bf31766abe9204da3cbe65b3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 4afb7ad003..cdda2d399f 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From 8b5c7ec58a7cd0657dca7af85587a3d4018152f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 May 2023 12:22:02 -0700 Subject: [PATCH 081/107] Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/http_multi_server#54) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.0 to 3.5.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/8f4b7f84864484a7bf31766abe9204da3cbe65b3...8e5e7e5ab8b370d6c329ec480221332ada57f0ab) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index cdda2d399f..310e9aae15 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From a43a0a4e25196ab57408047ce97e59091e74aff9 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 17 May 2023 10:39:55 -0700 Subject: [PATCH 082/107] blast_repo fixes (dart-lang/http_multi_server#55) dependabot --- pkgs/http_multi_server/.github/dependabot.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/http_multi_server/.github/dependabot.yml b/pkgs/http_multi_server/.github/dependabot.yml index 1603cdd9ee..725f03af2e 100644 --- a/pkgs/http_multi_server/.github/dependabot.yml +++ b/pkgs/http_multi_server/.github/dependabot.yml @@ -3,7 +3,9 @@ version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: - interval: "monthly" + interval: monthly + labels: + - autosubmit From 334125d8443ae5d25660f34ab7374c0c5b0d5db6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 22:16:21 +0000 Subject: [PATCH 083/107] Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/http_multi_server#56) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
Release notes

Sourced from actions/checkout's releases.

v3.5.3

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v3...v3.5.3

Changelog

Sourced from actions/checkout's changelog.

Changelog

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

v3.1.0

v3.0.2

v3.0.1

v3.0.0

v2.3.1

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=3.5.2&new-version=3.5.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 310e9aae15..9cc767377e 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From 779cbafc7d43eb667fcb110d4ad0bee03d2c1419 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Sep 2023 22:53:35 +0000 Subject: [PATCH 084/107] Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/http_multi_server#57) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0.
Release notes

Sourced from actions/checkout's releases.

v3.6.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v3.5.3...v3.6.0

Changelog

Sourced from actions/checkout's changelog.

Changelog

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

v3.1.0

v3.0.2

v3.0.1

v3.0.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=3.5.3&new-version=3.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 9cc767377e..90e3d7b700 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From e8d5de45bab5972ddeb03299916c8c5c16ac6f15 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 22:39:57 +0000 Subject: [PATCH 085/107] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/http_multi_server#58) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.5.0 to 1.5.1.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

v1.2.0

  • Fixed a path issue impacting git dependencies on Windows.

v1.1.0

  • Added a flavor option setup.sh to allow downloading unpublished builds.

v1.0.0

  • Promoted to 1.0 stable.

v0.5

  • Fixed a Windows pub global activate path issue.

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.5.0&new-version=1.5.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 90e3d7b700..6290a78887 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [2.19.0, dev] steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} - id: install From 9e338f05d199c0c8d5ab45df3e3fabf1bfbbe4ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 18:25:12 +0000 Subject: [PATCH 086/107] Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/http_multi_server#59) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.1.0.
Release notes

Sourced from actions/checkout's releases.

v4.1.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.0.0...v4.1.0

v4.0.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v3...v4.0.0

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

v3.1.0

v3.0.2

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=3.6.0&new-version=4.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 6290a78887..1cf12fb3d7 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} From ff00778356f9654a5ef6267a32b4438a876f25c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:24:36 +0000 Subject: [PATCH 087/107] Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/http_multi_server#60) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
Release notes

Sourced from actions/checkout's releases.

v4.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.0...v4.1.1

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.0&new-version=4.1.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 1cf12fb3d7..b6ab9cbfe8 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} From 2c389f57e108615633e0827bc7530361cfafc737 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Dec 2023 02:24:21 +0000 Subject: [PATCH 088/107] Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/http_multi_server#61) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.5.1 to 1.6.0.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

v1.2.0

  • Fixed a path issue impacting git dependencies on Windows.

v1.1.0

  • Added a flavor option setup.sh to allow downloading unpublished builds.

v1.0.0

  • Promoted to 1.0 stable.

v0.5

  • Fixed a Windows pub global activate path issue.

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.5.1&new-version=1.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index b6ab9cbfe8..a3cc511e63 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [2.19.0, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} - id: install From 5a87d972343c354ce0c40877c039016bb82c547e Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 24 Jan 2024 14:13:58 -0800 Subject: [PATCH 089/107] blast_repo fixes (dart-lang/http_multi_server#62) auto-publish, github-actions, no-response --- .../.github/workflows/no-response.yml | 37 +++++++++++++++++++ .../.github/workflows/publish.yaml | 17 +++++++++ .../.github/workflows/test-package.yml | 4 +- 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 pkgs/http_multi_server/.github/workflows/no-response.yml create mode 100644 pkgs/http_multi_server/.github/workflows/publish.yaml diff --git a/pkgs/http_multi_server/.github/workflows/no-response.yml b/pkgs/http_multi_server/.github/workflows/no-response.yml new file mode 100644 index 0000000000..ab1ac49842 --- /dev/null +++ b/pkgs/http_multi_server/.github/workflows/no-response.yml @@ -0,0 +1,37 @@ +# A workflow to close issues where the author hasn't responded to a request for +# more information; see https://github.com/actions/stale. + +name: No Response + +# Run as a daily cron. +on: + schedule: + # Every day at 8am + - cron: '0 8 * * *' + +# All permissions not specified are set to 'none'. +permissions: + issues: write + pull-requests: write + +jobs: + no-response: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'dart-lang' }} + steps: + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e + with: + # Don't automatically mark inactive issues+PRs as stale. + days-before-stale: -1 + # Close needs-info issues and PRs after 14 days of inactivity. + days-before-close: 14 + stale-issue-label: "needs-info" + close-issue-message: > + Without additional information we're not able to resolve this issue. + Feel free to add more info or respond to any questions above and we + can reopen the case. Thanks for your contribution! + stale-pr-label: "needs-info" + close-pr-message: > + Without additional information we're not able to resolve this PR. + Feel free to add more info or respond to any questions above. + Thanks for your contribution! diff --git a/pkgs/http_multi_server/.github/workflows/publish.yaml b/pkgs/http_multi_server/.github/workflows/publish.yaml new file mode 100644 index 0000000000..27157a046a --- /dev/null +++ b/pkgs/http_multi_server/.github/workflows/publish.yaml @@ -0,0 +1,17 @@ +# A CI configuration to auto-publish pub packages. + +name: Publish + +on: + pull_request: + branches: [ master ] + push: + tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] + +jobs: + publish: + if: ${{ github.repository_owner == 'dart-lang' }} + uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main + permissions: + id-token: write # Required for authentication using OIDC + pull-requests: write # Required for writing the pull request note diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index a3cc511e63..d30c27bd91 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [2.19.0, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b with: sdk: ${{ matrix.sdk }} - id: install From f28092d14edd16ad60764af637baf35e3e60dcde Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 24 Jan 2024 14:14:46 -0800 Subject: [PATCH 090/107] Update lints, require Dart 3.2 (dart-lang/http_multi_server#63) --- pkgs/http_multi_server/.github/workflows/test-package.yml | 2 +- pkgs/http_multi_server/CHANGELOG.md | 4 ++-- pkgs/http_multi_server/analysis_options.yaml | 8 +------- pkgs/http_multi_server/pubspec.yaml | 8 ++++---- pkgs/http_multi_server/test/http_multi_server_test.dart | 4 ++-- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index d30c27bd91..89c7e63566 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [2.19.0, dev] + sdk: [3.2, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 70b7abdeb1..4ea18f20dc 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,6 +1,6 @@ -## 3.2.2-dev +## 3.2.2-wip -* Require Dart 2.19 +* Require Dart 3.2 ## 3.2.1 diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml index 9076448b3d..0154535551 100644 --- a/pkgs/http_multi_server/analysis_options.yaml +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -1,3 +1,4 @@ +# https://dart.dev/tools/analysis#the-analysis-options-file include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: @@ -10,23 +11,16 @@ linter: - avoid_classes_with_only_static_members - avoid_private_typedef_functions - avoid_redundant_argument_values - - avoid_returning_null - - avoid_returning_null_for_future - avoid_returning_this - avoid_unused_constructor_parameters - cancel_subscriptions - cascade_invocations - - comment_references - join_return_with_assignment - literal_only_boolean_expressions - no_adjacent_strings_in_list - no_runtimeType_toString - package_api_docs - - prefer_const_constructors - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_locals - - prefer_relative_imports - - test_types_in_equals - use_string_buffers - - use_super_parameters diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 9220548c17..992ee00476 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,17 +1,17 @@ name: http_multi_server -version: 3.2.2-dev +version: 3.2.2-wip description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. repository: https://github.com/dart-lang/http_multi_server environment: - sdk: '>=2.19.0 <3.0.0' + sdk: ^3.2.0 dependencies: async: ^2.5.0 dev_dependencies: - dart_flutter_team_lints: ^1.0.0 - http: ^0.13.0 + dart_flutter_team_lints: ^2.0.0 + http: ^1.0.0 shelf: ^1.4.0 test: ^1.16.0 diff --git a/pkgs/http_multi_server/test/http_multi_server_test.dart b/pkgs/http_multi_server/test/http_multi_server_test.dart index 62f5b772e6..a644348cbb 100644 --- a/pkgs/http_multi_server/test/http_multi_server_test.dart +++ b/pkgs/http_multi_server/test/http_multi_server_test.dart @@ -128,8 +128,8 @@ void main() { test('connectionsInfo sums the values for all servers', () { var pendingRequests = 0; - final awaitingResponseCompleter = Completer(); - final sendResponseCompleter = Completer(); + final awaitingResponseCompleter = Completer(); + final sendResponseCompleter = Completer(); multiServer.listen((request) { sendResponseCompleter.future.then((_) { request.response.write('got request'); From fad988ca784ab384eb4197b4c99eecf8e45291c0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:42:54 +0000 Subject: [PATCH 091/107] Bump dart-lang/setup-dart from 1.6.1 to 1.6.2 (dart-lang/http_multi_server#64) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.1 to 1.6.2.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.2

Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

v1.2.0

  • Fixed a path issue impacting git dependencies on Windows.

v1.1.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.1&new-version=1.6.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 89c7e63566..cf89e3c0fe 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b + - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [3.2, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b + - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} - id: install From 0e0d661cc5323369a620fe029fbabe7b000bc2dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:59:16 +0000 Subject: [PATCH 092/107] Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/http_multi_server#65) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
Release notes

Sourced from actions/checkout's releases.

v4.1.2

We are investigating the following issue with this release and have rolled-back the v4 tag to point to v4.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.1...v4.1.2

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.1&new-version=4.1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index cf89e3c0fe..7b2526891d 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [3.2, dev] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} From 34b47f519e7520dc7b1fd66cb6de978405c8284e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 22:53:54 +0000 Subject: [PATCH 093/107] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/http_multi_server#67) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.2 to 1.6.4.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.4

  • Rebuild JS code to include changes from v1.6.3

v1.6.3

Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.4

  • Rebuild JS code.

v1.6.3

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

  • The install location of the Dart SDK is now available

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.2&new-version=1.6.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 7b2526891d..588cf061da 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [3.2, dev] steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} - id: install From e9ba5c5c2d7a7e69345fdf27932a78cfdd86fc33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 03:00:16 +0000 Subject: [PATCH 094/107] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/http_multi_server#66) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.4.
Release notes

Sourced from actions/checkout's releases.

v4.1.4

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.3...v4.1.4

v4.1.3

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.2...v4.1.3

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.2&new-version=4.1.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 588cf061da..920630a953 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [3.2, dev] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From a304f327623b4864a2677128249381e3a053fb28 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 6 May 2024 15:06:13 -0700 Subject: [PATCH 095/107] blast_repo fixes (dart-lang/http_multi_server#68) dependabot --- pkgs/http_multi_server/.github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/http_multi_server/.github/dependabot.yml b/pkgs/http_multi_server/.github/dependabot.yml index 725f03af2e..cde02ad6a8 100644 --- a/pkgs/http_multi_server/.github/dependabot.yml +++ b/pkgs/http_multi_server/.github/dependabot.yml @@ -9,3 +9,7 @@ updates: interval: monthly labels: - autosubmit + groups: + github-actions: + patterns: + - "*" From f5bf636045b1fee96dde1019f654c7b3262a9663 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 22:08:49 +0000 Subject: [PATCH 096/107] Bump actions/checkout from 4.1.4 to 4.1.5 in the github-actions group (dart-lang/http_multi_server#69) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4.1.4 to 4.1.5
Release notes

Sourced from actions/checkout's releases.

v4.1.5

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.4...v4.1.5

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.4&new-version=4.1.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 920630a953..a4dbf1bda2 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [3.2, dev] steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From 74159adfb15a5566d6937f3e9d3a6a2572819d18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jun 2024 22:08:21 +0000 Subject: [PATCH 097/107] Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group (dart-lang/http_multi_server#70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4.1.5 to 4.1.6
Release notes

Sourced from actions/checkout's releases.

v4.1.6

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.5...v4.1.6

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.5&new-version=4.1.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index a4dbf1bda2..b82cea50a1 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [3.2, dev] steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From a41bcb63ab6f8def5815f90062f39ffe7705bfbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 22:37:05 +0000 Subject: [PATCH 098/107] Bump the github-actions group with 2 updates (dart-lang/http_multi_server#71) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart). Updates `actions/checkout` from 4.1.6 to 4.1.7
Release notes

Sourced from actions/checkout's releases.

v4.1.7

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.6...v4.1.7

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.7

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

... (truncated)

Commits

Updates `dart-lang/setup-dart` from 1.6.4 to 1.6.5
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.5

dart-lang/http_multi_server#118: dart-lang/setup-dartdart-lang/http_multi_server#118

Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.5

dart-lang/http_multi_server#118: dart-lang/setup-dartdart-lang/http_multi_server#118

v1.6.4

  • Rebuild JS code.

v1.6.3

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index b82cea50a1..90a5c8e6ce 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,8 +22,8 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} - id: install @@ -49,8 +49,8 @@ jobs: os: [ubuntu-latest] sdk: [3.2, dev] steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} - id: install From e0e499e4a0105066cfa5f78ec0734f2abbab83d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 22:45:07 +0000 Subject: [PATCH 099/107] Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group (dart-lang/http_multi_server#72) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4.1.7 to 4.2.0
Release notes

Sourced from actions/checkout's releases.

v4.2.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.7...v4.2.0

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.2.0

v4.1.7

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.7&new-version=4.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 90a5c8e6ce..9fd5c8a050 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [3.2, dev] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} From 55feb829e1d9792c69ce7cbdeabc7ed3dc7a5f5b Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 28 Oct 2024 19:07:48 -0700 Subject: [PATCH 100/107] blast_repo fixes (dart-lang/http_multi_server#73) drop-lint --- pkgs/http_multi_server/analysis_options.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/http_multi_server/analysis_options.yaml b/pkgs/http_multi_server/analysis_options.yaml index 0154535551..99d2063d7d 100644 --- a/pkgs/http_multi_server/analysis_options.yaml +++ b/pkgs/http_multi_server/analysis_options.yaml @@ -19,7 +19,6 @@ linter: - literal_only_boolean_expressions - no_adjacent_strings_in_list - no_runtimeType_toString - - package_api_docs - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_locals From 21d42ddd1c611058d21c7f51fc55519f324b9e84 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 22:57:12 +0000 Subject: [PATCH 101/107] Bump actions/checkout from 4.2.0 to 4.2.2 in the github-actions group (dart-lang/http_multi_server#74) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4.2.0 to 4.2.2
Release notes

Sourced from actions/checkout's releases.

v4.2.2

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.2.1...v4.2.2

v4.2.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.2.0...v4.2.1

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.2.2

v4.2.1

v4.2.0

v4.1.7

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.2.0&new-version=4.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 9fd5c8a050..3581d21039 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest] sdk: [3.2, dev] steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} From 2b0b56271d1af8aa974122c9dc490d6792cc2667 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 22:31:05 +0000 Subject: [PATCH 102/107] Bump dart-lang/setup-dart in the github-actions group (dart-lang/http_multi_server#75) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 1 update: [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart). Updates `dart-lang/setup-dart` from 1.6.5 to 1.7.0
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.7.0

What's Changed

  • Install a Flutter SDK in the publish workflow allowing for publication of flutter packages.
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.7.0

v1.6.5

dart-lang/http_multi_server#118: dart-lang/setup-dartdart-lang/http_multi_server#118

v1.6.4

  • Rebuild JS code.

v1.6.3

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.5&new-version=1.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/http_multi_server/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/pkgs/http_multi_server/.github/workflows/test-package.yml index 3581d21039..63ffbebf4c 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/pkgs/http_multi_server/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [3.2, dev] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: sdk: ${{ matrix.sdk }} - id: install From ab30c76d85e2a1d94c8f1e7a52642ce5cd3181df Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 6 Dec 2024 12:13:54 +0100 Subject: [PATCH 103/107] Add issue template and other fixes --- .github/ISSUE_TEMPLATE/http_multi_server.md | 5 +++++ pkgs/http_multi_server/pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/http_multi_server.md diff --git a/.github/ISSUE_TEMPLATE/http_multi_server.md b/.github/ISSUE_TEMPLATE/http_multi_server.md new file mode 100644 index 0000000000..10d75c5ef8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/http_multi_server.md @@ -0,0 +1,5 @@ +--- +name: "package:http_multi_server" +about: "Create a bug or file a feature request against package:http_multi_server." +labels: "package:http_multi_server" +--- \ No newline at end of file diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 992ee00476..6a6809140c 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -2,7 +2,7 @@ name: http_multi_server version: 3.2.2-wip description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. -repository: https://github.com/dart-lang/http_multi_server +repository: https://github.com/dart-lang/http/tree/master/pkgs/http_multi_server environment: sdk: ^3.2.0 From c5b5f9c7523db86b7799d20ea828fb5e56b872a8 Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 6 Dec 2024 13:11:08 +0100 Subject: [PATCH 104/107] Moving issues --- .github/labeler.yml | 12 ++++-- .../workflows/http_multi_server.yaml | 17 +++++++-- README.md | 1 + pkgs/http_multi_server/.github/dependabot.yml | 15 -------- .../.github/workflows/no-response.yml | 37 ------------------- .../.github/workflows/publish.yaml | 17 --------- pkgs/http_multi_server/CHANGELOG.md | 3 +- pkgs/http_multi_server/README.md | 2 +- pkgs/http_multi_server/pubspec.yaml | 2 +- 9 files changed, 26 insertions(+), 80 deletions(-) rename pkgs/http_multi_server/.github/workflows/test-package.yml => .github/workflows/http_multi_server.yaml (83%) delete mode 100644 pkgs/http_multi_server/.github/dependabot.yml delete mode 100644 pkgs/http_multi_server/.github/workflows/no-response.yml delete mode 100644 pkgs/http_multi_server/.github/workflows/publish.yaml diff --git a/.github/labeler.yml b/.github/labeler.yml index 3add1c1717..335e94da28 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -20,10 +20,14 @@ - changed-files: - any-glob-to-any-file: 'pkgs/http2/**' -'package:http_parser': - - changed-files: - - any-glob-to-any-file: 'pkgs/http_parser/**' - 'package:http_client_conformance_tests': - changed-files: - any-glob-to-any-file: 'pkgs/http_client_conformance_tests/**' + +'package:http_multi_server': + - changed-files: + - any-glob-to-any-file: 'pkgs/http_multi_server/**' + +'package:http_parser': + - changed-files: + - any-glob-to-any-file: 'pkgs/http_parser/**' diff --git a/pkgs/http_multi_server/.github/workflows/test-package.yml b/.github/workflows/http_multi_server.yaml similarity index 83% rename from pkgs/http_multi_server/.github/workflows/test-package.yml rename to .github/workflows/http_multi_server.yaml index 63ffbebf4c..71f6062ead 100644 --- a/pkgs/http_multi_server/.github/workflows/test-package.yml +++ b/.github/workflows/http_multi_server.yaml @@ -1,14 +1,23 @@ -name: Dart CI +name: package:http_multi_server on: - # Run on PRs and pushes to the default branch. push: - branches: [ master ] + branches: + - master + paths: + - '.github/workflows/http_multi_server.yaml' + - 'pkgs/http_multi_server/**' pull_request: - branches: [ master ] + paths: + - '.github/workflows/http_multi_server.yaml' + - 'pkgs/http_multi_server/**' schedule: - cron: "0 0 * * 0" +defaults: + run: + working-directory: pkgs/http_multi_server/ + env: PUB_ENVIRONMENT: bot.github diff --git a/README.md b/README.md index 31fc6500b1..b106fec74d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ and the browser. | [http](pkgs/http/) | A composable, multi-platform, Future-based API for HTTP requests. | [![pub package](https://img.shields.io/pub/v/http.svg)](https://pub.dev/packages/http) | | [http2](pkgs/http2/) | A HTTP/2 implementation in Dart. | [![pub package](https://img.shields.io/pub/v/http2.svg)](https://pub.dev/packages/http2) | | [http_client_conformance_tests](pkgs/http_client_conformance_tests/) | A library that tests whether implementations of package:http's `Client` class behave as expected. | | +| [http_multi_server](pkgs/http_multi_server/) | A `dart:io` `HttpServer` wrapper that handles requests from multiple servers. | | | [http_parser](pkgs/http_parser/) | A platform-independent package for parsing and serializing HTTP formats. | [![pub package](https://img.shields.io/pub/v/http_parser.svg)](https://pub.dev/packages/http_parser) | | [http_profile](pkgs/http_profile/) | A library used by HTTP client authors to integrate with the DevTools Network View. | [![pub package](https://img.shields.io/pub/v/http_profile.svg)](https://pub.dev/packages/http_profile) | | [ok_http](pkgs/ok_http/) | An Android Flutter plugin that provides access to the [OkHttp](https://square.github.io/okhttp/) HTTP client and the OkHttp [WebSocket](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html) API. | [![pub package](https://img.shields.io/pub/v/ok_http.svg)](https://pub.dev/packages/ok_http) | diff --git a/pkgs/http_multi_server/.github/dependabot.yml b/pkgs/http_multi_server/.github/dependabot.yml deleted file mode 100644 index cde02ad6a8..0000000000 --- a/pkgs/http_multi_server/.github/dependabot.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Dependabot configuration file. -# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates -version: 2 - -updates: - - package-ecosystem: github-actions - directory: / - schedule: - interval: monthly - labels: - - autosubmit - groups: - github-actions: - patterns: - - "*" diff --git a/pkgs/http_multi_server/.github/workflows/no-response.yml b/pkgs/http_multi_server/.github/workflows/no-response.yml deleted file mode 100644 index ab1ac49842..0000000000 --- a/pkgs/http_multi_server/.github/workflows/no-response.yml +++ /dev/null @@ -1,37 +0,0 @@ -# A workflow to close issues where the author hasn't responded to a request for -# more information; see https://github.com/actions/stale. - -name: No Response - -# Run as a daily cron. -on: - schedule: - # Every day at 8am - - cron: '0 8 * * *' - -# All permissions not specified are set to 'none'. -permissions: - issues: write - pull-requests: write - -jobs: - no-response: - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'dart-lang' }} - steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e - with: - # Don't automatically mark inactive issues+PRs as stale. - days-before-stale: -1 - # Close needs-info issues and PRs after 14 days of inactivity. - days-before-close: 14 - stale-issue-label: "needs-info" - close-issue-message: > - Without additional information we're not able to resolve this issue. - Feel free to add more info or respond to any questions above and we - can reopen the case. Thanks for your contribution! - stale-pr-label: "needs-info" - close-pr-message: > - Without additional information we're not able to resolve this PR. - Feel free to add more info or respond to any questions above. - Thanks for your contribution! diff --git a/pkgs/http_multi_server/.github/workflows/publish.yaml b/pkgs/http_multi_server/.github/workflows/publish.yaml deleted file mode 100644 index 27157a046a..0000000000 --- a/pkgs/http_multi_server/.github/workflows/publish.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# A CI configuration to auto-publish pub packages. - -name: Publish - -on: - pull_request: - branches: [ master ] - push: - tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] - -jobs: - publish: - if: ${{ github.repository_owner == 'dart-lang' }} - uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main - permissions: - id-token: write # Required for authentication using OIDC - pull-requests: write # Required for writing the pull request note diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index 4ea18f20dc..2af6d1dc7e 100644 --- a/pkgs/http_multi_server/CHANGELOG.md +++ b/pkgs/http_multi_server/CHANGELOG.md @@ -1,6 +1,7 @@ -## 3.2.2-wip +## 3.2.2 * Require Dart 3.2 +* Move to `dart-lang/http` monorepo. ## 3.2.1 diff --git a/pkgs/http_multi_server/README.md b/pkgs/http_multi_server/README.md index da27074155..7d1d6bff4b 100644 --- a/pkgs/http_multi_server/README.md +++ b/pkgs/http_multi_server/README.md @@ -1,4 +1,4 @@ -[![Dart CI](https://github.com/dart-lang/http_multi_server/actions/workflows/test-package.yml/badge.svg)](https://github.com/dart-lang/http_multi_server/actions/workflows/test-package.yml) +[![Dart CI](https://github.com/dart-lang/http/actions/workflows/http_multi_server.yaml/badge.svg)](https://github.com/dart-lang/http/actions/workflows/http_multi_server.yaml) [![pub package](https://img.shields.io/pub/v/http_multi_server.svg)](https://pub.dev/packages/http_multi_server) [![package publisher](https://img.shields.io/pub/publisher/http_multi_server.svg)](https://pub.dev/packages/http_multi_server/publisher) diff --git a/pkgs/http_multi_server/pubspec.yaml b/pkgs/http_multi_server/pubspec.yaml index 6a6809140c..c359aec851 100644 --- a/pkgs/http_multi_server/pubspec.yaml +++ b/pkgs/http_multi_server/pubspec.yaml @@ -1,5 +1,5 @@ name: http_multi_server -version: 3.2.2-wip +version: 3.2.2 description: >- A dart:io HttpServer wrapper that handles requests from multiple servers. repository: https://github.com/dart-lang/http/tree/master/pkgs/http_multi_server From cc1efef09a10e9fd65741087c0987c320f3702e0 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 6 Dec 2024 09:33:33 -0800 Subject: [PATCH 105/107] Update labeler.yml --- .github/labeler.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 335e94da28..1ab6973fd8 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -2,32 +2,32 @@ 'type-infra': - changed-files: - - any-glob-to-any-file: '.github/**' + - any-glob-to-any-file: '.github/**' 'package:cronet_http': - changed-files: - - any-glob-to-any-file: 'pkgs/cronet_http/**' + - any-glob-to-any-file: 'pkgs/cronet_http/**' 'package:cupertino_http': - changed-files: - - any-glob-to-any-file: 'pkgs/cupertino_http/**' + - any-glob-to-any-file: 'pkgs/cupertino_http/**' 'package:http': - changed-files: - - any-glob-to-any-file: 'pkgs/http/**' + - any-glob-to-any-file: 'pkgs/http/**' 'package:http2': - changed-files: - - any-glob-to-any-file: 'pkgs/http2/**' + - any-glob-to-any-file: 'pkgs/http2/**' 'package:http_client_conformance_tests': - changed-files: - - any-glob-to-any-file: 'pkgs/http_client_conformance_tests/**' + - any-glob-to-any-file: 'pkgs/http_client_conformance_tests/**' 'package:http_multi_server': - changed-files: - - any-glob-to-any-file: 'pkgs/http_multi_server/**' + - any-glob-to-any-file: 'pkgs/http_multi_server/**' 'package:http_parser': - changed-files: - - any-glob-to-any-file: 'pkgs/http_parser/**' + - any-glob-to-any-file: 'pkgs/http_parser/**' From 19386a72bdcf1660df2b48b2406cce86c938dbb0 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 9 Dec 2024 14:16:25 +0100 Subject: [PATCH 106/107] Update README.md Co-authored-by: Devon Carew --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b106fec74d..fac1ade842 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ and the browser. | [http](pkgs/http/) | A composable, multi-platform, Future-based API for HTTP requests. | [![pub package](https://img.shields.io/pub/v/http.svg)](https://pub.dev/packages/http) | | [http2](pkgs/http2/) | A HTTP/2 implementation in Dart. | [![pub package](https://img.shields.io/pub/v/http2.svg)](https://pub.dev/packages/http2) | | [http_client_conformance_tests](pkgs/http_client_conformance_tests/) | A library that tests whether implementations of package:http's `Client` class behave as expected. | | -| [http_multi_server](pkgs/http_multi_server/) | A `dart:io` `HttpServer` wrapper that handles requests from multiple servers. | | +| [http_multi_server](pkgs/http_multi_server/) | A `dart:io` `HttpServer` wrapper that handles requests from multiple servers. | [![pub package](https://img.shields.io/pub/v/http_multi_server.svg)](https://pub.dev/packages/http_multi_server) | | [http_parser](pkgs/http_parser/) | A platform-independent package for parsing and serializing HTTP formats. | [![pub package](https://img.shields.io/pub/v/http_parser.svg)](https://pub.dev/packages/http_parser) | | [http_profile](pkgs/http_profile/) | A library used by HTTP client authors to integrate with the DevTools Network View. | [![pub package](https://img.shields.io/pub/v/http_profile.svg)](https://pub.dev/packages/http_profile) | | [ok_http](pkgs/ok_http/) | An Android Flutter plugin that provides access to the [OkHttp](https://square.github.io/okhttp/) HTTP client and the OkHttp [WebSocket](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html) API. | [![pub package](https://img.shields.io/pub/v/ok_http.svg)](https://pub.dev/packages/ok_http) | From b6a4eebfe0547bd4f2bd4ef6717dbeab16ef3d19 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 9 Dec 2024 14:22:53 +0100 Subject: [PATCH 107/107] Add license to example --- pkgs/http_multi_server/example/main.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/http_multi_server/example/main.dart b/pkgs/http_multi_server/example/main.dart index 661b52e0c1..6e90c8b890 100644 --- a/pkgs/http_multi_server/example/main.dart +++ b/pkgs/http_multi_server/example/main.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + import 'package:http_multi_server/http_multi_server.dart'; import 'package:shelf/shelf.dart' as shelf; import 'package:shelf/shelf_io.dart' as shelf_io;