qtqnetworkaccessmanagerqnetworkreplyqnetworkrequest

QNetworkAcessManager Not work in release mode on different computers


I have a very strange problem I create an application that use QNetworkAcessManager to download an HTML page and get the data from this page I release my application to use it on my second laptop on the same wireless connection but it not works.
on my computer, after releasing the app and use windeploy.exe to get all the dll file for this release exe I try to use it on my computer which has QT and developed on it it works fine and get the data in the file.
the problem comes when I use it on another computer the app works but when I press the button to get the data it gets nothing just empty file so any help for this problem this the code which I use normal QNetworkAcessManager code to get HTML page data this code in the button to get the data

manager->clearAccessCache();
manager->clearConnectionCache();
if (reply != nullptr)
    delete reply;
reply = manager->get(QNetworkRequest(QUrl("https://normalpage.html")));
connect(reply, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(reply, SIGNAL(finished()), this, SLOT(Finish()));

readyread

void MainWindow::readyRead()
{
    data.append(reply->readAll());
}

finish function I get the data of type QByteArray and use it to get the data from it the function is long
I was having this problem for about two months but I was in hurry so I used libcurl with QProcess to get this HTML page data but I now I want to know what cause this problem
update
I used the code in my main.cpp to get all the Qt warnings and errors in a file as mention in the comment by Macias and I get this into the file I used append to the file so I can get all the error it comes and I got some warnings from QSslSocket if anyone can check these warnings and see if it cause the problem as I don't know

Error file

    Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
)
))
Warning: QSslSocket: cannot call unresolved function SSLv23_client_method ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSL_CTX_new ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSL_library_init ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSLv23_client_method ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSL_CTX_new ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSL_library_init ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))

but in the working computer I got this warrnings

Warning: QSslSocket: cannot resolve SSL_set_alpn_protos ((null):0, (null))
Warning: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb ((null):0, (null))
Warning: QSslSocket: cannot resolve SSL_get0_alpn_selected ((null):0, (null))
Warning: QSslSocket: cannot resolve SSL_set_alpn_protos ((null):0, (null))
Warning: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb ((null):0, (null))
Warning: QSslSocket: cannot resolve SSL_get0_alpn_selected ((null):0, (null))



Update
when i add the new dll files in the folder excutable file it give me this warrnings

    Warning: QSslSocket: cannot call unresolved function SSLv23_client_method ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSL_CTX_new ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSL_library_init ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))


connect the reply to the error signal

connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(Error(QNetworkReply::NetworkError)));

and the slot is here

    void MainWindow::Error(QNetworkReply::NetworkError Myerror)
{
    qDebug() << "QNetworkReply::NetworkError = " << Myerror;
}


this what i get after connect error signal and the attribute

Warning: QSslSocket: cannot call unresolved function SSLv23_client_method ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSL_CTX_new ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function SSL_library_init ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
Debug: QNetworkReply::NetworkError =  QNetworkReply::NetworkError(UnknownNetworkError) ((null):0, (null))
Debug: Attribute in finish slot =  QVariant(Invalid) ((null):0, (null))


when I added the three dlls file to the release folder on my computer which the app i working without them i got this error enter image description here
when i go to the path of C:\AppServ\Apache24\bin and copied this dlls (libeay32.dll and ssleay32.dll) from this folder instead of the others i downloaded from the dll website it finally it works but what is the difference between both in the appchace folder and that are download from website?

thanks in advance


Solution

  • Make sure that you have libeay32.dll, libssl32.dll and ssleay32.dll libs in your deployment folder. If not just copy them next to your *.exe

    windeployqt tool does not include these libs.

    EDIT:
    Your error is propably caused by incopatible version of openSSL library. Version in use at compile time is different from this used at run-time. You can easily check it out. Add these lines after QApplication creation in main.cpp:

    qDebug() << "SslSupport: " << QSslSocket::supportsSsl();
    qDebug() << "SslLibraryBuildVersion: " << QSslSocket::sslLibraryBuildVersionString();
    qDebug() << "SslLibraryRuntimeVersion: " << QSslSocket::sslLibraryVersionString();
    

    You should install and put to your release the most similar to build version.