Error : "Protocol \"https\" is unknown"
Solved
General and Desktop
-
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
-
Hi,
How did you install Qt ?
What version of OpenSSL do you have installed ? -
Do you have the same issue if you use your distribution provided Qt ?
-
Hi
try to install qt and see what version it hasyum install qt
check whats installed
yum list qt*
-
hello i have Qt from here : https://download.qt.io/official_releases/qt/5.9/5.9.2/
-
Hence our suggestions: use your distribution package manager to install Qt and test that this version is working properly first.