Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c7ef259

Browse files
authored
Revert "Provide better messaging when user attempts to use non-secure http connection. (#26226)" (#26371)
This reverts commit d46b5b3 because it breaks g3 Fuchsia tests since g3 fuchsia doesn't have updated dart sdk.
1 parent fc4c7d7 commit c7ef259

File tree

6 files changed

+0
-176
lines changed

6 files changed

+0
-176
lines changed

lib/io/dart_io.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,6 @@ void DartIO::InitForIsolate(bool may_insecurely_connect_to_all_domains,
3636
Dart_Handle set_domain_network_policy_result = Dart_Invoke(
3737
embedder_config_type, ToDart("_setDomainPolicies"), 1, dart_args);
3838
FML_CHECK(!LogIfError(set_domain_network_policy_result));
39-
40-
Dart_Handle ui_lib = Dart_LookupLibrary(ToDart("dart:ui"));
41-
Dart_Handle dart_validate_args[1];
42-
dart_validate_args[0] = ToDart(may_insecurely_connect_to_all_domains);
43-
Dart_Handle http_connection_hook_closure =
44-
Dart_Invoke(ui_lib, ToDart("_getHttpConnectionHookClosure"),
45-
/*number_of_arguments=*/1, dart_validate_args);
46-
FML_CHECK(!LogIfError(http_connection_hook_closure));
47-
Dart_Handle http_lib = Dart_LookupLibrary(ToDart("dart:_http"));
48-
FML_CHECK(!LogIfError(http_lib));
49-
Dart_Handle set_http_connection_hook_result = Dart_SetField(
50-
http_lib, ToDart("_httpConnectionHook"), http_connection_hook_closure);
51-
FML_CHECK(!LogIfError(set_http_connection_hook_result));
5239
}
5340

5441
} // namespace flutter

lib/ui/hooks.dart

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -224,44 +224,3 @@ void _invoke3<A1, A2, A3>(void Function(A1 a1, A2 a2, A3 a3)? callback, Zone zon
224224
});
225225
}
226226
}
227-
228-
bool _isLoopback(String host) {
229-
if (host.isEmpty) {
230-
return false;
231-
}
232-
if ('localhost' == host) {
233-
return true;
234-
}
235-
try {
236-
return InternetAddress(host).isLoopback;
237-
} on ArgumentError {
238-
return false;
239-
}
240-
}
241-
242-
/// Loopback connections are always allowed.
243-
/// Zone override with 'flutter.io.allow_http' takes first priority.
244-
/// If zone override is not provided, engine setting is checked.
245-
@pragma('vm:entry-point')
246-
// ignore: unused_element
247-
void Function(Uri) _getHttpConnectionHookClosure(bool mayInsecurelyConnectToAllDomains) {
248-
return (Uri uri) {
249-
if (_isLoopback(uri.host)) {
250-
return;
251-
}
252-
final dynamic zoneOverride = Zone.current[#flutter.io.allow_http];
253-
if (zoneOverride == true) {
254-
return;
255-
}
256-
if (zoneOverride == false && uri.isScheme('http')) {
257-
// Going to throw
258-
} else if (mayInsecurelyConnectToAllDomains || uri.isScheme('https')) {
259-
// In absence of zone override, if engine setting allows the connection
260-
// or if connection is to `https`, allow the connection.
261-
return;
262-
}
263-
throw UnsupportedError(
264-
'Non-https connection "$uri" is not supported by the platform. '
265-
'Refer to https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android.');
266-
};
267-
}

testing/dart/http_allow_http_connections_test.dart

Lines changed: 0 additions & 30 deletions
This file was deleted.

testing/dart/http_disallow_http_connections_test.dart

Lines changed: 0 additions & 86 deletions
This file was deleted.

testing/dart/window_hooks_integration_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import 'dart:collection' as collection;
1313
import 'dart:convert';
1414
import 'dart:developer' as developer;
1515
import 'dart:math' as math;
16-
import 'dart:io' show InternetAddress;
1716
import 'dart:nativewrappers';
1817
import 'dart:typed_data';
1918

testing/run_tests.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,6 @@ def RunDartTest(build_dir, test_packages, dart_file, verbose_dart_snapshot, mult
259259
if not enable_observatory:
260260
command_args.append('--disable-observatory')
261261

262-
dart_file_contents = open(dart_file, 'r')
263-
custom_options = re.findall("// FlutterTesterOptions=(.*)", dart_file_contents.read())
264-
dart_file_contents.close()
265-
command_args.extend(custom_options)
266-
267262
command_args += [
268263
'--use-test-fonts',
269264
kernel_file_output

0 commit comments

Comments
 (0)