Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QNetworkAccessManager get different behavior on Qt 5.12 and Qt 5.15



  • I am trying to simple get request like:

    #include "firebase.h"
    #include <QNetworkRequest>
    #include <QDebug>
    
    firebase::firebase(QObject *parent):QObject(parent)
    {
        m_networkManager = new QNetworkAccessManager(this);
        m_networkReply = m_networkManager->get(QNetworkRequest(QUrl("https://google.com")));
    
        connect(m_networkReply, &QNetworkReply::finished, this, &firebase::NetworkReplyRead);
    }
    
    firebase::~firebase()
    {
        m_networkManager->deleteLater();
    }
    
    void firebase::NetworkReplyRead()
    {
        qDebug()<<m_networkReply->readAll();
    }
    
    
    

    Which is working really well with qt 5.12. I installed qt 5.12 with apt-get.
    And I already installed 5.15 by hand as submodules from here https://download.qt.io/archive/qt/5.15/5.15.0/submodules/

    Interesting thing I can not get anything with 5.15 for this simple code. It returns empty.
    But it is working with 5.12

    These are the dependencies from the binary which is compiled with 5.12
    linux-vdso.so.1 (0x00007ffd0e537000)
    libQt5Network.so.5 => /lib/x86_64-linux-gnu/libQt5Network.so.5 (0x00007fe30ed3c000)
    libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fe30e7f3000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe30e612000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe30e5f7000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe30e405000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe30e3e2000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe30e3c4000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe30e3be000)
    libicui18n.so.66 => /lib/x86_64-linux-gnu/libicui18n.so.66 (0x00007fe30e0bf000)
    libicuuc.so.66 => /lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007fe30ded9000)
    libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007fe30de56000)
    libdouble-conversion.so.3 => /lib/x86_64-linux-gnu/libdouble-conversion.so.3 (0x00007fe30de40000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fe30dd15000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe30dbc6000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fe30ef1f000)
    libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66 (0x00007fe30c105000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fe30c092000)

    And this one from 5.15
    linux-vdso.so.1 (0x00007ffc898e3000)
    libQt5Network.so.5 => /usr/local/Qt-5.15.0/lib/libQt5Network.so.5 (0x00007f8a9358f000)
    libQt5Core.so.5 => /usr/local/Qt-5.15.0/lib/libQt5Core.so.5 (0x00007f8a92f65000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8a92d6a000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8a92d4f000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8a92b5d000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8a92b3a000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8a92b1c000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8a92b16000)
    libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007f8a92a93000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f8a9296a000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8a9281b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f8a936f7000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f8a927a6000)

    How it can be possible. What can be the problem here ?

    Thank you.



  • Prime suspect is OpenSSL missing. connect a slot to sslError and see if it tells you what's going wrong



  • Prime suspect is OpenSSL missing. connect a slot to sslError and see if it tells you what's going wrong



  • @VRonin said in QNetworkAccessManager get different behavior on Qt 5.12 and Qt 5.15:

    sslError

    After your command, I checked the configuration and yes I compiled it without ssl. Is there any way without ssl to make it work ?

    OpenSSL ................................ no
    Qt directly linked to OpenSSL ........ no
    OpenSSL 1.1 ............................ no


  • Lifetime Qt Champion

    @PhysicsX said in QNetworkAccessManager get different behavior on Qt 5.12 and Qt 5.15:

    Is there any way without ssl to make it work ?

    Not if the website you're accessing is using HTTPS


  • Lifetime Qt Champion

    Hi,

    @PhysicsX said in QNetworkAccessManager get different behavior on Qt 5.12 and Qt 5.15:

    @VRonin said in QNetworkAccessManager get different behavior on Qt 5.12 and Qt 5.15:

    sslError

    After your command, I checked the configuration and yes I compiled it without ssl. Is there any way without ssl to make it work ?

    OpenSSL ................................ no
    Qt directly linked to OpenSSL ........ no
    OpenSSL 1.1 ............................ no

    Since you are compiling it yourself, why not just install the OpenSSL dev package from your distribution ?


Log in to reply