不使用 SSL 时出现 QSslSocket 错误 [英] QSslSocket error when SSL is NOT used

查看:38
本文介绍了不使用 SSL 时出现 QSslSocket 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的两个 Qt 应用程序中注意到了这个输出,这些应用程序使用 QNetworkRequest 从外部通过 QNeworkRequest 加载一些数据:

I have noticed this output in two of my Qt applications that use QNetworkRequest to load some data from outside over QNeworkRequest :

QSslSocket: cannot resolve TLSv1_1_client_method
QSslSocket: cannot resolve TLSv1_2_client_method
QSslSocket: cannot resolve TLSv1_1_server_method
QSslSocket: cannot resolve TLSv1_2_server_method
QSslSocket: cannot resolve SSL_select_next_proto
QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
QSslSocket: cannot resolve SSL_get0_next_proto_negotiated

导致这些警告出现的请求示例是

One example of the request which causes these warnings to appear is

QNetworkReply reply = m_nam->get(QNetworkRequest(QUrl("http://api.openweathermap.org/data/2.5/forecast?id=2835297&mode=xml")));

我有理由确信在任何查询中都没有涉及 TLS/SSL,所有这些都是普通的 HTTP.无论 URL 是什么,消息总是在第一个请求发出后出现.我根本没有打算使用 SSL,代码中没有提到 SSL,这意味着我不能以编程方式忽略这些警告.

I am reasonably sure that there is no TLS/SSL involved in any of the queries, all are plain HTTP. The messages appear always after the first request is dispatched, regardless of URL. I have no intention to ude SSL at all, there is no mention of SSL in the code, which means I can't ignore the warnings programatically.

我的设置是 Windows 7 64 位、MSVC2013 和 MinGW、Qt 5.3.2.无论使用何种编译器,都会出现这些消息.未安装 OpenSSL 或其他 SSL 开发库.

My setup is Windows 7 64 bit, MSVC2013 and MinGW, Qt 5.3.2. The messages appear regardless of the compiler used. No OpenSSL or other SSL development libraries are installed.

问题是:如何消除这些警告?

推荐答案

这些只是来自解析 OpenSSL 函数时的 qWarning() 调用.它不是试图调用这些函数,而是解析它们.调用未解析的函数会导致 QSslSocket: cannot call unresolved function ... 警告.

These are just from qWarning() call when OpenSSL functions are resolved. It is not trying to call these functions, just resolving them. Calling unresolved functions would result in QSslSocket: cannot call unresolved function ... warning instead.

该警告是 OpenSSL 函数在运行时通过调用 QNetworkAccessManager::supportedSchemesImplementation() 中的 QSslSocket::supportsSsl() 静态来解析的结果,返回支持的模式--- http 并且,如果 SSL 支持 https.

The warning is result of OpenSSL functions being resolved at runtime by a call to QSslSocket::supportsSsl() static in QNetworkAccessManager::supportedSchemesImplementation() that returns supported schemas --- http and, if SSL supported https.

对于这些警告,您几乎没有选择,

You have few options about these warnings,

  1. 忽略它们,因为您无论如何都不想要或不需要 SSL
  2. 使用传递给 configure
  3. -no-openssl 重新编译 Qt
  4. 发布 OpenSSL 以便解析功能并且 https 可用 - 可能不是您想要的
  1. ignore them because you don't want or need SSL anyway
  2. recompile Qt with -no-openssl passed to configure
  3. ship OpenSSL so functions are resolved and https becomes available - probably not what you want

这篇关于不使用 SSL 时出现 QSslSocket 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆