How to handle QSslSocket: cannot resolve TLSv1
I'm trying to develop a program that can connect to google map and get the map by using google map GPS parameters. so i have one problem , when i compile the code and click the run button i see these errors in the application output:
QSslSocket: cannot resolve TLSv1_1_client_method
QSslSocket: cannot resolve TLSv1_2_client_method
QSslSocket: cannot resolve TLSv1_1_server_method
QSslSocket: cannot resolve TLSv1_2_server_method
i googled a lot but could'nt find any answer , i also tried to install open-ssl v1.0.1 and v .98 but still got Nothing.
MY Qt version : Qt Creator 3.0.1 Based on Qt 5.2.1
Here is my code :
MainWindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QUrl>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QString>
#include <QPixmap>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_pushButton_clicked();
void imageloaded(QNetworkReply *);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
Mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QString gmurl;
gmurl = "http://maps.googleapis.com/maps/api/staticmap?center=35.704465,51.409597&zoom=16&size=600x600&sensor=false&markers=color:red%7Clabel:S%7C35.704465,51.409597" ;
QUrl url(gmurl);
QNetworkRequest request(url);
QNetworkAccessManager manager;
manager.get(request);
connect(&manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(imageloaded(QNetworkReply*)));
}
void MainWindow::imageloaded(QNetworkReply *reply){
QByteArray data = reply->readAll();
reply->deleteLater();
QPixmap pixmap;
pixmap.loadFromData(data);
ui->label->setPixmap(pixmap.scaled((600,600),Qt::KeepAspectRatio));
}
Thanks a lot.
These warnings are printed by Qt (Qt Network specifically) when it loads the OpenSSL libraries at runtime, but does not find the above mentioned functions in them (probably because the OpenSSL libraries found are too old). They essentially mean that Qt was compiled with an OpenSSL version that supported TLS v1.1, v1.2, but that the OpenSSL libraries found on your system does support only up to TLS v1.0.
The warnings are not fatal by itself (TLS 1.0 is still considered secure, and most servers will accept it), but are a hint that your application bundles outdated OpenSSL libraries, or relies on finding libeay32.dll, ssleay32.dll somewhere on the system (in PATH).
If you want to avoid these warnings, either ship a very recent libeay32.dll, ssleay32.dll together with your application, or let Qt link in openssl statically (see Enabling and Disabling SSL Support in the Qt documentation on how to do this).
链接地址: http://www.djcxy.com/p/79454.html上一篇: C ++