Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › Qt 5.8 http2 not working

Tagged: , , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15982

    Razvan

    Hello,

    I’m working on a app that requires http2 (the backend i’m using doesn’t add new features to older versions of http). It was so exciting to see that qt 5.8 comes with http2 but unfortunately when i tried to enable it, it didn’t work. I made a little demo project to ilustrate the problem.

     

    #include <QApplication>
    #include <VPApplication>
    
    #include <QQmlApplicationEngine>
    
    #include <QNetworkAccessManager>
    #include <QNetworkRequest>
    #include <QNetworkReply>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        VPApplication vplay;
        vplay.setPreservePlatformFonts(true);
    
        QQmlApplicationEngine engine;
        vplay.initialize(&engine);
    
        vplay.setMainQmlFileName(QStringLiteral("qml/Main.qml"));
    
        engine.load(QUrl(vplay.mainQmlFileName()));
    
        QNetworkRequest req(QUrl("https://nghttp2.org/httpbin/headers"));
        req.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true));
    
        QNetworkAccessManager manager;
    
        QNetworkReply* reply = manager.get(req);
    
        QEventLoop eventLoop;
        QObject::connect(reply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
        eventLoop.exec();
    
        QList<QByteArray> reply_headers = reply->rawHeaderList();
    
        foreach(QByteArray head, reply_headers) {
            qDebug() << head << ":" << reply->rawHeader(head);
        }
    
        qDebug().noquote() << reply->readAll();
        return app.exec();
    }
    

     

    The result of this test needs to look like this:

    "Date" : "Wed, 22 Feb 2017 08:06:03 GMT"
    "Content-Type" : "application/json"
    "Content-Length" : "182"
    "Access-Control-Allow-Origin" : "*"
    "Access-Control-Allow-Credentials" : "true"
    "X-Backend-Header-Rtt" : "0.002863"
    "Strict-Transport-Security" : "max-age=31536000"
    "Connection" : "close"
    "Server" : "nghttpx nghttp2/1.20.0-DEV"
    "Via" : "1.1 nghttpx"
    "x-frame-options" : "SAMEORIGIN"
    "x-xss-protection" : "1; mode=block"
    "x-content-type-options" : "nosniff"
    {
      "headers": {
        "Accept-Encoding": "gzip, deflate",
        "Accept-Language": "en-US,*",
        "Host": "nghttp2.org",
        "User-Agent": "Mozilla/5.0",
        "Via": "1.1 nghttpx"
      }
    }

     

    but instead of  “1.1” it should be “2”.

    I know this kind of bugs doesn’t necessarily fall into the domain of Felgo bugs but it’s something that everyone benefits from and you guys here might have encountered this problem already.

     

    Thank you.

     

    #15999

    Günther
    Felgo Team

    Hi Razvan,

    Thanks for sharing your problem! We did not yet have a closer look at Qt’s http2 features. If there’s an issue and it does not work correctly, please consider asking about it in the official Qt forums. You can also keep us updated with the progress here as well so other Felgo users can benefit from it.

    Best,
    Günther

     

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.