QNetworkAccessManager Failed to make connection with https server
-
Hi all,
I am working on QNetworkAccessManager and I am stuck with it. I have developed my code in QT 4.7.4. and it is working fine on 4.7.4. But when I update from QT4.7.4 to 4.8.0. then my connection failed and finished signal is called with timeout. For more information my project is also working fine on Mac OS X 10.7 with QT 4.8.0. It throws sslError and I simply ignore it. But on Windows no sslError, no error through QNetworkReply. I have installed openSSl and placed lib files in Windows/system directory. By doing this I am able to hit some "https" servers.
I can communicate with some "https" like gmail servers but it failed on server where I want.Please help me out.
Thanks in advance :).
-
For more information: Below is my code snippet:
@
ServerTest::ServerTest()
{
manager = new QNetworkAccessManager(this);
QNetworkConfigurationManager manager1;
manager->setConfiguration(manager1.defaultConfiguration());
req.setUrl(QUrl("https://mytestserver.com"));
req.setRawHeader("Content-Type", "application/json+batch");
QByteArray postData("Hello World");
QNetworkReply reply= manager->post(req, postData);
connect(reply , SIGNAL(error(QNetworkReply::NetworkError)) , this , SLOT(error(QNetworkReply::NetworkError)));
connect(manager , SIGNAL(sslErrors(QNetworkReply,QList<QSslError>)) , this ,SLOT(sslErrors(QNetworkReply*,const QList<QSslError> &)));
connect(manager , SIGNAL(finished(QNetworkReply*)) , this , SLOT(finished(QNetworkReply*)));
}
void ServerTest::sslErrors(QNetworkReply reply, const QList<QSslError> &errors) {
qDebug("ssl error" + errors.length());
reply->ignoreSslErrors(errors);
}
void ServerTest::finished(QNetworkReply reply) {
qDebug("** Finished **** ");
QByteArray data = reply->readAll();
qDebug(data);
}
void ServerTest::error(QNetworkReply::NetworkError code) {
qDebug("Error "+code);
}
@After 4-5 minutes it only prints "***** finished **********".
But when I run same project on QT 4.7.4 then I received following out put:
ssl error
Finished signal with reply->readAll.
{"success":false,"config":{"stop_submitting":false,"submit_interval":5,"submit_count":1},"success_count":0,"fail_count":1} -
I have added "code wrappings,":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 please remember next time.