简体   繁体   中英

QSslSocket: cannot call unresolved function SSLv23_client_method

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM