QSslSocket:不能調用未解析函數SSLv23_client_method

[英]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

我正在嘗試調用http和https並試圖解析響應。我得到了http調用的響應,但是對於https調用,我得到了這個錯誤

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.

我還觀察到一種奇怪的行為:當我保持睡姿時。dll和ssleay32。使用.exe文件的dll文件,我得到https的響應,但沒有得到http響應。

1 个解决方案

#1


0  

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.

高度的愚蠢..............我安裝了OpenSSL,它解決了問題。因此,如果我嘗試運行/調試它,現在不會得到任何錯誤。

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.

我發現為什么這些url不工作。/ / myurl = " http://google.com:80 /完成/搜索?輸出= toolbar&q = " +地址;myurl = " https://maps.googleapis.com:443 /地圖/ api /項目點/ xml ?地址= New York&key = google api鍵”;添加端口之后,我得到了響應。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2017/02/05/725d8f74bd01768ddbffd6194795fe96.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com