Let the h2 test server both send and receive DATA frames
And use this in the authenticationRequired test. Change-Id: I18e991eb67168214c2c4f829afaca5018568e989 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit deda40b8591a387e634ebfcf48287c14162ef332) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
8c0dab650d
commit
baae2252d8
@ -753,8 +753,10 @@ void Http2Server::handleDATA()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inboundFrame.flags().testFlag(FrameFlag::END_STREAM)) {
|
if (inboundFrame.flags().testFlag(FrameFlag::END_STREAM)) {
|
||||||
|
if (responseBody.isEmpty()) {
|
||||||
closedStreams.insert(streamID); // Enter "half-closed remote" state.
|
closedStreams.insert(streamID); // Enter "half-closed remote" state.
|
||||||
streamWindows.erase(it);
|
streamWindows.erase(it);
|
||||||
|
}
|
||||||
emit receivedData(streamID);
|
emit receivedData(streamID);
|
||||||
}
|
}
|
||||||
emit receivedDATAFrame(streamID,
|
emit receivedDATAFrame(streamID,
|
||||||
|
@ -164,6 +164,7 @@ private:
|
|||||||
int windowUpdates = 0;
|
int windowUpdates = 0;
|
||||||
bool prefaceOK = false;
|
bool prefaceOK = false;
|
||||||
bool serverGotSettingsACK = false;
|
bool serverGotSettingsACK = false;
|
||||||
|
bool POSTResponseHEADOnly = true;
|
||||||
|
|
||||||
static const RawSettings defaultServerSettings;
|
static const RawSettings defaultServerSettings;
|
||||||
};
|
};
|
||||||
@ -893,14 +894,21 @@ void tst_Http2::contentEncoding()
|
|||||||
void tst_Http2::authenticationRequired_data()
|
void tst_Http2::authenticationRequired_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<bool>("success");
|
QTest::addColumn<bool>("success");
|
||||||
|
QTest::addColumn<bool>("responseHEADOnly");
|
||||||
|
|
||||||
QTest::addRow("failed-auth") << false;
|
QTest::addRow("failed-auth") << false << true;
|
||||||
QTest::addRow("successful-auth") << true;
|
QTest::addRow("successful-auth") << true << true;
|
||||||
|
// Include a DATA frame in the response from the remote server. An example would be receiving a
|
||||||
|
// JSON response on a request along with the 401 error.
|
||||||
|
QTest::addRow("failed-auth-with-response") << false << false;
|
||||||
|
QTest::addRow("successful-auth-with-response") << true << false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_Http2::authenticationRequired()
|
void tst_Http2::authenticationRequired()
|
||||||
{
|
{
|
||||||
clearHTTP2State();
|
clearHTTP2State();
|
||||||
|
QFETCH(const bool, responseHEADOnly);
|
||||||
|
POSTResponseHEADOnly = responseHEADOnly;
|
||||||
|
|
||||||
QFETCH(const bool, success);
|
QFETCH(const bool, success);
|
||||||
|
|
||||||
@ -979,6 +987,7 @@ void tst_Http2::clearHTTP2State()
|
|||||||
windowUpdates = 0;
|
windowUpdates = 0;
|
||||||
prefaceOK = false;
|
prefaceOK = false;
|
||||||
serverGotSettingsACK = false;
|
serverGotSettingsACK = false;
|
||||||
|
POSTResponseHEADOnly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_Http2::runEventLoop(int ms)
|
void tst_Http2::runEventLoop(int ms)
|
||||||
@ -1111,7 +1120,7 @@ void tst_Http2::receivedData(quint32 streamID)
|
|||||||
Q_ASSERT(srv);
|
Q_ASSERT(srv);
|
||||||
QMetaObject::invokeMethod(srv, "sendResponse", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(srv, "sendResponse", Qt::QueuedConnection,
|
||||||
Q_ARG(quint32, streamID),
|
Q_ARG(quint32, streamID),
|
||||||
Q_ARG(bool, true /*HEADERS only*/));
|
Q_ARG(bool, POSTResponseHEADOnly /*true = HEADERS only*/));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_Http2::windowUpdated(quint32 streamID)
|
void tst_Http2::windowUpdated(quint32 streamID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user