简体   繁体   English

qt.network.ssl:QSslSocket:无法解析SSLv2_client_method

[英]qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method

I am trying to make POST request to remote server. 我正在尝试向远程服务器发出POST请求。 Here is my code: 这是我的代码:

void LoginWindow::on_login_pushButton_clicked()
{
    const QString url = ui->server_lineEdit->text ();
    const QString username = ui->username_lineEdit->text ();
    const QString password = ui->password_lineEdit->text ();
    QNetworkAccessManager mAccessManager;
    QNetworkRequest request(QUrl(url + "/api/auth/"));

    QUrlQuery urlQuery;
    urlQuery.addQueryItem ("username", username);
    urlQuery.addQueryItem ("password", password);

    QUrl params;
    params.setQuery (urlQuery);

    QNetworkReply* reply = mAccessManager.post (request, params.toEncoded ());

    connect (reply, &QNetworkReply::readyRead, [reply]() {
        qDebug()  << "Ready to read from reply";
    });
    connect (reply, &QNetworkReply::sslErrors, [this] (QList<QSslError> error) {
        qWarning () << "Ssl error: " << error;
    });

}

When I clicked the login button nothing happens, except a message in application output tab. 当我单击登录按钮时,除了“应用程序输出”选项卡中的消息外,什么都没有发生。

qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method

I checked the remote server log, there was no request from qt client. 我检查了远程服务器日志,没有来自qt客户端的请求。

I am using ubuntu 16.04 and Qt 5.9 . 我正在使用ubuntu 16.04和Qt 5.9。 I also followed this solution, still no luck 我也遵循解决方案,仍然没有运气

sslv2 is completely disabled in newer distributions , install libssl-0.98 from launchpad by dpkg . 在较新的发行版中,sslv2已完全禁用,请通过dpkg启动板安装libssl-0.98。

Open a terminal, go to the extracted folder and run: 打开一个终端,转到解压缩的文件夹并运行:

sudo dpkg -i file.deb 须藤dpkg -i file.deb

sudo apt-get install -f 须藤apt-get install -f

You can use QSsl::SecureProtocols to enable the SSL versions which are considered secure as of the Qt release. 您可以使用QSsl :: SecureProtocols启用从Qt版本开始被视为安全的SSL版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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