Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
722 views
in Technique[技术] by (71.8m points)

qt - QSslSocket error when SSL is NOT used

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...