1

I am trying to call http and https and trying to parse the response. I am getting the reponse for http calls but for https calls I am getting this error

QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error




void MyClass::on_push_button_clicked()
{
QString address = "New York";

QNetworkAccessManager *qnam__get_address=NULL;
QNetworkRequest request;


QString myurl;
//myurl = "http://google.com/complete/search?output=toolbar&q="+address;
myurl = "https://maps.googleapis.com/maps/api/geocode/xml?address=New York&key=google api key";
QUrl url(myurl);
request.setUrl(url);
qDebug() << url;
qnam__get_address = new QNetworkAccessManager(this);
if(qnam__get_address) {
    QObject::connect(qnam__get_address, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(onSslError(QNetworkReply*, QList<QSslError>)));
    QObject::connect(qnam__get_address, SIGNAL(finished(QNetworkReply*)),this, SLOT(on_push_button_clicked_response(QNetworkReply*)));
    reply = qnam__get_address->get(request);
}
return;
}
void MyClass::onSslError(QNetworkReply* r, QList<QSslError> errors) 
{
r->ignoreSslErrors();
}

void MyClass::on_push_button_clicked_response(QNetworkReply* reply)
{
// no error received?
if (reply->error() == QNetworkReply::NoError)
{
    qDebug()<<"MyClass:: got the response";
}
// Some http error received
else
{
    qDebug() << ".......error";
}
if(reply)
{
    reply->deleteLater();
}
return;
}

Can someone please tell me how to solve this error? What exactly do I need to do?

Also one strange behaviour I have observed that when I keep libeay32.dll and ssleay32.dll files with .exe file, I get response for https but not getting http response.

sk110
  • 77
  • 2
  • 9

1 Answers1

1

Heights of stupidity.............. I installed OpenSSL and it solved the problem. So now I am not getting any error if I try to run/debug it.

I found why these URLs were not working. //myurl = "http://google.com:80/complete/search?output=toolbar&q="+address; myurl = "https://maps.googleapis.com:443/maps/api/geocode/xml?address=New York&key=google api key"; After I added port I got the response.

sk110
  • 77
  • 2
  • 9
  • I am having exactly the same problem. However, I am devOPs engineer, so I must get this to work on users machine, not just developer environment. Any other info you can post on your fix would save me some time and I would appreciate it. In the meantime I will investigate what is given and report back my findings. Thank you sk110. – sitting-duck Jul 24 '18 at 15:31
  • I know it's a bit late. Try adding following dll's in the same directory where .exe file is and it should fix the problem. 1. ssleay32.dll 2. ssleay32MD.dll 3. ssleay32.dll 4. ssleay32MD.dll – sk110 Aug 10 '18 at 03:27
  • The way I fixed it is I ran I dependency walker on another Windows machine that did not have the problem. Dependency Walkder found another sleay dll that was built by Intel. I replace my sleay dlls with these dlls from the working machine in my installer and the problem went away. I hope that makes a little sense. :D – sitting-duck Aug 12 '18 at 21:21