H2: emit encrypted for at least the first reply, similar to H1
Fixes: QTBUG-95277 Change-Id: I1fe01503376c0d6278e366d7bd31b412b7cc3a69 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit c23b7886348dc313ccec1a131850a7cce1b429de) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d31118fa0e
commit
6774992368
@ -1259,6 +1259,10 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
|
|||||||
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2 ||
|
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2 ||
|
||||||
connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
|
connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
|
||||||
if (h2RequestsToSend.count() > 0) {
|
if (h2RequestsToSend.count() > 0) {
|
||||||
|
// Similar to HTTP/1.1 counterpart below:
|
||||||
|
const auto &h2Pairs = h2RequestsToSend.values(); // (request, reply)
|
||||||
|
const auto &pair = h2Pairs.first();
|
||||||
|
emit pair.second->encrypted();
|
||||||
// In case our peer has sent us its settings (window size, max concurrent streams etc.)
|
// In case our peer has sent us its settings (window size, max concurrent streams etc.)
|
||||||
// let's give _q_receiveReply a chance to read them first ('invokeMethod', QueuedConnection).
|
// let's give _q_receiveReply a chance to read them first ('invokeMethod', QueuedConnection).
|
||||||
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
|
||||||
|
@ -278,6 +278,10 @@ void tst_Http2::singleRequest()
|
|||||||
request.setAttribute(h2Attribute, QVariant(true));
|
request.setAttribute(h2Attribute, QVariant(true));
|
||||||
|
|
||||||
auto reply = manager->get(request);
|
auto reply = manager->get(request);
|
||||||
|
#if QT_CONFIG(ssl)
|
||||||
|
QSignalSpy encSpy(reply, &QNetworkReply::encrypted);
|
||||||
|
#endif // QT_CONFIG(ssl)
|
||||||
|
|
||||||
connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
|
connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
|
||||||
// Since we're using self-signed certificates,
|
// Since we're using self-signed certificates,
|
||||||
// ignore SSL errors:
|
// ignore SSL errors:
|
||||||
@ -292,6 +296,11 @@ void tst_Http2::singleRequest()
|
|||||||
|
|
||||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||||
QVERIFY(reply->isFinished());
|
QVERIFY(reply->isFinished());
|
||||||
|
|
||||||
|
#if QT_CONFIG(ssl)
|
||||||
|
if (connectionType == H2Type::h2Alpn || connectionType == H2Type::h2Direct)
|
||||||
|
QCOMPARE(encSpy.count(), 1);
|
||||||
|
#endif // QT_CONFIG(ssl)
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_Http2::multipleRequests()
|
void tst_Http2::multipleRequests()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user