Skip to content

Draft PR for introducing a way to ban http #40549

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

Closed
wants to merge 2 commits into from

Conversation

mehmetf
Copy link
Contributor

@mehmetf mehmetf commented Feb 8, 2020

See proposal: #40548

Tests and documentation is missing as it is a POC.

@mehmetf mehmetf requested a review from zanderso February 9, 2020 00:36
@@ -2285,6 +2288,11 @@ class _HttpClient implements HttpClient {
}

bool isSecure = (uri.scheme == "https");
bool isMobileClient = Platform.isAndroid || Platform.isIOS;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove the restriction that the flag only works on mobile platforms, then I suspect it will be easier to write tests. A regular Dart program could just install an HttpOverrides in a zone with the flag flipped, and check that the right exception is thrown.

Copy link
Contributor Author

@mehmetf mehmetf Feb 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two reasons for including a mobile client distinction:

  • We intend to flip the default in google3 but only for mobile. The default should be allow for non-mobile applications even in google3. Perhaps, this can be solved by having defaults per Platform.
  • It reflects the principle of the change more accurately. On iOS and Android, we should not be asking the apps to install an Override to get this behavior. Both OSes ban cleartext HTTP by default for their native apps.

I introduced platform specific defaults to capture both points and removed the isMobileClient check.

@@ -2151,6 +2152,13 @@ class _HttpClient implements HttpClient {

_HttpClient(this._context);

static bool get _isHttpAllowedByDefault {
if (Platform.isIOS) return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe opposite value, i.e. false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a breaking change upstream.

I would be happy to do it but @mit-mit needs to agree.

@mehmetf
Copy link
Contributor Author

mehmetf commented Mar 5, 2020

This requires a rewrite. Closing.

@mehmetf mehmetf closed this Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants