From 44d9483a4623bc56bfe9490c7360f09834a19388 Mon Sep 17 00:00:00 2001 From: "ajohnsen@google.com" <ajohnsen@google.com> Date: Wed, 1 May 2013 14:41:45 +0000 Subject: [PATCH] Update pub usage of '127.0.0.1'. BUG= Review URL: https://codereview.chromium.org//14701007 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@22251 260f80e4-7a28-3924-810f-c04153c831b5 --- lib/src/oauth2.dart | 2 +- lib/src/safe_http_server.dart | 2 +- test/test_pub.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/oauth2.dart b/lib/src/oauth2.dart index e4b8ee07..56b14949 100644 --- a/lib/src/oauth2.dart +++ b/lib/src/oauth2.dart @@ -169,7 +169,7 @@ Future<Client> _authorize() { // Spin up a one-shot HTTP server to receive the authorization code from the // Google OAuth2 server via redirect. This server will close itself as soon as // the code is received. - return SafeHttpServer.bind('127.0.0.1', 0).then((server) { + return SafeHttpServer.bind('localhost', 0).then((server) { var authUrl = grant.getAuthorizationUrl( Uri.parse('http://localhost:${server.port}'), scopes: _scopes); diff --git a/lib/src/safe_http_server.dart b/lib/src/safe_http_server.dart index 2c193681..25d57ee6 100644 --- a/lib/src/safe_http_server.dart +++ b/lib/src/safe_http_server.dart @@ -21,7 +21,7 @@ import 'dart:uri'; class SafeHttpServer extends StreamView<HttpRequest> implements HttpServer { final HttpServer _inner; - static Future<SafeHttpServer> bind([String host = "127.0.0.1", + static Future<SafeHttpServer> bind([String host = "localhost", int port = 0, int backlog = 0]) { return HttpServer.bind(host, port, backlog: backlog) .then((server) => new SafeHttpServer(server)); diff --git a/test/test_pub.dart b/test/test_pub.dart index dbc326c3..a175c7b8 100644 --- a/test/test_pub.dart +++ b/test/test_pub.dart @@ -96,7 +96,7 @@ void serve([List<d.Descriptor> contents]) { schedule(() { return _closeServer().then((_) { - return SafeHttpServer.bind("127.0.0.1", 0).then((server) { + return SafeHttpServer.bind("localhost", 0).then((server) { _server = server; server.listen((request) { var response = request.response; -- GitLab