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

CERTIFICATE_VERIFY_FAILED: self signed certificate in certificate chain(handshake.cc:354)) #155

Closed
qzcsfchh opened this issue Mar 27, 2020 · 1 comment

Comments

@qzcsfchh
Copy link

I got this problem when loading image with urls of 'https' scheme, and I've tried 'HttpOverrides' but it does'nt work, my code was like:

  HttpOverrides.runZoned(() async {
    runApp(MyApp());
  },createHttpClient: UnSafeHttpClient);

HttpClient UnSafeHttpClient(SecurityContext ctx) {
  HttpClient client = HttpClient();
  client.badCertificateCallback = (cert, host, port) => true;
  return client;
}

What can I do to solve this pronlem?

@renefloor
Copy link
Collaborator

Haven't tried it, but maybe this works?
flutter/flutter#19588 (comment)

If that doesn't work you can also supply your own FileFetcher to the CacheManager. The default one is just this:

      {Map<String, String> headers}) async {
    var httpResponse = await http.get(url, headers: headers);
    return new HttpFileFetcherResponse(httpResponse);
  }```
You can easily copy/paste the DefaultCacheManager code and add some logic for this.

Note that the API for the FIleFetcher will completely change in the next major release. See the development branch of the current state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants