Question

I have a Qt QWebKit based application that needs to use HTTPS to talk to web pages. I have downloaded the QtSDK, as well as the OpenSSL binaries (from here).

My problem lies in deploying my application. I have copied the relevant Qt DLL files, as well as the relevant OpenSSL DLL files (libeay32.dll and ssleay32.dll) into my application directory, but when I try to access HTTPS web pages from within my application it fails! The application doesn't crash, but the page is blank. Regular HTTP pages work perfectly fine.

It's clear that there's an error with how I'm distributing OpenSSL with my application, I'm just not sure where I'm going wrong.

I'd really not like to bundle the OpenSSL installer with my application.

Was it helpful?

Solution

Hello anybody reading this trying to debug similar issues. The problem was that the OpenSSL DLL binaries distributed by Shining Light Productions require the Visual C++ redistributables to function properly.

To distribute OpenSSL DLLs with your application without having to also distribute the Visual C++ Redistributables, you can compile OpenSSL yourself using MinGW. The instructions for compiling OpenSSL with MinGW are included in the OpenSSL source distribution.

You may need to distribute the MinGW DLL with your application if you do this. This wasn't a problem for me since I compiled by Qt application with MinGW in the first place.

OTHER TIPS

Can try to ignore the ssl certificate ?

Header file :

void sslErrors(QNetworkReply*,const QList<QSslError> &errors);

Constructor :

 connect(&qnam, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
         this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));

Method definition :

void HttpWindow::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
{
 QString errorString;
 foreach (const QSslError &error, errors) {
     if (!errorString.isEmpty())
         errorString += ", ";
     errorString += error.errorString();
 }

 if (QMessageBox::warning(this, tr("HTTP"),
                          tr("One or more SSL errors has occurred: %1").arg(errorString),
                          QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {
     reply->ignoreSslErrors();
 }
}

For more information , kindly see your QT HTTP example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top