Unverified Commit 014a2255 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Nicer error message for TLS errors (#14285)

Also some trivial improvements to style.
parent 671c1101
......@@ -42,6 +42,7 @@ export 'dart:io'
// File NO! Use `file_system.dart`
// FileSystemEntity NO! Use `file_system.dart`
GZIP,
HandshakeException,
HttpClient,
HttpClientRequest,
HttpClientResponse,
......
......@@ -37,7 +37,18 @@ Future<List<int>> _attempt(Uri url) async {
} else {
httpClient = new HttpClient();
}
final HttpClientRequest request = await httpClient.getUrl(url);
HttpClientRequest request;
try {
request = await httpClient.getUrl(url);
} on HandshakeException catch (error) {
printTrace(error.toString());
throwToolExit(
'Could not authenticate download server. You may be experiencing a man-in-the-middle attack,\n'
'your network may be compromised, or you may have malware installed on your computer.\n'
'URL: $url',
exitCode: kNetworkProblemExitCode,
);
}
final HttpClientResponse response = await request.close();
if (response.statusCode != 200) {
if (response.statusCode > 0 && response.statusCode < 500) {
......
......@@ -199,10 +199,13 @@ class _FlutterValidator extends DoctorValidator {
final FlutterVersion version = FlutterVersion.instance;
messages.add(new ValidationMessage('Flutter version ${version.frameworkVersion} at ${Cache.flutterRoot}'));
if (Cache.flutterRoot.contains(' '))
if (Cache.flutterRoot.contains(' ')) {
messages.add(new ValidationMessage.error(
'Flutter SDK install paths with spaces are not yet supported. (https://github.com/flutter/flutter/issues/6577)\n'
'Please move the SDK to a path that does not include spaces.'));
'Flutter SDK install paths with spaces are not yet supported. '
'(https://github.com/flutter/flutter/issues/6577)\n'
'Please move the SDK to a path that does not include spaces.'
));
}
messages.add(new ValidationMessage(
'Framework revision ${version.frameworkRevisionShort} '
'(${version.frameworkAge}), ${version.frameworkDate}'
......@@ -215,13 +218,16 @@ class _FlutterValidator extends DoctorValidator {
// Check that the binaries we downloaded for this platform actually run on it.
if (!_genSnapshotRuns(genSnapshotPath)) {
messages.add(new ValidationMessage.error('Downloaded executables cannot execute '
'on host (see https://github.com/flutter/flutter/issues/6207 for more information)'));
messages.add(new ValidationMessage.error(
'Downloaded executables cannot execute '
'on host (see https://github.com/flutter/flutter/issues/6207 for more information)'
));
valid = ValidationType.partial;
}
return new ValidationResult(valid, messages,
statusInfo: 'on ${os.name}, locale ${platform.localeName}, channel ${version.channel}');
statusInfo: 'on ${os.name}, locale ${platform.localeName}, channel ${version.channel}'
);
}
}
......
......@@ -78,7 +78,7 @@ Future<String> getServiceFromUrl(String url, String rootDir, String serviceName)
if (url.startsWith('android-sdk:') && androidSdk != null) {
// It's something shipped in the standard android SDK.
return url.replaceAll('android-sdk:', '${androidSdk.directory}/');
} else if (url.startsWith('http')) {
} else if (url.startsWith('http:') || url.startsWith('https:')) {
// It's a regular file to download.
return await cache.getThirdPartyFile(url, serviceName);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment