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 .
diff --git a/pkgs/http_multi_server/CHANGELOG.md b/pkgs/http_multi_server/CHANGELOG.md index df1b863..1db0a15 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 abad76e..12b6e40 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 @@ /// 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<HttpServer> loopback(int port, {int backlog}) { + /// See [HttpServer.bind]. + static Future<HttpServer> 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<HttpServer> loopbackSecure(int port, {int backlog, - String certificateName, bool requestClientCertificate: false}) { + /// See [HttpServer.bindSecure]. + static Future<HttpServer> 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 e6f9a97..44daa8f 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 <misc@dartlang.org>" homepage: http://github.com/dart-lang/http_multi_server description: @@ -8,4 +8,4 @@ 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"