I have the following code in QT that correctly get the webpage in Windows ( 7 x64 ) but not in Linux Debian 9.13
void Mycl::getdata()
{
QNetworkAccessManager *networkManager;
networkManager = new QNetworkAccessManager(this);
QString urlStr="https://.......");
QUrl url(urlStr);
QNetworkRequest request;
request.setUrl(url);
connect (networkManager,SIGNAL(finished(QNetworkReply*)),this, SLOT(done(QNetworkReply*)));
networkManager->get(request);
}
void Mycl::done(QNetworkReply *reply)
{
if (reply->error() == QNetworkReply::NoError)
{
QString data = QString(reply->readAll ());
in Debian i get the folowing error at runtime:
Warning: QSslSocket: OpenSSL >= 1.1.1 is required; OpenSSL 1.1.0l 10 Sep 2019 was found instead ((null):0, (null))
Warning: QSslSocket::connectToHostEncrypted: TLS initialization failed ((null):0, (null))
Debug: "TLS initialization failed" (../Shiva2/mycl.cpp:65, void Mycl::done(QNetworkReply*))
I have the following package installed in the os:
ii libssl1.0.2:amd64 1.0.2u-1~deb9u6 amd64 Secure Sockets Layer toolkit – shared libraries
ii libssl1.1:amd64 1.1.0l-1~deb9u4 amd64 Secure Sockets Layer toolkit – shared libraries
ii libssl-dev:amd64 1.1.0l-1~deb9u4 amd64 Secure Sockets Layer toolkit – development files
ii openssl 1.1.0l-1~deb9u4 amd64 Secure Sockets Layer toolkit – cryptographic utility
I don’t know if the error is related to this packages… any suggestion? thanks
UPDATE:
Trying to update packages to debian bullseye ( stable ) I get the following error on a dependency :
dpkg -i libc6_2.31-13+deb11u2_amd64.deb
dpkg: regarding libc6_2.31-13+deb11u2_amd64.deb containing libc6:amd64:
libc6:amd64 breaks locales (<< 2.31)
locales (version 2.24-11+deb9u4) is present and installed.
dpkg: error processing archive libc6_2.31-13+deb11u2_amd64.deb (--install):
installing libc6:amd64 would break locales, and
deconfiguration is not permitted (--auto-deconfigure might help)
Errors were encountered while processing:
libc6_2.31-13+deb11u2_amd64.deb
also i can’t upgrade full os cause it’s a virtual server in rent.
Which version of QT i should use?
2
Answers
It says that you have to have openssl version 1.1.1 or higher. But Debian 9 out-of-the-box supports only 1.1.0. So you have to either upgrade openssl or downgrade Qt. Here you can find how to upgrade openssl in debian 9.
And of course you can update your OS but it look like the trickiest way, though. 🙂
That is due to the openssl version provided by you OS and the one required by QT.
Avoid up/down-grading your OS openssl version, try connecting to the QNetworkAccessManager signal:
and, in your slot, invoke
reply->ignoreSslErrors()
.If that does not work, copy the QT openssl .so files somewhere in your PATH.