Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
35ed1ccc
Unverified
Commit
35ed1ccc
authored
Apr 11, 2020
by
Mehmet Fidanboylu
Committed by
GitHub
Apr 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Add API to services package that overrides HTTP ban (#54243)" (#54519)
This reverts commit
9eb2a2ad
.
parent
39b9eb19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
66 deletions
+0
-66
services.dart
packages/flutter/lib/services.dart
+0
-1
platform_network.dart
packages/flutter/lib/src/services/platform_network.dart
+0
-27
platform_network_test.dart
packages/flutter/test/services/platform_network_test.dart
+0
-38
No files found.
packages/flutter/lib/services.dart
View file @
35ed1ccc
...
...
@@ -22,7 +22,6 @@ export 'src/services/message_codec.dart';
export
'src/services/message_codecs.dart'
;
export
'src/services/platform_channel.dart'
;
export
'src/services/platform_messages.dart'
;
export
'src/services/platform_network.dart'
;
export
'src/services/platform_views.dart'
;
export
'src/services/raw_keyboard.dart'
;
export
'src/services/raw_keyboard_android.dart'
;
...
...
packages/flutter/lib/src/services/platform_network.dart
deleted
100644 → 0
View file @
39b9eb19
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
/// Allows an operation executed via [action] to access insecure HTTP URLs.
///
/// On some platforms (notably iOS and Android), HTTP is disallowed by default.
/// You should strive to access secure URLs from your app, but we recognize that
/// sometimes that is not possible. In such cases, use the function below to
/// allow access to HTTP URLs.
///
/// Sample usage:
///
/// ```dart
/// import 'package:flutter/services.dart' as services;
///
/// final Image image = services.allowHttp(() => Image.network('http://some_insecure_url');
/// ```
///
/// Best Practices:
/// - Do not wrap your entire app with [allowHttp]. Wrap *exactly* what you need and nothing more.
/// - Avoid libraries that require accessing HTTP URLs.
T
allowHttp
<
T
>(
T
action
())
{
return
runZoned
<
T
>(
action
,
zoneValues:
<
Symbol
,
bool
>{
#dart
.
library
.
io
.
allow_http
:
true
});
}
packages/flutter/test/services/platform_network_test.dart
deleted
100644 → 0
View file @
39b9eb19
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
const
Symbol
_symbol
=
#dart
.
library
.
io
.
allow_http
;
test
(
'AllowHTTP sets the correct zone variable'
,
()
async
{
expect
(
Zone
.
current
[
_symbol
],
isNull
);
allowHttp
(()
{
expect
(
Zone
.
current
[
_symbol
],
isTrue
);
});
});
// This test ensures the zone variable used in Dart SDK does not change.
//
// If this symbol changes, then update [allowHttp] function as well.
test
(
'Zone variable can override HTTP behavior'
,
()
async
{
final
HttpClient
httpClient
=
HttpClient
();
try
{
await
runZoned
(
()
async
=>
await
httpClient
.
getUrl
(
Uri
.
parse
(
'http://
${Platform.localHostname}
'
)),
zoneValues:
<
Symbol
,
bool
>{
_symbol:
false
},
);
fail
(
'This should have thrown a StateError. '
'Check if the symbol for setting allow_http behavior has changed'
);
}
on
StateError
catch
(
e
)
{
expect
(
e
.
message
,
contains
(
'Insecure HTTP is not allowed by the current platform'
));
}
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment