Skip to content

Use HTTP Multi Server for DevTools #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions webdev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.5

- Use `HttpMultiServer` to fix bind issues with IPv6 / IPv4.

## 2.0.4

- Fix loading apps in non-chrome browsers in --debug mode
Expand Down
8 changes: 5 additions & 3 deletions webdev/lib/src/serve/debugger/devtools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import 'dart:async';
import 'dart:io';
import 'dart:isolate';

import 'package:http_multi_server/http_multi_server.dart';
import 'package:path/path.dart' as p;
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart';
import 'package:shelf_static/shelf_static.dart';

import '../utils.dart';

/// A server for Dart Devtools.
class DevTools {
final String hostname;
Expand Down Expand Up @@ -50,7 +49,10 @@ class DevTools {
: buildHandler(request);
};

var server = await serve(handler, hostname, await findUnusedPort());
var server = hostname == 'localhost'
? await HttpMultiServer.loopback(0)
: await HttpServer.bind(hostname, 0);
serveRequests(server, handler);

return DevTools._(server.address.host, server.port, server);
}
Expand Down
2 changes: 1 addition & 1 deletion webdev/lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion webdev/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: webdev
version: 2.0.4
version: 2.0.5
author: Dart Team <[email protected]>
homepage: https://github.com/dart-lang/webdev
description: >-
Expand All @@ -18,6 +18,7 @@ dependencies:
dwds: ^0.3.0
devtools: ^0.0.15-dev.1
http: ^0.12.0
http_multi_server: ^2.0.0
io: ^0.3.2+1
logging: ^0.11.0
pedantic: ^1.5.0
Expand Down