PDA

View Full Version : QNetworkAccessManager get request causing QSslSocket errors



Runtime Technologies
29th July 2009, 22:33
Hey everybody, thanks for your help. I've been struggling for days with this and I'm losing my patience. I have written a program in Linux (Ubuntu 8.1), WOOHOO, and now trying to deploy it in Windows (BOOOOOOO) is giving me an error with my QNetworkRequest.



#include <QNetworkRequest>
#include <QNetworkReply>
#include <QSslSocket>

void MainWindow::downloadLatestMaster(QString process)
{
myrUrl="http://my.hosted.server/pagetoload.php";

// file init
if(!file.open(QIODevice::ReadWrite|QIODevice::Text )) {
ui->textEdit->append(QString("!! - Failed to open "+file.fileName()));
// further error handling
} else {
// request init
QNetworkRequest request(myUrl);
reply=manager.get(request); // perform get request

// connections connect(reply,SIGNAL(downloadProgress(qint64,qint6 4)),SLOT(mySetValue(qint64,qint64)));
connect(reply,SIGNAL(readyRead()),SLOT(downloadRea dyRead())); // reply ready - output file
connect(reply,SIGNAL(finished()),SLOT(replyFinishe d())); // reply finished - close file
}
}

// output file contents
void MainWindow::downloadReadyRead()
{
file.write(reply->readAll());
}

// close file and update ui
void MainWindow::replyFinished()
{
file.close();
}



Instead of the normal operation I experience in Linux (WOOHOO) I see the fillowing in my output window:

QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
QSslSocket: cannot call unresolved function OPENSSL_add_all_algorithms_noconf

Before I added the #include <QSslSocket> my proress bar didn't work and the request seemed to just be skipped over. Now that I added the include my progress bar updates, but no file is written and the data in my reply is just empty.

I am confused because I never access an SSL socket, though I can conceive that perhaps the QNetworkAccessManager does. Is this because of some shared vs. linked building problem? Am I just crazy? If anyone has come across this issue before and could possibly shed some light on my error I would so greatly appreciate it. Thank you.

Oh, by the way, I did try substituting the QNetwrokReply for an QHttp request and same error. Please help!

wysota
29th July 2009, 22:59
Do you have OpenSSL libraries installed and OpenSSL support compiled into Qt?

Runtime Technologies
29th July 2009, 23:07
I just installed OpenSsl and I no longer receive the error messages, though I am still receiving no bytes of data. All I did was install OpenSsl, I have not compiled support for it into Qt and I am at a loss as to how to go about doing that or even what that really means.

Thank you, Wysota, once again for your help. You helped me a lot last time I had a problem and I want you to know I appreciate it.

Runtime Technologies
29th July 2009, 23:18
Correction: File output working as expected. Still, must I compile OpenSsl support into Qt?

wysota
29th July 2009, 23:43
Please check if QNetworkAccessManager::sslErrors() signal gets emitted.


Correction: File output working as expected. Still, must I compile OpenSsl support into Qt?

If everything works fine then no.

Runtime Technologies
29th July 2009, 23:57
No ssl errors emitted.