Dio: ios13.3.1请求某些证书的https证书时会出现整个app卡死现象

Created on 15 Mar 2020  ·  49Comments  ·  Source: flutterchina/dio

New Issue Checklist

  • [x] I have searched for a similar issue in the project and found none

Issue Info

| Info | Value | |
| ------------------------------ | ----------------------------------------------------- | ---- |
| Platform Name | ios | |
| Platform Version | 13.3.1 | |
| Dio Version | 3.0.9 | |
| Android Studio / Xcode Version | Xcode 10.2.1 | |
| Repro rate | sometimes | |
| Repro with our demo prj | e.g. does it happen with our demo project? | |
| Demo project link | e.g. link to a demo project that highlights the issue | |

Issue Description and Steps

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.

ios13.3.1请求某些ssl证书(如过期证书)的https时会出现整个app卡死现象,貌似用Flutter自带的http也会出现,
能不能弄个原生的选项,看dart的不怎么稳定啊。。。

stale

Most helpful comment

letsencrypt的ocsp server使用akamai cdn,但是akamai部分域名被DNS污染了。Android不会自己请求ocsp server 但是 iOS会。解决方案是自己设置一个ocsp proxy

详细原因和调查我写在这里了: https://jhuo.ca/post/ocsp-stapling-letsencrypt/

All 49 comments

same, any resolve?

用的Let's Encript证书,到期续签后IOS上卡死,折腾两天找不到问题,阿里云新申请了一个证书解决。

用的Let's Encript证书,到期续签后IOS上卡死,折腾两天找不到问题,阿里云新申请了一个证书解决。

主要服务器不是我的,只能解决客户端了,问题非常严重,却没人解决~

同遇到这问题, 一直找不出原因, 排查了好久才定位到 dio 上。 也是用的Let's Encript证书, 不知有没有关系。 模拟器上无卡顿现象, 但在真机上存在, IOS 系统。

大概不被ios信任的证书都会出现这种情况,有时卡有时又不卡,烦死了,大坑!

@youyi-sizuru @Lloyd666 @lalawila 我不是太会用英文描述这个bug,希望你们有能力的去flutter的git那里提issue,我觉得dio是解决不了这底层bug的了~

我的网站是Let's Encript证书, 在 IOS 上不管是 safari 还是微信 qq 内置的浏览器打开都会先卡个十秒钟。 换了个证书就好了。 所以我感觉是 IOS 系统的问题。

我的也是,换了证书解决了,flutter网络请求都会卡死

同样的问题,测试HTTPClient也是一样,
这个问题不解决,app直接废掉了。
断点时卡在
/dart:io/secure_socket.dart
_readSocket()
_secureHandshake()

相关问题:
https://github.com/dart-lang/sdk/issues/41519
https://github.com/flutter/flutter/issues/49392

不支持http2 我使用dio_http2_adapter解决了

不支持http2 我使用dio_http2_adapter解决了

HTTP/2 error: Stream error: Stream was terminated by peer (errorCode: 1).

怎样解决?

上周跟换了dio_http2_adapter手机测试结果确实不卡,不过还是反馈卡顿,难搞

上周跟换了dio_http2_adapter手机测试结果确实不卡,不过还是反馈卡顿,难搞

我们换了证书解决了,之前用的Let's Encript签发的HTTPS的证书,后来换了阿里云的,就没事儿了

上周跟换了dio_http2_adapter手机测试结果确实不卡,不过还是反馈卡顿,难搞

我们换了证书解决了,之前用的Let's Encript签发的HTTPS的证书,后来换了阿里云的,就没事儿了

请问大佬,数字证书分为OV、DV、EV三种,你们换的数字证书是哪一种?

遇到了 一样的 问题 有解决方案吗

更换证书能彻底解决吗 需要跟换什么类型的 证书 更换了 证书 之后 过几天 或者本地证书过期了 这个问题 还会重现吗

上周跟换了dio_http2_adapter手机测试结果确实不卡,不过还是反馈卡顿,难搞

我们换了证书解决了,之前用的Let's Encript签发的HTTPS的证书,后来换了阿里云的,就没事儿了

请问大佬,数字证书分为OV、DV、EV三种,你们换的数字证书是哪一种?

阿里云证书服务
我们用的:通配符 - DV SSL - 基础版 - GeoTrust

简单 暴力的 方法可以 在 dio
//忽略证书 fix ios 卡顿问题
(_dio.httpClientAdapter as DefaultHttpClientAdapter)
.onHttpClientCreate = (client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) {
return true;
};

// client.findProxy = (uri) {
// // Change the local area network ip and port to yourself's
// return "PROXY 192.168.0.103:8000";
// };

  };

简单 暴力的 方法可以 在 dio
//忽略证书 fix ios 卡顿问题
(_dio.httpClientAdapter as DefaultHttpClientAdapter)
.onHttpClientCreate = (client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) {
return true;
};

// client.findProxy = (uri) {
// // Change the local area network ip and port to yourself's
// return "PROXY 192.168.0.103:8000";
// };

  };

完全没用的

我们后台服务更换证书解决,这问题真。。。

简单 暴力的 方法可以 在 dio
//忽略证书 fix ios 卡顿问题
(_dio.httpClientAdapter as DefaultHttpClientAdapter)
.onHttpClientCreate = (client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) {
return true;
};
// client.findProxy = (uri) {
// // Change the local area network ip and port to yourself's
// return "PROXY 192.168.0.103:8000";
// };

  };

完全没用的

没用+1,早就试过了,最终还是换证书解决的,或者把https换成http,只要你服务器支持的话。

用阿里云 证书 这个 东西 是和 国内的网络环境 有关 吗

目前已知是Let's Encript的证书会有问题,原因在 https://github.com/dart-lang/sdk/issues/41519 有讨论。和证书服务商的OCSP有关,也和flutter 在iOS下的ssl处理有关。

花了好长时间才 发现是证书问题,解决完了才发现这里有人讨论,可怜我的头发0.0

开代理, 发现tls 时间占了请求的95%时间, 然后切换到http请求好了, 确认是https 证书问题。这个是不是因为let‘s encript是google 的, 然后根证书在Android里面有是不是就没问题了, iOS 要验证证书,所以卡死了

letsencrypt的ocsp server使用akamai cdn,但是akamai部分域名被DNS污染了。Android不会自己请求ocsp server 但是 iOS会。解决方案是自己设置一个ocsp proxy

详细原因和调查我写在这里了: https://jhuo.ca/post/ocsp-stapling-letsencrypt/

天啊,我也是排查了两天,最后才排查出问题出在https身上,那么多同道中人啊。

        client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;  忽略证书可以不卡,不知道苹果审核可以不可以

(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
// client.findProxy = (url) {
// ///设置代理 电脑ip地址
// return "PROXY 172.16.1.111:8888";
// };
///忽略证书
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
};

I try to solve this issue for some days. Gods save me when I find this

        client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;  忽略证书可以不卡,不知道苹果审核可以不可以

没用的,一点用都没有!

已解决。未解决的可以联系我

已解决。未解决的可以联系我

直接发出来啊

@ghostgzt 已经发了个新的issue了。有详细解释

这个问题我搞了一周,才发现是证书问题,坑死我了

不支持Let's Encrypt真实坑啊。

解决了 换了证书就解决了

我为什么没早点看到这个 issue...

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

这么久都没解决呢。。。

this is still an issue.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

this is still an issue.

在 2020年8月24日,下午9:25,stale[bot] notifications@github.com 写道:


This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

this is still an issue.

any news

也是用的我们的Encript证书,不知有没有关系。模拟器上无卡顿现象,但在真机上存在,IOS系统。同样遇到这个问题,一直找不出原因,排查了好久才定位到dio。

统一 模拟器没问题 真机卡爆

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

还没解决么?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings