简体   繁体   English

android webview:空白页面,SSL错误没有回调

[英]android webview: blank page, no callback on SSL error

For my app, the user enters a server name, and the app should try HTTPS, and fall back to HTTP if HTTPS fails.对于我的应用程序,用户输入服务器名称,应用程序应尝试使用 HTTPS,如果 HTTPS 失败,则回退到 HTTP。 fine.美好的。

I understand about using WebViewClient.onReceivedSslError() to handle the SSL error, and that works fine most of the time.我了解使用WebViewClient.onReceivedSslError()来处理 SSL 错误,并且大多数情况下都可以正常工作。 However, occasionally, I see that this method is not called, despite seeing these two lines in the log,然而,偶尔,我看到这个方法没有被调用,尽管在日志中看到了这两行,

08-17 08:55:33.430: W/chromium(3264): external/chromium/net/http/http_stream_factory_impl_job.cc:865: [0817/085533:WARNING:http_stream_factory_impl_job.cc(865)] Falling back to SSLv3 because host is TLS intolerant: svcstable1.hs.trcint.com:80
08-17 08:55:33.490: E/chromium(3264): external/chromium/net/socket/ssl_client_socket_openssl.cc:780: [0817/085533:ERROR:ssl_client_socket_openssl.cc(780)] handshake failed; returned -1, SSL error code 1, net_error -107

this will happen sporadically.这会偶尔发生。 it will fail 3x in a row, then works fine and I can't get it to fail again.它会连续失败 3 次,然后工作正常,我不能让它再次失败。

At this point, I'm contemplating fetching the page contents myself and setting the data into the web view.在这一点上,我正在考虑自己获取页面内容并将数据设置到 Web 视图中。 I'd rather not do that, but it seems like my only option at this point.我宁愿不这样做,但这似乎是我目前唯一的选择。

Any ideas?有任何想法吗?

I was never able to find the reason or solution to this.我一直无法找到原因或解决方案。 I ended up using HttpClient to "test" the connection before handing it off to the WebView .我最终使用HttpClient来“测试”连接,然后再将其交给WebView

Very much a pain especially when WebView has what would seem to be robust error handing mechanisms.非常痛苦,尤其是当WebView具有似乎是健壮的错误处理机制时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM