QSslSocket: cannot resolve TLSv1_1_client_method - for windows desktop application



  • I get the below error when I use GET of QNetworkAccessManager:

    @void ItemObjectAPI::getRequest (const QString &urlString)
    {
    QUrl url (BaseUrl + urlString);
    QNetworkRequest req (url);
    m_NetworkAccessManager.get (req);
    }@

    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
    (Internal error: pc 0x1 in read in psymtab, but not in symtab.)
    (Internal error: pc 0x0 in read in psymtab, but not in symtab.)
    Debugging has finished

    Im using Qt5, windows 8 32 bit OS pc. How to resolve this?


  • Moderators

    Hi, welcome to devnet.

    These might be two different problems I think. But to be sure let's first take care of the SSL stuff.
    Are those QSslSocket messages errors or just warnings? Do you have "OpenSSL":http://slproweb.com/products/Win32OpenSSL.html installed and dlls placed in your app directory or somewhere system wide?



  • Hi,
    I am debugging from the qtcreator. I'm not sure if they are errors or not.. but the debugging goes to "moc_mainwindow.cpp"

    @void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
    {
    if (_c == QMetaObject::InvokeMetaMethod) {
    MainWindow *_t = static_cast<MainWindow *>(_o);
    switch (_id) {
    case 0: _t->callGetRequest(); break;
    case 1: _t->displayItem((reinterpret_cast< QByteArray()>(_a[1]))); break;
    default: ;
    }
    }
    }@

    and from there to "Disassembler(QMetaObject::active)"

    @0x6b946890 <+0x059a> mov 0x6bcb89f0,

    and again.. why I need to install OpenSSL?


  • Moderators

    It depends on the urls you're going to use. https:// links use SSL, which Qt supports but doesn't distribute libraries for.

    My guess is your BaseUrl url is a https:// link. Is that right?



  • http://localhost/x/y/ - is my BaseUrl. So if I am building this application for an android device, how can i install OpenSSL?? Do I have to install it on each machine I am using my application???


  • Moderators

    If you use OpenSSL then you need to distribute it with your app. Either tell user to install or bundle OenSSL installer with your app or even just copy dlls to your app directory (but check licensing first, I'm not a lawyer). How it works on android I don't know,.

    But anyway, for http you don't need OpenSSL, so that's not the problem. As I said this might be something unrelated.

    Seems you have a bug somewhere in your code, but you'll have to give more details, like when it happens(at the start, when you do something specific) etc.
    Some code and a full callstack might be helpful too.



  • item.cpp

    @#include "item.h"
    #include <QJsonDocument>

    Item::Item (const QByteArray &jsonAsItem)
    {
    QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonAsItem);
    QJsonObject jsonObject = jsonDocument.object();

    m_id        = jsonObject["id"].toInt();
    m_name      = jsonObject["name"].toString();
    m_price     = jsonObject["price"].toInt();
    m_isValid   = true;
    

    }

    int Item::id()
    {
    return m_id;
    }

    QString Item::name()
    {
    return m_name;
    }

    double Item::price()
    {
    return m_price;
    }

    bool Item::valid()
    {
    return m_isValid;
    }
    @

    itemobjectapi.cpp

    @#include "itemobjectapi.h"
    #include <QString>
    #include <QtCore/QtCore>

    const QString BaseUrl = "http://localhost/Checker/api/items/";

    ItemObjectAPI::ItemObjectAPI(QObject parent) :
    QObject (parent)
    {
    QObject::connect(&m_NetworkAccessManager, SIGNAL(finished(QNetworkReply
    )), this,
    SLOT(parseNetworkResponse(QNetworkReply*)));
    }

    void ItemObjectAPI::getRequest (const QString &urlString)
    {
    QUrl url (BaseUrl + urlString);
    QNetworkRequest req (url);
    m_NetworkAccessManager.get (req);
    }

    void ItemObjectAPI::parseNetworkResponse( QNetworkReply *finished )
    {
    if ( finished->error() != QNetworkReply::NoError )
    {
    // A communication error has occurred
    emit networkError( finished->error() );
    return;
    }

    // QNetworkReply is a QIODevice. So we read from it just like it was a file
    QByteArray data = finished->readAll();
    emit ItemRetrived (data);
    

    }
    @

    mainwindow.cpp

    @#include "mainwindow.h"
    #include "item.h"

    MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    {
    pMainWidget = new QWidget ();

    setCentralWidget(pMainWidget);
    
    
    button = new QPushButton("get data");
    textLine = new QLineEdit();
    output = new QLabel("output replaces me");
    
    layout = new QHBoxLayout(pMainWidget);
    pMainWidget->setLayout(layout);
    
    layout->addWidget(textLine);
    layout->addWidget(button);
    layout->addWidget(output);
    
    QObject::connect(button, SIGNAL(clicked()), this, SLOT(callGetRequest()));
    QObject::connect(&item_api, SIGNAL(ItemRetrived(QByteArray)), this, SLOT(displayItem(QByteArray)));
    

    }

    MainWindow::~MainWindow()
    {

    }

    void MainWindow::displayItem(QByteArray data)
    {
    Item item(data);
    textLine->setText(item.name()+" "+item.price());
    }

    void MainWindow::callGetRequest()
    {
    QString url = textLine->text();
    if (!(url.compare("")))
    {
    output->setText("Enter Item Number");
    }
    else
    {
    item_api.getRequest(url);
    }

    }
    @

    during debugging, in itemobjectapi.cpp after line 18, it is no idea how is it going the control... I have set break point at "parseNetworkResponse(QNetworkReply*)"



  • To Chris Kawa:

    Thanks, the error in my application was the JSON object parameters I used to parse. It is case sensitive. I had to give it as
    @m_id = jsonObject["Id"].toInt();
    m_name = jsonObject["Name"].toString();
    m_price = jsonObject["Price"].toInt();@

    The app works. But still I gets the messages:
    bq. 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 am just ignoring those, hoping they are not errors..


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.