QSslSocket error when SSL is NOT used

后端 未结 4 1932
青春惊慌失措
青春惊慌失措 2020-12-09 20:42

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

QSslSocket: cannot reso         


        
相关标签:
4条回答
  • 2020-12-09 20:46

    Have you tried QSslSocket::ignoreSslErrors?

    0 讨论(0)
  • 2020-12-09 20:48

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

    0 讨论(0)
  • 2020-12-09 20:58

    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.

    0 讨论(0)
  • 2020-12-09 21:10

    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
    0 讨论(0)
提交回复
热议问题