11

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")));

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.

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.

And the question is: How do I get rid of these warnings?

Pavel
  • 698
  • 1
  • 11
  • 20

4 Answers4

18

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
user3427419
  • 1,769
  • 11
  • 15
  • Great explanation, thank you! Usually I prefer not to plainly ignore what _my_ program outputs, but it looks like the optimal solution here. – Pavel Oct 15 '14 at 08:16
  • 3
    In addition, you can also disable those messages by setting environmental variable QT_LOGGING_RULES=qt.network.ssl.warning=false – arashka Dec 02 '15 at 21:25
  • that's not good though,I better see the warning and ignore them, than hiding them, later I maybe in trouble and I won't know what's going on, warnings helps to debug. – Xsmael Feb 18 '16 at 16:08
  • How do I "ship OpenSSL"? – Zhang Oct 11 '18 at 10:09
5

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

jeton
  • 841
  • 12
  • 15
  • Interesting that it works even with the extra space. And it works without the ".warning" altogether. Go figure... – Machta Mar 19 '17 at 11:56
4

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.

mjk99
  • 1,290
  • 11
  • 18
1

Have you tried QSslSocket::ignoreSslErrors?

Iuliu
  • 4,001
  • 19
  • 31
  • 1
    I don't use QSslSocket, I have no object to use it on. There is no intention to use SSL at all. I'll edit this into the original answer to make it clear. – Pavel Oct 14 '14 at 12:52
  • I tried it, and it does not fix the issue: warnings still appears, program still freezing. – Fylhan Feb 17 '17 at 11:23