QSslSocket error when SSL is NOT used

岁酱吖の 提交于 2019-11-28 09:14:53

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.

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. 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

We occasionally had customers getting very similar warning messages but the software was also crashing.

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
QMutex: destroying locked mutex

We determined it was because, although we weren't using SSL either, the program found a copy of OpenSSL on the customer's computer and tried interfacing with it. The version it found was too old though (from Qt 5.2 onwards v1.0.0 or later is required).

Our solution was to distribute the OpenSSL DLLs along with our application (~1.65 MB). The alternative is to compile Qt from scratch without OpenSSL support.

Can be disabled related warning messages with QLoggingCategory::setFilterRules("qt.network.ssl.w arning=false");

Have you tried QSslSocket::ignoreSslErrors?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!