diff --git a/packages/flutter_tools/lib/src/http_host_validator.dart b/packages/flutter_tools/lib/src/http_host_validator.dart index 8c369d31b095a..6dc832e8f4453 100644 --- a/packages/flutter_tools/lib/src/http_host_validator.dart +++ b/packages/flutter_tools/lib/src/http_host_validator.dart @@ -72,6 +72,8 @@ class HttpHostValidator extends DoctorValidator { return _HostValidationResult.fail(host, 'An error occurred while checking the HTTP host: ${e.message}'); } on HttpException catch (e) { return _HostValidationResult.fail(host, 'An error occurred while checking the HTTP host: ${e.message}'); + } on HandshakeException catch (e) { + return _HostValidationResult.fail(host, 'An error occurred while checking the HTTP host: ${e.message}'); } on OSError catch (e) { return _HostValidationResult.fail(host, 'An error occurred while checking the HTTP host: ${e.message}'); } on FormatException catch (e) { diff --git a/packages/flutter_tools/test/commands.shard/hermetic/http_host_validator_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/http_host_validator_test.dart index 2500fe1e8b86c..1fe6763197fd9 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/http_host_validator_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/http_host_validator_test.dart @@ -302,6 +302,40 @@ void main() { }); }); + testWithoutContext('Does not throw on HandshakeException', () async { + const String handshakeMessage = ''' +Handshake error in client (OS Error: + BLOCK_TYPE_IS_NOT_01(../../third_party/boringssl/src/crypto/fipsmodule/rsa/padding.c:108) + PADDING_CHECK_FAILED(../../third_party/boringssl/src/crypto/fipsmodule/rsa/rsa_impl.c:676) + public key routines(../../third_party/boringssl/src/crypto/x509/a_verify.c:108) + CERTIFICATE_VERIFY_FAILED: certificate signature failure(../../third_party/boringssl/src/ssl/handshake.cc:393)) +'''; + final HttpHostValidator httpHostValidator = HttpHostValidator( + platform: FakePlatform(environment: kTestEnvironment), + featureFlags: TestFeatureFlags(isAndroidEnabled: false), + httpClient: FakeHttpClient.list([ + FakeRequest( + Uri.parse(kTestEnvPubHost), + method: HttpMethod.head, + responseError: const HandshakeException(handshakeMessage), + ), + FakeRequest(Uri.parse(kTestEnvGCloudHost), method: HttpMethod.head), + ]), + ); + + // Run the validation check and get the results + final ValidationResult result = await httpHostValidator.validate(); + + expect( + result.messages.first, + isA().having( + (ValidationMessage msg) => msg.message, + 'message', + contains(handshakeMessage), + ), + ); + }); + testWithoutContext('Http host validator timeout message includes timeout duration.', () async { final HttpHostValidator httpHostValidator = HttpHostValidator( platform: FakePlatform(environment: kTestEnvironment),