Skip to content
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

Update image_list example to use https instead of http #39124

Merged
merged 6 commits into from
Sep 25, 2019

Conversation

aam
Copy link
Member

@aam aam commented Aug 23, 2019

Updated image_list test to use locally set up https server to validate performance of image loading over https(rather than http) protocol. Https requires more back-and-forward communication before image bytes are sent to the client, shows clear signs of throughput affected by how busy flutter UI isolate is.

Update image_list test to use locally set up https server to validate performance of image loading over https(rather than http) protocol. Https requires more back-and-forward communication before image bytes are sent to the client, shows clear signs of throughput affected by how busy flutter UI isolate is.
@fluttergithubbot fluttergithubbot added d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. labels Aug 23, 2019
@fluttergithubbot
Copy link
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@aam aam added the a: images Loading, displaying, rendering images label Aug 23, 2019
@goderbauer
Copy link
Member

  • Why are we doing this? Is there an issue asking for this that can be linked from the PR description?
  • Should the NetworkImage take a SecurityContext instead of just a certificate?
  • How does this impact flutter for web? (cc @jonahwilliams @yjbanov)

@goderbauer
Copy link
Member

@@ -19,7 +19,7 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm
/// Creates an object that fetches the image at the given URL.
///
/// The arguments [url] and [scale] must not be null.
const NetworkImage(this.url, { this.scale = 1.0, this.headers })
const NetworkImage(this.url, { this.scale = 1.0, this.headers, this.certificate })
Copy link
Member

Choose a reason for hiding this comment

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

This is unfortunately yet another constructor parameter that is not web portable

@aam
Copy link
Member Author

aam commented Aug 28, 2019

  • Why are we doing this? Is there an issue asking for this that can be linked from the PR description?

Immediate need here is for image_list example to spin up local https(rather than http) server.
Interaction between client and server in the context of https(rather than http) session is significantly affected by how busy the client's event loop is. So https-based image_list better demonstrates "real world" impact of #34188

  • Should the NetworkImage take a SecurityContext instead of just a certificate?

Since this parameter needs to be sent to image loading isolate it can't be native-wrapper class, which SecurityContext is.

@aam
Copy link
Member Author

aam commented Aug 28, 2019

I think for the purposes of this test we can, I will give it a try.
But I am not sure why we would allow specifying headers with image network request, for example, but not certificate.

@jonahwilliams
Copy link
Member

Should the NetworkImage take a SecurityContext instead of just a certificate?

Definitely not, because it will constrain our ability to remove dart:io code for the web, where it isn't supported.

@aam
Copy link
Member Author

aam commented Aug 29, 2019

I think for the purposes of this test we can, I will give it a try.
But I am not sure why we would allow specifying headers with image network request, for example, but not certificate.

Thanks for the suggestion @goderbauer . Created #39525 which uses HttpOverrides.global as alternative to this.

@goderbauer
Copy link
Member

Can we close this PR in favor of #39525?

@aam
Copy link
Member Author

aam commented Aug 30, 2019

I think for the purposes of this test we can, I will give it a try.
But I am not sure why we would allow specifying headers with image network request, for example, but not certificate.

Thanks for the suggestion @goderbauer . Created #39525 which uses HttpOverrides.global as alternative to this.

Can we close this PR in favor of #39525?

Sorry, I should have been more careful with checking HttpOverrides behavior in presence of multiple isolates - long story short it doesn't work across isolates. :-( So even if it works for same-isolate image loading, it won't work with #39124 .

@goderbauer
Copy link
Member

Since the image isolate PR got rolled back: Is this PR still relevant for the time being? Seems like we can currently achieve the same with HttpOverrides? Should we close it for now and revisit once we have decided what to do with loading images in a separate isolate?

@aam aam changed the title Allow passing certificate to Image.network() for https requests. Update image_list example to use https instead of http Sep 25, 2019
@aam
Copy link
Member Author

aam commented Sep 25, 2019

Since the image isolate PR got rolled back: Is this PR still relevant for the time being? Seems like we can currently achieve the same with HttpOverrides? Should we close it for now and revisit once we have decided what to do with loading images in a separate isolate?

Good point, I changed this PR so it is only about updating image_list example to use https instead of http.

@override
HttpClient createHttpClient(SecurityContext context) {
return super.createHttpClient(
SecurityContext()..setTrustedCertificatesBytes(certificate.codeUnits)
Copy link
Member

Choose a reason for hiding this comment

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

Wondering: Should this modify the context that gets passed in instead of creating a new one?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@aam aam merged commit 4f3199f into flutter:master Sep 25, 2019
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Sep 30, 2019
* Update image_list test to use locally set up https server to validate performance of image loading over https(rather than http) protocol. Https requires more back-and-forward communication before image bytes are sent to the client, shows clear signs of throughput affected by how busy flutter UI isolate is.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: images Loading, displaying, rendering images d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants