Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error : "Protocol \"https\" is unknown"



  • Hello i am trying to make a request to HTTPS url , i am getting following error
    Error : "Protocol \"https\" is unknown"

    below code works fine for the HTTP request but not for HTTPS

    #include <QCoreApplication>
    #include <QNetworkAccessManager>
    #include <QNetworkRequest>
    #include <QNetworkReply>
    #include <QUrl>
    #include <QUrlQuery>
    #include <QDebug>
    #include <QString>
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
         QString requested_url = "https://www.google.com";
    
        // create custom temporary event loop on stack
        QEventLoop eventLoop;
    
        // "quit()" the event-loop, when the network request "finished()"
        QNetworkAccessManager mgr;
        QObject::connect(&mgr, SIGNAL(finished(QNetworkReply*)), &eventLoop, SLOT(quit()));
    
        // the HTTP request
        QNetworkRequest req( requested_url );
    
        QSslConfiguration conf = req.sslConfiguration();
        conf.setPeerVerifyMode(QSslSocket::VerifyNone);
        req.setSslConfiguration(conf);
    
    
        QNetworkReply *reply = mgr.get(req);
        eventLoop.exec();
    
        if (reply->error() == QNetworkReply::NoError) {
    
    	qDebug() << (QString)reply->readAll();
    
    
        }
        else {
    	qDebug() << "Error : " << reply->errorString();
    }
        return a.exec();
    }
    

    i am using Qt 5.9.2 on CentOS 7


  • Lifetime Qt Champion

    Hi,

    How did you install Qt ?
    What version of OpenSSL do you have installed ?



  • openssl : OpenSSL 1.0.2k-fips 26 Jan 2017

    offline installer for qt


  • Lifetime Qt Champion

    Do you have the same issue if you use your distribution provided Qt ?



  • @sgaist i am not sure how to check it.


  • Lifetime Qt Champion

    Hi
    try to install qt and see what version it has

    yum install qt

    check whats installed

    yum list qt*




  • Lifetime Qt Champion

    Hence our suggestions: use your distribution package manager to install Qt and test that this version is working properly first.



  • hey i didn't fixed it . i downloaded Qt5.12.4 and then upgraded my openssl lib to 1.1.1b

    so i am good now
    thanks !!