Qt World Summit: Register Today!

"Not supported" reply while using QNetworkAccessManager Qt5.11.

  • Hello,

    Previously I am using Qt4.8 and with that, QNetworkAccessManager GET/POST request with bearer working correctly.
    Now I am migrating my code to Qt5.11. But when I am using QNetworkAccessManager, the Application is crashing and on a terminal log, "Not supported" message is coming.

    Even I have tried simple POST example from Qt5 but same result.

    Please help me for the same. Thanks in Advance.

  • Lifetime Qt Champion

    Hi and welcome to the forum

    A good start would be to use the debugger and find out what line it's crashing in.
    Many years between 4.8 and 5.11 so its very hard to guess at with no code or any other information.

  • Hello @mrjj ,

    At last, I have commented whole code and just defined QNetworkAccessManager but the definition itself crashed the Whole application and "Not supported" logs on the Linux console.

    I have tried with debug also and result is same.
    Anything with Qt5 configuration of QNetworkAccessmanager?

  • Lifetime Qt Champion

    just defining QNetworkAccessManager should not crash app.

    I cannot find out what "Not supported" should come from.

    so example like

    // https://github.com/KubaO/stackoverflown/tree/master/questions/html-get-24965972
    #include <QtNetwork>
    #include <functional>
    void htmlGet(const QUrl &url, const std::function<void(const QString&)> &fun) {
       QScopedPointer<QNetworkAccessManager> manager(new QNetworkAccessManager);
       QNetworkReply *response = manager->get(QNetworkRequest(QUrl(url)));
       QObject::connect(response, &QNetworkReply::finished, [response, fun]{
          if (response->error() != QNetworkReply::NoError) return;
          auto const contentType =
          static QRegularExpression re("charset=([!-~]+)");
          auto const match = re.match(contentType);
          if (!match.hasMatch() || 0 != match.captured(1).compare("utf-8", Qt::CaseInsensitive)) {
             qWarning() << "Content charsets other than utf-8 are not implemented yet:" << contentType;
          auto const html = QString::fromUtf8(response->readAll());
          fun(html); // do something with the data
       }) && manager.take();
    int main(int argc, char *argv[])
       QCoreApplication app(argc, argv);
       htmlGet({"http://www.google.com"}, [](const QString &body){ qDebug() << body; qApp->quit(); });
       return app.exec();

    also crashes ?

  • Hai All,

    Even I am facing similar crash issue in my embedded Linux device , I have developed a QML application , and declared QNetworkAccessManager in a separate thread and QML GUI in main thread. The complete application is getting crashed after some time.
    The crash is not happening during debugging from QT creator , it appears only when running the application has a standalone. I am using Qt 5.11.3.

    James A

  • Lifetime Qt Champion


    Check all your pointers.

    Are you sure you are not triggering a double deletion ?

    Since you have multiple threads ensure that you are not accessing common data without proper protection in place.

Log in to reply