Use HTTP2WasUsedAttribute for HTTP2
Previously we were always setting SpdyWasUsedAttribute for SPDY/HTTP/2/HTTP/1.1 (true/false) which is confusing. Now if HTTP2AllowedAttribute was set to true on a request, we set HTTP2WasUsedAttribute. Otherwise, as we did before, we're setting SpdyWasUsedAttribute. Change-Id: I0c44cfb5469fef0c12719baa951197ee2accee4a Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
886ce572d6
commit
baf7180776
|
|
@ -1387,6 +1387,8 @@ void QHttp2ProtocolHandler::initReplyFromPushPromise(const HttpMessagePair &mess
|
|||
{
|
||||
Q_ASSERT(promisedData.contains(cacheKey));
|
||||
auto promise = promisedData.take(cacheKey);
|
||||
Q_ASSERT(message.second);
|
||||
message.second->setSpdyWasUsed(true);
|
||||
|
||||
qCDebug(QT_HTTP2) << "found cached/promised response on stream" << promise.reservedID;
|
||||
|
||||
|
|
|
|||
|
|
@ -1234,7 +1234,14 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
|
|||
}
|
||||
|
||||
q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu);
|
||||
q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, spdyWasUsed);
|
||||
const QVariant http2Allowed = request.attribute(QNetworkRequest::HTTP2AllowedAttribute);
|
||||
if (http2Allowed.isValid() && http2Allowed.toBool()) {
|
||||
q->setAttribute(QNetworkRequest::HTTP2WasUsedAttribute, spdyWasUsed);
|
||||
q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, false);
|
||||
} else {
|
||||
q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, spdyWasUsed);
|
||||
q->setAttribute(QNetworkRequest::HTTP2WasUsedAttribute, false);
|
||||
}
|
||||
|
||||
// reconstruct the HTTP header
|
||||
QList<QPair<QByteArray, QByteArray> > headerMap = hm;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,10 @@ QT_BEGIN_NAMESPACE
|
|||
allowed to use HTTP/2 with this request. This applies
|
||||
to SSL requests or 'cleartext' HTTP/2.
|
||||
|
||||
\omitvalue HTTP2WasUsedAttribute
|
||||
\value HTTP2WasUsedAttribute
|
||||
Replies only, type: QMetaType::Bool (default: false)
|
||||
Indicates whether HTTP/2 was used for receiving this reply.
|
||||
(This value was introduced in 5.9.)
|
||||
|
||||
\value EmitAllUploadProgressSignalsAttribute
|
||||
Requests only, type: QMetaType::Bool (default: false)
|
||||
|
|
|
|||
|
|
@ -590,8 +590,15 @@ void tst_Http2::replyFinished()
|
|||
{
|
||||
QVERIFY(nRequests);
|
||||
|
||||
if (const auto reply = qobject_cast<QNetworkReply *>(sender()))
|
||||
if (const auto reply = qobject_cast<QNetworkReply *>(sender())) {
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
const QVariant http2Used(reply->attribute(QNetworkRequest::HTTP2WasUsedAttribute));
|
||||
QVERIFY(http2Used.isValid());
|
||||
QVERIFY(http2Used.toBool());
|
||||
const QVariant spdyUsed(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute));
|
||||
QVERIFY(spdyUsed.isValid());
|
||||
QVERIFY(!spdyUsed.toBool());
|
||||
}
|
||||
|
||||
--nRequests;
|
||||
if (!nRequests && serverGotSettingsACK)
|
||||
|
|
|
|||
Loading…
Reference in New Issue