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.